{"id":42963893,"url":"https://github.com/tastyware/tastytrade","last_synced_at":"2026-01-30T23:36:15.427Z","repository":{"id":40320649,"uuid":"491282691","full_name":"tastyware/tastytrade","owner":"tastyware","description":"An unofficial, sync/async Python SDK for Tastytrade!","archived":false,"fork":false,"pushed_at":"2025-12-18T20:54:57.000Z","size":952,"stargazers_count":203,"open_issues_count":4,"forks_count":70,"subscribers_count":31,"default_branch":"master","last_synced_at":"2026-01-14T12:12:58.711Z","etag":null,"topics":["asyncio","cli","options-trading","python","sdk","tastytrade","typed"],"latest_commit_sha":null,"homepage":"https://tastyworks-api.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tastyware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"tastyware","custom":["https://open.tastytrade.com/signup?referralCode=YYGKBEQ2EX"]}},"created_at":"2022-05-11T21:53:25.000Z","updated_at":"2026-01-04T23:22:57.000Z","dependencies_parsed_at":"2023-07-13T20:43:56.975Z","dependency_job_id":"3cf4476c-e81b-42c2-affe-b0c0df1d3c6a","html_url":"https://github.com/tastyware/tastytrade","commit_stats":null,"previous_names":["tastyware/tastyworks-api"],"tags_count":87,"template":false,"template_full_name":null,"purl":"pkg:github/tastyware/tastytrade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tastyware%2Ftastytrade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tastyware%2Ftastytrade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tastyware%2Ftastytrade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tastyware%2Ftastytrade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tastyware","download_url":"https://codeload.github.com/tastyware/tastytrade/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tastyware%2Ftastytrade/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28923320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T22:32:35.345Z","status":"ssl_error","status_checked_at":"2026-01-30T22:32:31.927Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","cli","options-trading","python","sdk","tastytrade","typed"],"created_at":"2026-01-30T23:36:14.805Z","updated_at":"2026-01-30T23:36:15.422Z","avatar_url":"https://github.com/tastyware.png","language":"Python","funding_links":["https://github.com/sponsors/tastyware","https://open.tastytrade.com/signup?referralCode=YYGKBEQ2EX"],"categories":[],"sub_categories":[],"readme":"[![Docs](https://readthedocs.org/projects/tastyworks-api/badge/?version=latest)](https://tastyworks-api.readthedocs.io/en/latest/?badge=latest)\n[![PyPI](https://img.shields.io/pypi/v/tastytrade)](https://pypi.org/project/tastytrade)\n[![Downloads](https://static.pepy.tech/badge/tastytrade)](https://pepy.tech/project/tastytrade)\n[![Release)](https://img.shields.io/github/v/release/tastyware/tastytrade?label=release%20notes)](https://github.com/tastyware/tastytrade/releases)\n\n# Tastytrade Python SDK\n\nA simple, reverse-engineered SDK for Tastytrade built on their (now mostly public) API. This will allow you to create trading algorithms for whatever strategies you may have quickly and painlessly in Python.\n\n## Features\n\n- Up to 10x less code than using the API directly\n- Sync/async functions for all endpoints\n- Powerful websocket implementation for account alerts and data streaming, with support for auto-reconnection and reconnection callbacks\n- 100% typed, with Pydantic models for all JSON responses from the API\n- 95%+ unit test coverage\n- Comprehensive documentation\n- Utility functions for timezone calculations, futures monthly expiration dates, and more\n\n\u003e [!TIP]\n\u003e Want to see the SDK in action? Check out [tastytrade-cli](https://github.com/tastyware/tastytrade-cli), a CLI for Tastytrade that showcases many of the SDK's features.\n\n\u003e [!NOTE]\n\u003e Want to build an advanced trading system? Check out [streaQ](https://github.com/tastyware/streaq), an async job queuing library for Python that's perfect for complex applications!\n\n## Installation\n\n```console\n$ pip install tastytrade\n```\n\n## Creating a session\n\nA session object is required to authenticate your requests to the Tastytrade API. See [here](https://tastyworks-api.readthedocs.io/en/latest/sessions.html) for information on how to set up an OAuth application.\n\n```python\nfrom tastytrade import Session\nsession = Session('client_secret', 'refresh_token')\n```\n\n## Using the streamer\n\nThe streamer is a websocket connection to dxfeed (the Tastytrade data provider) that allows you to subscribe to real-time data for quotes, greeks, and more.\n\n```python\nfrom tastytrade import DXLinkStreamer\nfrom tastytrade.dxfeed import Quote\n\nasync with DXLinkStreamer(session) as streamer:\n    subs_list = ['SPY']  # list of symbols to subscribe to\n    await streamer.subscribe(Quote, subs_list)\n    # this example fetches quotes once, then exits\n    quote = await streamer.get_event(Quote)\n    print(quote)\n```\n\n```python\n\u003e\u003e\u003e Quote(event_symbol='SPY', event_time=0, sequence=0, time_nano_part=0, bid_time=0, bid_exchange_code='Q', bid_price=411.58, bid_size=400.0, ask_time=0, ask_exchange_code='Q', ask_price=411.6, ask_size=1313.0)\n```\n\nNote that this is asynchronous code, so you can't run it as is unless you're using a Jupyter notebook or something similar.\n\n## Getting current positions\n\n```python\nfrom tastytrade import Account\n\naccount = Account.get(session)[0]\npositions = account.get_positions(session)\nprint(positions[0])\n```\n\n```python\n\u003e\u003e\u003e CurrentPosition(account_number='5WX01234', symbol='IAU', instrument_type=\u003cInstrumentType.EQUITY: 'Equity'\u003e, underlying_symbol='IAU', quantity=Decimal('20'), quantity_direction='Long', close_price=Decimal('37.09'), average_open_price=Decimal('37.51'), average_yearly_market_close_price=Decimal('37.51'), average_daily_market_close_price=Decimal('37.51'), multiplier=1, cost_effect=\u003cPriceEffect.CREDIT: 'Credit'\u003e, is_suppressed=False, is_frozen=False, realized_day_gain=Decimal('7.888'), realized_day_gain_date=datetime.date(2023, 5, 19), realized_today=Decimal('-0.512'), realized_today_date=datetime.date(2023, 5, 19), created_at=datetime.datetime(2023, 3, 31, 14, 38, 32, 58000, tzinfo=datetime.timezone.utc), updated_at=datetime.datetime(2023, 5, 19, 16, 56, 51, 920000, tzinfo=datetime.timezone.utc), mark=None, mark_price=None, restricted_quantity=Decimal('0'), expires_at=None, fixing_price=None, deliverable_type=None)\n```\n\n## Sync/async wrappers\n\nThe code from above can be rewritten asynchronously:\n\n```python\nfrom tastytrade import Account\n\naccount = (await Account.a_get(session))[0]\npositions = await account.a_get_positions(session)\nprint(positions[0])\n```\n\n## Placing an order\n\n```python\nfrom decimal import Decimal\nfrom tastytrade import Account\nfrom tastytrade.instruments import Equity\nfrom tastytrade.order import NewOrder, OrderAction, OrderTimeInForce, OrderType\n\naccount = Account.get(session, '5WX01234')\nsymbol = Equity.get(session, 'USO')\nleg = symbol.build_leg(Decimal('5'), OrderAction.BUY_TO_OPEN)  # buy to open 5 shares\n\norder = NewOrder(\n    time_in_force=OrderTimeInForce.DAY,\n    order_type=OrderType.LIMIT,\n    legs=[leg],  # you can have multiple legs in an order\n    price=Decimal('-10')  # limit price, $10/share debit for a total value of $50\n)\nresponse = account.place_order(session, order, dry_run=True)  # a test order\nprint(response)\n```\n\n```python\n\u003e\u003e\u003e PlacedOrderResponse(buying_power_effect=BuyingPowerEffect(change_in_margin_requirement=Decimal('-125.0'), change_in_buying_power=Decimal('-125.004'), current_buying_power=Decimal('1000.0'), new_buying_power=Decimal('874.996'), isolated_order_margin_requirement=Decimal('-125.0'), is_spread=False, impact=Decimal('125.004'), effect=\u003cPriceEffect.DEBIT: 'Debit'\u003e), fee_calculation=FeeCalculation(regulatory_fees=Decimal('0.0'), clearing_fees=Decimal('-0.004'), commission=Decimal('0.0'), proprietary_index_option_fees=Decimal('0.0'), total_fees=Decimal('-0.004'), order=PlacedOrder(account_number='5WV69754', time_in_force=\u003cOrderTimeInForce.DAY: 'Day'\u003e, order_type=\u003cOrderType.LIMIT: 'Limit'\u003e, size='5', underlying_symbol='USO', underlying_instrument_type=\u003cInstrumentType.EQUITY: 'Equity'\u003e, status=\u003cOrderStatus.RECEIVED: 'Received'\u003e, cancellable=True, editable=True, edited=False, updated_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), legs=[Leg(instrument_type=\u003cInstrumentType.EQUITY: 'Equity'\u003e, symbol='USO', action=\u003cOrderAction.BUY_TO_OPEN: 'Buy to Open'\u003e, quantity=Decimal('5'), remaining_quantity=Decimal('5'), fills=[])], id=None, price=Decimal('-10.0'), gtc_date=None, value=None, stop_trigger=None, contingent_status=None, confirmation_status=None, cancelled_at=None, cancel_user_id=None, cancel_username=None, replacing_order_id=None, replaces_order_id=None, in_flight_at=None, live_at=None, received_at=None, reject_reason=None, user_id=None, username=None, terminal_at=None, complex_order_id=None, complex_order_tag=None, preflight_id=None, order_rule=None), complex_order=None, warnings=[Message(code='tif_next_valid_sesssion', message='Your order will begin working during next valid session.', preflight_id=None)], errors=None)\n```\n\n## Options chain/streaming greeks\n\n```python\nfrom tastytrade import DXLinkStreamer\nfrom tastytrade.dxfeed import Greeks\nfrom tastytrade.instruments import get_option_chain\nfrom tastytrade.utils import get_tasty_monthly\n\nchain = get_option_chain(session, 'SPLG')\nexp = get_tasty_monthly()  # 45 DTE expiration!\nsubs_list = [chain[exp][0].streamer_symbol]\n\nasync with DXLinkStreamer(session) as streamer:\n    await streamer.subscribe(Greeks, subs_list)\n    greeks = await streamer.get_event(Greeks)\n    print(greeks)\n```\n\n```python\n\u003e\u003e\u003e [Greeks(event_symbol='.SPLG230616C23', event_time=0, event_flags=0, index=7235129486797176832, time=1684559855338, sequence=0, price=26.3380972233688, volatility=0.396983376650804, delta=0.999999999996191, gamma=4.81989763184255e-12, theta=-2.5212017514875e-12, rho=0.01834504287973133, vega=3.7003015672215e-12)]\n```\n\nFor more examples, check out the [documentation](https://tastyworks-api.readthedocs.io/en/latest/).\n\n## Disclaimer\n\nThis is an unofficial SDK for Tastytrade. There is no implied warranty for any actions and results which arise from using it.\n\n![Alt](https://repobeats.axiom.co/api/embed/292b0cb5dd25a26e9abc6e5f8d8e180461d9faf8.svg \"Repobeats analytics image\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftastyware%2Ftastytrade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftastyware%2Ftastytrade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftastyware%2Ftastytrade/lists"}