{ "info": { "author": "Sriram Yarlagadda", "author_email": "ysriram@umich.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n\n\n# tdlink\nPython Library for TDAmeritrade API\n\nAll the dates and times are in UTC.\n\n

Authentication

\n\n**NOTE:** Please make sure you obtain a code or refresh token from TDAmeritrade before using this library.\n\nFollow these steps to get a code:\n\n1) Go to TDAmeritrade developer: https://developer.tdameritrade.com/
\n2) Login and go to \"My Apps\"
\n3) Create an app. Use http://localhost as the callback url.
\n4) Go to this url: https://auth.tdameritrade.com/auth?response_type=code&redirect_uri=http://localhost&client_id=[YourAppName]@AMER.OAUTHAP
\n5) Enter your TD credentials and give premission
\n6) Once you login, you will be redirected to a url of this form https://localhost/?code=[code]
\n7) Copy the [code] part. Add it as a parameter to the TDAmeritrade class.
\n8) The TDAmeritrade class should now work!\n\n**NOTE:** The code you obtain is only valid for a limited period of time. If expired, follow steps again to get a new code.\n\n\n\n\n

Installation

\n\n

From PyPI

\n\n```\npip install tdlink\n```\n\n

From Source

\n\n```\npip install --upgrade git+git://github.com/ysriram1/tdlink\n```\n\n

Examples

\n\n

Connect to the API

\n\n```python\nfrom tdlink import TDlink\n\ntd = TDlink(app_key='TRADING123',\n redirect_uri='http://localhost',\n code=code, # follow instructions to get the code\n return_raw_response=False # will return formatted df if False, else returns HTTP response\n )\n```\n\n

Get the refresh and access tokens

\n\n```python\ntd.refresh_token # returns refresh token\n\ntd.access_token # returns the access token\n```\n\n*Note:* You can save the refresh token for creating a future session instead of using a code.\n\n

Get Data from API

\n\n

Current Quote

\n```python\ntd.get_current_quote(symbol='QQQ',\n to_return=['askPrice', 'bidPrice', 'totalVolume'])\n```\n
\"quote\"
\n\n*NOTE:* Use this also for prices of options.\n\n

Historical Data

\n\n```python\ntd.get_historical_prices(symbol='QQQ',\n period_type='day', # 'day'\n period=2, # day: 1, 2, 3, 4, 5, 10* month: 1*, 2, 3, 6 year: 1*, 2, 3, 5, 10, 15, 20 ytd: 1*\n frequency_type='minute', # day: minute* month: daily, weekly* year: daily, weekly, monthly* ytd: daily, weekly*\n frequency=5, # minute: 1*, 5, 10, 15, 30 daily: 1* weekly: 1* monthly: 1*\n start_date='06/03/2019', # mm/dd/yyyy\n start_time=None, # hh:mm:ss\n end_date='06/04/2019',\n end_time=None,\n extended_hours=True,\n return_df=True # if False, returns a dictionary instead\n )\n```\n\n
\"Historical
\n\n

Options Chain

\n\n```python\ntd.get_options_chain(symbol='QQQ', # symbol of underlying security\n strike=None, # mention a specific strike\n from_date='01/01/2020', # only expirations after this date (mm/dd/yyyy)\n from_time=None,\n to_date='01/30/2020', # only expirations before this date\n to_time=None,\n expiry_month='ALL', # option expiry month ALL or JAN\n kind='OTM', # ITM, NTM, OTM, SAK (Strikes Above Market), ALL etc.\n include_quotes=False, # if FALSE only returns the option names (use get_current_quote() to get value)\n contract_type='CALL', # CALL, PUT\n strikes=5, # number of strikes above or below at-the-money price\n strategy='SINGLE',\n return_df=True # if False, returns a dictionary instead\n )\n```\n\n
\"Options
\n\n\n

Top Movers of an Index

\n\n```python\ntd.get_movers_for_index(symbol = 'DJI', # has to be an index DJI, SPX.X etc\n direction = None, # 'up' or 'down'. if None, returns both\n change = None # 'value' or 'percent'. if None, defaults to percentage\n )\n```\n\n
\"Top
\n\n\n

Support

\n\nPlease email me at ysriram@umich.edu if you have any questions, suggestions, or ideas for improvement. \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ysriram1/tdlink", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tdlink", "package_url": "https://pypi.org/project/tdlink/", "platform": "", "project_url": "https://pypi.org/project/tdlink/", "project_urls": { "Homepage": "https://github.com/ysriram1/tdlink" }, "release_url": "https://pypi.org/project/tdlink/0.3/", "requires_dist": null, "requires_python": "", "summary": "Python Library for TDAmeritrade API", "version": "0.3" }, "last_serial": 5479335, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "55000b1102dbd4ccce2a955ee69a910b", "sha256": "d10a574360ad7d00bb962dc6fe6c8d2b016d470ab67e0aa2adc2e9c76f5f4786" }, "downloads": -1, "filename": "tdlink-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "55000b1102dbd4ccce2a955ee69a910b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8058, "upload_time": "2019-07-03T03:37:55", "url": "https://files.pythonhosted.org/packages/9b/b6/ff47686b4324457f2c7473528e1bc0383521db797a08b399d82c9995cc6c/tdlink-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7a43d6e0045334275b60261afedc5a7", "sha256": "87489c926799078845559aad312ec0973f21fb25dfea91b11b70a1d3a4bca9e3" }, "downloads": -1, "filename": "tdlink-0.1.tar.gz", "has_sig": false, "md5_digest": "b7a43d6e0045334275b60261afedc5a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6163, "upload_time": "2019-07-03T03:37:57", "url": "https://files.pythonhosted.org/packages/44/23/bb8a0f189e5c059dbdbbd58326613d355964102f15a4703810581c8333e0/tdlink-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "06cffa7a79d89733ebe5ce724f696053", "sha256": "8580477f18a32fa85706ee64e25eadd4328a591ce3767bf48ebc50c0106a12dc" }, "downloads": -1, "filename": "tdlink-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "06cffa7a79d89733ebe5ce724f696053", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8549, "upload_time": "2019-07-03T03:52:41", "url": "https://files.pythonhosted.org/packages/67/3f/76217df4128f19eb752eae7ef6e8d90112ffdd4da32af3baa30d29d84ef2/tdlink-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de2ca70c38fabb9626584cc846f645b6", "sha256": "419704d22ea6537af8a967c27950646ae2f046358e9d1152b0c2f2db7e2dcd8a" }, "downloads": -1, "filename": "tdlink-0.2.tar.gz", "has_sig": false, "md5_digest": "de2ca70c38fabb9626584cc846f645b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7153, "upload_time": "2019-07-03T03:52:42", "url": "https://files.pythonhosted.org/packages/c7/18/a0561977926ab955cce6e37d41e0c9baefee8e19bc83973ceb246fe29856/tdlink-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "6acc5ba4ce79c184765324b3b6a5f289", "sha256": "578ae986f6f77ff6fad4858cd1463d050b3d0fdd3dc45f1b6fb2d885cc3e8a3c" }, "downloads": -1, "filename": "tdlink-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "6acc5ba4ce79c184765324b3b6a5f289", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8554, "upload_time": "2019-07-03T03:58:17", "url": "https://files.pythonhosted.org/packages/56/b3/5ef3e3cba8c8522af18cd0e47f43a33ea52bfa1f5d7cffa2e2658f9ceaa9/tdlink-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b52d13edab2ee6472bb532a6f2b3d543", "sha256": "588bd0194ec3139710deff6c802ed03d1ac9878ec3f7fc539eac34c2f5ea517a" }, "downloads": -1, "filename": "tdlink-0.3.tar.gz", "has_sig": false, "md5_digest": "b52d13edab2ee6472bb532a6f2b3d543", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7154, "upload_time": "2019-07-03T03:58:18", "url": "https://files.pythonhosted.org/packages/ca/2b/c7734cce9a255334a62663f2586e54aefb6f649102c90ea7ab87cad31337/tdlink-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6acc5ba4ce79c184765324b3b6a5f289", "sha256": "578ae986f6f77ff6fad4858cd1463d050b3d0fdd3dc45f1b6fb2d885cc3e8a3c" }, "downloads": -1, "filename": "tdlink-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "6acc5ba4ce79c184765324b3b6a5f289", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8554, "upload_time": "2019-07-03T03:58:17", "url": "https://files.pythonhosted.org/packages/56/b3/5ef3e3cba8c8522af18cd0e47f43a33ea52bfa1f5d7cffa2e2658f9ceaa9/tdlink-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b52d13edab2ee6472bb532a6f2b3d543", "sha256": "588bd0194ec3139710deff6c802ed03d1ac9878ec3f7fc539eac34c2f5ea517a" }, "downloads": -1, "filename": "tdlink-0.3.tar.gz", "has_sig": false, "md5_digest": "b52d13edab2ee6472bb532a6f2b3d543", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7154, "upload_time": "2019-07-03T03:58:18", "url": "https://files.pythonhosted.org/packages/ca/2b/c7734cce9a255334a62663f2586e54aefb6f649102c90ea7ab87cad31337/tdlink-0.3.tar.gz" } ] }