lumiwealth-tradier


Namelumiwealth-tradier JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/Lumiwealth/lumiwealth-tradier
Summarylumiwealth-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.
upload_time2024-04-04 06:16:20
maintainerNone
docs_urlNone
authorDavid MacLeod and Robert Grzesik
requires_python>=3.9
licenseNone
keywords tradier finance api
VCS
bugtrack_url
requirements pandas requests numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lumiwealth-tradier

`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.

## 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.

## Installation

To install `lumiwealth-tradier`, you can use `pip`:

`pip install lumiwealth-tradier`

## 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) > Sandbox 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 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: <br>
      `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`

## 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 = 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()`

### Trading

- 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)`

### Market Data

- 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:

  ```python
  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"
  )
  ```

  - Get Options Chains:

  ```python
  tradier.market.get_chains(symbol, expiration, greeks=True)
  ```

  - Get Options Expirations:
  
    ```python
    tradier.market.get_options_expirations(symbol, strikes=True)
    ```

## Development

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`

- 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 Robert Grzesik by email at <EMAIL?>. <br>
Thanks much in advance for your interest in using the package.

## License

`lumiwealth-tradier` is licensed under the Apache License 2.0

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Lumiwealth/lumiwealth-tradier",
    "name": "lumiwealth-tradier",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "tradier finance api",
    "author": "David MacLeod and Robert Grzesik",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ae/38/874b376b8a588caeca308940927c3d5c7168b363a16765fb261bac2c6d4f/lumiwealth-tradier-0.1.7.tar.gz",
    "platform": null,
    "description": "# lumiwealth-tradier\n\n`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.\n\nThe package was originally developed by data science graduate students at the University of Virginia.\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\n## Installation\n\nTo install `lumiwealth-tradier`, you can use `pip`:\n\n`pip install lumiwealth-tradier`\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) > Sandbox 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 lumiwealth_tradier import Tradier`\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      `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`\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 = tradier.account.get_user_profile()`\n\n- Get Account Balance:\n\n  `account_balance = tradier.account.get_account_balance()`\n\n- Get Gain/Loss:\n\n  `gain_loss = tradier.account.get_gainloss()`\n\n- Get Orders:\n\n  `orders = tradier.orders.get_orders()`\n\n- Get Positions:\n\n  `positions = tradier.account.get_positions()`\n\n### Trading\n\n- Place Equity Order:\n\n  `order_response = tradier.orders.order('AAPL', 'buy', 1, 'limit', 150)`\n\n- Place Options Order:\n\n  `order_response = tradier.orders.order('AAPL210917C00125000', 'buy_to_open', 1, 'limit', 3.5)`\n\n### Market Data\n\n- Get Last Price:\n\n  `last_price = tradier.market.get_last_price('SPY')`\n\n- Get Quotes:\n\n  `quotes_data = tradier.market.get_quotes([\"AAPL\", \"MSFT\", \"SPY\"])`\n\n- Get Historical Quotes and Get Time Sales:\n\n  ```python\n  from datetime import datetime, timedelta\n\n  start_date = datetime.now() - timedelta(days=10)\n  end_date = datetime.now()\n\n  historical_data = tradier.market.get_historical_quotes(\n      \"AAPL\",\n      interval=\"daily\",  # Can be \"daily\", \"weekly\", or \"monthly\"\n      start_date=start_date,\n      end_date=end_date,\n      session_filter=\"all\",  # Can be \"all\" or \"open\"\n  )\n\n  timesales = tradier.market.get_timesales(\n      \"MSFT\",\n      interval=1,  # Can be 1, 5 or 15\n      start_date=start_date,\n      end_date=end_date,\n      session_filter=\"all\",  # Can be \"all\" or \"open\"\n  )\n  ```\n\n  - Get Options Chains:\n\n  ```python\n  tradier.market.get_chains(symbol, expiration, greeks=True)\n  ```\n\n  - Get Options Expirations:\n  \n    ```python\n    tradier.market.get_options_expirations(symbol, strikes=True)\n    ```\n\n## Development\n\nTo 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:\n\n- Clone the forked branch to your local machine:\n\n  `git clone https://github.com/YOUR_USERNAME/lumiwealth-tradier.git`\n\n- Navigate to the directory where the relevant code is kept: \n\n  `cd lumiwealth-tradier`\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 Robert Grzesik by email at <EMAIL?>. <br>\nThanks much in advance for your interest in using the package.\n\n## License\n\n`lumiwealth-tradier` is licensed under the Apache License 2.0\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "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.",
    "version": "0.1.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/Lumiwealth/lumiwealth-tradier/issues",
        "Homepage": "https://github.com/Lumiwealth/lumiwealth-tradier"
    },
    "split_keywords": [
        "tradier",
        "finance",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fecdcf184952133d70f5c93cd6654314c3bbb62128eaf3f53c1e57a17f681047",
                "md5": "48230c7b553f69df39a9d70be515df4b",
                "sha256": "f68c32d7df9d77d8ae292a95c79044d4434c500f893e8222834781bcf27ab9a5"
            },
            "downloads": -1,
            "filename": "lumiwealth_tradier-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48230c7b553f69df39a9d70be515df4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 24138,
            "upload_time": "2024-04-04T06:16:18",
            "upload_time_iso_8601": "2024-04-04T06:16:18.240052Z",
            "url": "https://files.pythonhosted.org/packages/fe/cd/cf184952133d70f5c93cd6654314c3bbb62128eaf3f53c1e57a17f681047/lumiwealth_tradier-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae38874b376b8a588caeca308940927c3d5c7168b363a16765fb261bac2c6d4f",
                "md5": "044d7bf198eadc78d4b55b321e8c9788",
                "sha256": "33752cf0092713fb2185c347434b7c40aef20b0bee156fa796b6ee3ab3b74155"
            },
            "downloads": -1,
            "filename": "lumiwealth-tradier-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "044d7bf198eadc78d4b55b321e8c9788",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 23422,
            "upload_time": "2024-04-04T06:16:20",
            "upload_time_iso_8601": "2024-04-04T06:16:20.211460Z",
            "url": "https://files.pythonhosted.org/packages/ae/38/874b376b8a588caeca308940927c3d5c7168b363a16765fb261bac2c6d4f/lumiwealth-tradier-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 06:16:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Lumiwealth",
    "github_project": "lumiwealth-tradier",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "lumiwealth-tradier"
}
        
Elapsed time: 0.29398s