# uvatradier
`uvatradier` 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.
Wahoowa.
## Features
- **Account Management**: Retrieve profile, balance, gain/loss, orders, and positions related to a trading account.
- **Trading**: Place, modify, and cancel equity and option orders.
- **Market Data**: Access real-time and historical market data for equities and options.
- **Options Data**: Retrieve options chains, strikes, and expiration dates.
- **Stream Market Events**: Stream market events via WebSocket.
## Installation
To install `uvatradier`, you can use `pip`:
`pip install uvatradier`
## Hello World
Steps to get started:
* Create an account with <a href='https://tradier.com/'>Tradier.com</a>.
* Grab Account Number and Access Token from your Tradier dashboard.
* Log into Tradier > Preferences (gear icon) > API Access (left panel) > Account Access (section).
* 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: <br>
`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: <br>
`import os, dotenv`
`from uvatradier import Tradier, Account, Quotes, EquityOrder, OptionsData, OptionsOrder, Stream`
`dotenv.load_dotenv()`
`tradier_acct = os.getenv('tradier_acct')`
`tradier_token = os.getenv('tradier_token')`
* To instantiate the class objects, use: <br>
`account = Account(tradier_acct, tradier_token)`
`quotes = Quotes(tradier_acct, tradier_token)`
`equity_order = EquityOrder(tradier_acct, tradier_token)`
`options_data = OptionsData(tradier_acct, tradier_token)`
`options_order = OptionsOrder(tradier_acct, tradier_token)`
* To enable <b>live trading</b>:
* Modify the instantiation statements to include a third argument, `live_trade=True`.
* Ensure that the `tradier_acct` and `tradier_token` variables correspond to your production account. <br>
`tradier = Tradier(tradier_acct, tradier_token, live_trade=True)`
`account = Account(tradier_acct, tradier_token, live_trade=True)`
* If live trading is enabled, then you can utilize the `Stream` class to stream market events:
`stream = Stream(tradier_acct, tradier_token, live_trade=True)`
## Usage
This section provides example functionality of the existing codebase. Additional sample code demonstrating usage can be found in the `/examples/` directory.
### Account Management
- Get User Profile:
`user_profile = account.get_user_profile()`
- Get Account Balance:
`account_balance = account.get_account_balance()`
- Get Gain/Loss:
`gain_loss = account.get_gainloss()`
- Get Orders:
`orders = account.get_orders()`
- Get Positions:
`positions = account.get_positions()`
### Trading
- Place Equity Order:
`order_response = equity_order.place_order('AAPL', 'buy', 1, 'limit', 150)`
- Place Options Order:
`order_response = options_order.place_order('AAPL210917C00125000', 'buy_to_open', 1, 'limit', 3.5)`
### Market Data
- Get Quotes:
`quotes_data = quotes.get_quote_day('AAPL')`
- Get Historical Quotes:
`historical_data = quotes.get_historical_quotes('AAPL')`
- Get Time Sales:
`timesales = quotes.get_timesales('AAPL')`
### Options Data
- Get Options Chains:
`options_chains = options_data.get_options_chain('AAPL')`
- Get Options Strikes:
`options_strikes = options_data.get_options_strikes('AAPL')`
- Get Options Expirations:
`options_expirations = options_data.get_options_expirations('AAPL')`
### Stream Market Events
- Start market event stream for JP Morgan Chase:
`stream.stream_market_events(symbol_list=['JPM'])`
- Stream Exxon Mobil and Kinder Morgan market events and filter for quote updates and trade events only with a line break to separate each new event:
`stream.stream_market_events(symbol_list=['XOM', 'KMI'], filter_list=['trade', 'quote'], line_break=True)`
## Development
To contribute or make changes to the `uvatradier` 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/uvatradier.git`
- Navigate to the directory where the relevant code is kept:
`cd uvatradier`
- If you need to be careful about dependencies, create a new Python virtual environment: <br>
`python -m venv replace_this_with_desired_venv_name` [Mac] <br>
`venv\Scripts\activate` [Windows]
## Questions?
Happy to help! Feel free to contact Tom Hammons by email at qje5vf@virginia.edu. <br>
Thanks much in advance for your interest in using the package.
## License
`uvatradier` is licensed under the Apache License 2.0
Raw data
{
"_id": null,
"home_page": "https://github.com/thammo4/uvatradier",
"name": "uvatradier",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "tradier finance api",
"author": "tom hammons",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/09/78/9b5d408137d8880096f7edaaa9071662d108a1772c9de4a8e442a5ae3cc3/uvatradier-0.4.7.tar.gz",
"platform": null,
"description": "# uvatradier\n\n`uvatradier` 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.\n\nThe package was originally developed by data science graduate students at the University of Virginia.\n\nWahoowa.\n\n## Features\n\n- **Account Management**: Retrieve profile, balance, gain/loss, orders, and positions related to a trading account.\n- **Trading**: Place, modify, and cancel equity and option orders.\n- **Market Data**: Access real-time and historical market data for equities and options.\n- **Options Data**: Retrieve options chains, strikes, and expiration dates.\n- **Stream Market Events**: Stream market events via WebSocket.\n\n## Installation\n\nTo install `uvatradier`, you can use `pip`:\n\n`pip install uvatradier`\n\n## Hello World\n\nSteps to get started:\n * Create an account with <a href='https://tradier.com/'>Tradier.com</a>.\n * Grab Account Number and Access Token from your Tradier dashboard.\n * Log into Tradier > Preferences (gear icon) > API Access (left panel) > Account Access (section).\n * Create a `.env` file in the appropriate working directory on your computer.\n * Launch text editor application.\n * Save the file as `.env`.\n * In the file, add the following lines, replacing the appropriate placeholder fields: <br>\n `tradier_acct=<YOUR_ACCOUNT_NUMBER_FROM_TRADIER_DASHBOARD>`\n\n `tradier_token=<YOUR_ACCESS_TOKEN_FROM_TRADIER_DASHBOARD>`\n * Within the aforementioned working directory, initiate a new python session (interactive python, jupyter notebook, etc.).\n * To authenticate yourself, add the following lines of code to the top of your python script or jupyter notebook: <br>\n `import os, dotenv`\n \n `from uvatradier import Tradier, Account, Quotes, EquityOrder, OptionsData, OptionsOrder, Stream`\n \n `dotenv.load_dotenv()`\n \n `tradier_acct = os.getenv('tradier_acct')`\n \n `tradier_token = os.getenv('tradier_token')`\n \n * To instantiate the class objects, use: <br>\n `account = Account(tradier_acct, tradier_token)`\n\n `quotes = Quotes(tradier_acct, tradier_token)`\n\n `equity_order = EquityOrder(tradier_acct, tradier_token)`\n\n `options_data = OptionsData(tradier_acct, tradier_token)`\n\n `options_order = OptionsOrder(tradier_acct, tradier_token)`\n\n * To enable <b>live trading</b>:\n * Modify the instantiation statements to include a third argument, `live_trade=True`.\n * Ensure that the `tradier_acct` and `tradier_token` variables correspond to your production account. <br>\n\n `tradier = Tradier(tradier_acct, tradier_token, live_trade=True)`\n \n `account = Account(tradier_acct, tradier_token, live_trade=True)`\n\n * If live trading is enabled, then you can utilize the `Stream` class to stream market events:\n\n `stream = Stream(tradier_acct, tradier_token, live_trade=True)`\n\n## Usage\n\nThis section provides example functionality of the existing codebase. Additional sample code demonstrating usage can be found in the `/examples/` directory.\n\n### Account Management\n\n- Get User Profile:\n\n `user_profile = account.get_user_profile()`\n\n- Get Account Balance:\n\n `account_balance = account.get_account_balance()`\n\n- Get Gain/Loss:\n\n `gain_loss = account.get_gainloss()`\n\n- Get Orders:\n\n `orders = account.get_orders()`\n\n- Get Positions:\n\n `positions = account.get_positions()`\n\n### Trading\n\n- Place Equity Order:\n\n `order_response = equity_order.place_order('AAPL', 'buy', 1, 'limit', 150)`\n\n- Place Options Order:\n\n `order_response = options_order.place_order('AAPL210917C00125000', 'buy_to_open', 1, 'limit', 3.5)`\n\n### Market Data\n\n- Get Quotes:\n\n `quotes_data = quotes.get_quote_day('AAPL')`\n\n- Get Historical Quotes:\n\n `historical_data = quotes.get_historical_quotes('AAPL')`\n\n- Get Time Sales:\n\n `timesales = quotes.get_timesales('AAPL')`\n\n### Options Data\n\n- Get Options Chains:\n\n `options_chains = options_data.get_options_chain('AAPL')`\n\n- Get Options Strikes:\n\n `options_strikes = options_data.get_options_strikes('AAPL')`\n\n- Get Options Expirations:\n\n `options_expirations = options_data.get_options_expirations('AAPL')`\n\n### Stream Market Events\n\n- Start market event stream for JP Morgan Chase:\n\n `stream.stream_market_events(symbol_list=['JPM'])`\n\n- Stream Exxon Mobil and Kinder Morgan market events and filter for quote updates and trade events only with a line break to separate each new event:\n\n `stream.stream_market_events(symbol_list=['XOM', 'KMI'], filter_list=['trade', 'quote'], line_break=True)`\n\n## Development\n\nTo contribute or make changes to the `uvatradier` package, feel free to create a fork, clone the fork, make some improvements and issue a pull request. From the terminal/command prompt:\n\n- Clone the forked branch to your local machine:\n\n `git clone https://github.com/YOUR_USERNAME/uvatradier.git`\n\n- Navigate to the directory where the relevant code is kept: \n\n `cd uvatradier`\n\n- If you need to be careful about dependencies, create a new Python virtual environment: <br>\n\n `python -m venv replace_this_with_desired_venv_name` [Mac] <br>\n \n `venv\\Scripts\\activate` [Windows]\n\n## Questions?\n\nHappy to help! Feel free to contact Tom Hammons by email at qje5vf@virginia.edu. <br>\nThanks much in advance for your interest in using the package.\n\n## License\n\n`uvatradier` is licensed under the Apache License 2.0\n",
"bugtrack_url": null,
"license": null,
"summary": "wahoowa",
"version": "0.4.7",
"project_urls": {
"Bug Tracker": "https://github.com/thammo4/uvatradier/issues",
"Homepage": "https://github.com/thammo4/uvatradier"
},
"split_keywords": [
"tradier",
"finance",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9184881dffcc0392f4433c10efb232dc99170245b7d4f9ffd76bab1658e6e535",
"md5": "5cdb0c21f4c747246a8f980f7e3b3b29",
"sha256": "c1f8b55e0c8c7822f9c2a3644fe2e01683135b52d5e1bc9f013915cab7375795"
},
"downloads": -1,
"filename": "uvatradier-0.4.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5cdb0c21f4c747246a8f980f7e3b3b29",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 42866,
"upload_time": "2024-10-15T18:01:31",
"upload_time_iso_8601": "2024-10-15T18:01:31.000916Z",
"url": "https://files.pythonhosted.org/packages/91/84/881dffcc0392f4433c10efb232dc99170245b7d4f9ffd76bab1658e6e535/uvatradier-0.4.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09789b5d408137d8880096f7edaaa9071662d108a1772c9de4a8e442a5ae3cc3",
"md5": "306c10f13ee3ad9c783b6cc66567fe23",
"sha256": "894ca47b292227efea55edf3bad70b1dd80ee2e3dc702a0ca86c1aa625f03e62"
},
"downloads": -1,
"filename": "uvatradier-0.4.7.tar.gz",
"has_sig": false,
"md5_digest": "306c10f13ee3ad9c783b6cc66567fe23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 375042,
"upload_time": "2024-10-15T18:01:32",
"upload_time_iso_8601": "2024-10-15T18:01:32.623480Z",
"url": "https://files.pythonhosted.org/packages/09/78/9b5d408137d8880096f7edaaa9071662d108a1772c9de4a8e442a5ae3cc3/uvatradier-0.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 18:01:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thammo4",
"github_project": "uvatradier",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "uvatradier"
}