
Product
Rubygems Ecosystem Support Now Generally Available
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
lumiwealth-tradier is a Python package that serves as a wrapper for the Tradier brokerage API. This package simplifies the process of making API requests, handling responses, and performing various trading and account management operations.
lumiwealth-tradier
is a Python package that serves as a wrapper for the Tradier brokerage API. This package simplifies the process of making API requests, handling responses, and performing various trading and account management operations.
The package was originally developed by data science graduate students at the University of Virginia.
To install lumiwealth-tradier
, you can use pip
:
pip install lumiwealth-tradier
Steps to get started:
Create an account with Tradier.com.
Grab Account Number and Access Token from your Tradier dashboard.
Create a .env
file in the appropriate working directory on your computer.
Launch text editor application.
Save the file as .env
.
In the file, add the following lines, replacing the appropriate placeholder fields:
tradier_acct=<YOUR_ACCOUNT_NUMBER_FROM_TRADIER_DASHBOARD>
tradier_token=<YOUR_ACCESS_TOKEN_FROM_TRADIER_DASHBOARD>
Within the aforementioned working directory, initiate a new python session (interactive python, jupyter notebook, etc.).
To authenticate yourself, add the following lines of code to the top of your python script or jupyter notebook:
import os, dotenv
from lumiwealth_tradier import Tradier
dotenv.load_dotenv()
tradier_acct = os.getenv('tradier_acct')
tradier_token = os.getenv('tradier_token')
To instantiate the class objects, use:
tradier = Tradier(tradier_acct, tradier_token, is_paper=True) # is_paper=True for sandbox environment, if you have a real money account, set to False
This section provides example functionality of the existing codebase. Additional sample code demonstrating usage can be found in the /examples/
directory.
Get User Profile:
user_profile = tradier.account.get_user_profile()
Get Account Balance:
account_balance = tradier.account.get_account_balance()
Get Gain/Loss:
gain_loss = tradier.account.get_gainloss()
Get Orders:
orders = tradier.orders.get_orders()
Get Positions:
positions = tradier.account.get_positions()
Place Equity Order:
order_response = tradier.orders.order('AAPL', 'buy', 1, 'limit', 150)
Place Options Order:
order_response = tradier.orders.order('AAPL210917C00125000', 'buy_to_open', 1, 'limit', 3.5)
Get Last Price:
last_price = tradier.market.get_last_price('SPY')
Get Quotes:
quotes_data = tradier.market.get_quotes(["AAPL", "MSFT", "SPY"])
Get Historical Quotes and Get Time Sales:
from datetime import datetime, timedelta
start_date = datetime.now() - timedelta(days=10)
end_date = datetime.now()
historical_data = tradier.market.get_historical_quotes(
"AAPL",
interval="daily", # Can be "daily", "weekly", or "monthly"
start_date=start_date,
end_date=end_date,
session_filter="all", # Can be "all" or "open"
)
timesales = tradier.market.get_timesales(
"MSFT",
interval=1, # Can be 1, 5 or 15
start_date=start_date,
end_date=end_date,
session_filter="all", # Can be "all" or "open"
)
tradier.market.get_chains(symbol, expiration, greeks=True)
Get Options Expirations:
tradier.market.get_options_expirations(symbol, strikes=True)
To contribute or make changes to the lumiwealth-tradier
package, feel free to create a fork, clone the fork, make some improvements and issue a pull request. From the terminal/command prompt:
Clone the forked branch to your local machine:
git clone https://github.com/YOUR_USERNAME/lumiwealth-tradier.git
Navigate to the directory where the relevant code is kept:
cd lumiwealth-tradier
Add the original repository as a remote:
git remote add upstream https://github.com/Lumiwealth/lumiwealth-tradier
Confirm the remote has been added:
git remote -v
Create a new branch for your feature:
git checkout -b feature_branch_name
If you need to be careful about dependencies, create a new Python virtual environment and activate it:
python -m venv venv
venv\Scripts\activate
Install the required dev dependencies:
pip install -r requirements_dev.txt
Install the package in editable mode:
pip install -e .
Create a .env
file in the root directory and add your Tradier account number and access token.
Add the following vars for testing:
TRADIER_ACCOUNT_NUMBER=<YOUR_ACCOUNT_NUMBER_FROM_TRADIER_DASHBOARD>
TRADIER_PAPER_TOKEN=<YOUR_PAPER_ACCESS_TOKEN_FROM_TRADIER_DASHBOARD>
Finally, run the tests:
pytest
Happy to help! Feel free to contact Robert Grzesik by email at <EMAIL?>.
Thanks much in advance for your interest in using the package.
lumiwealth-tradier
is licensed under the Apache License 2.0
FAQs
lumiwealth-tradier is a Python package that serves as a wrapper for the Tradier brokerage API. This package simplifies the process of making API requests, handling responses, and performing various trading and account management operations.
We found that lumiwealth-tradier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.