Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-api

An unofficial wrapper for the TradeStation API.

  • 0.2.3
  • PyPI
  • Socket score

Maintainers
1


ts-api

PyPI - Downloads

An unofficial Python wrapper for the TradeStation API.

DescriptionInstallationUsageFeaturesContributingCreditsLicense

Description

ts-api is an unofficial wrapper for the TradeStation API. It aims to be as light and unopinionated as possible, offering an elegant programmatic interface over each endpoint. Notable functionality includes:

  • Login and authentication
  • MarketData, Brokerage, and Order Execution endpoints
  • Options chains
  • Trades and trade management
  • Account info and preferences

ts-api is very much a work in progress and is currently not feature complete. See the Issues to make a suggestion.

In-flight features include:

  • Streaming Client endpoints
  • Helpers for complicated dictionary request endpoints

Why ts-api?

ts-api has two core goals:

  1. Simplify the OAuth authentication procedure. This includes initial registration, refresh tokens, and automatic re-authorization of access tokens
  2. Be as lightweight as possible. ts-api takes in the base datatypes and returns the raw responses. No heavy logic or validation. Optional assistance with building orders and complex order groups is in the roadmap for this rather complex task.

Installation

# Install ts-api
pip install ts-api

Usage

# Import the TradeStation auth package
import ts.auth as a

# Establish your client
client = a.easy_client("key", "secret", "redirect")

# Call your endpoint
account = client.user_accounts("user_id")

Features

Currently ts-api supports all non-streaming routes found in the TradeStation API Specification. Details for each route can be found below.

Documentation for Supported API Endpoints

All URIs are relative to https://api.tradestation.com

ClassMethodHTTP requestDescription
BrokerageApiget_accountsGET /v3/brokerage/accountsGet Accounts
BrokerageApiget_balancesGET /v3/brokerage/accounts/{accounts}/balancesGet Balances
BrokerageApiget_balances_bodGET /v3/brokerage/accounts/{accounts}/bodbalancesGet Balances BOD
BrokerageApiget_historical_ordersGET /v3/brokerage/accounts/{accounts}/historicalordersGet Historical Orders
BrokerageApiget_ordersGET /v3/brokerage/accounts/{accounts}/ordersGet Orders
BrokerageApiget_positionsGET /v3/brokerage/accounts/{accounts}/positionsGet Positions
BrokerageApiget_walletsGET /v3/brokerage/accounts/{account}/walletsGet Wallets
MarketDataApiget_barsGET /v3/marketdata/barcharts/{symbol}Get Bars
MarketDataApiget_crypto_symbol_namesGET /v3/marketdata/symbollists/cryptopairs/symbolnamesGet Crypto Symbol Names
MarketDataApiget_option_expirationsGET /v3/marketdata/options/expirations/{underlying}Get Option Expirations
MarketDataApiget_option_risk_rewardPOST /v3/marketdata/options/riskrewardGet Option Risk Reward
MarketDataApiget_option_spread_typesGET /v3/marketdata/options/spreadtypesGet Option Spread Types
MarketDataApiget_option_strikesGET /v3/marketdata/options/strikes/{underlying}Get Option Strikes
MarketDataApiget_quote_snapshotsGET /v3/marketdata/quotes/{symbols}Get Quote Snapshots
MarketDataApiget_symbol_detailsGET /v3/marketdata/symbols/{symbols}Get Symbol Details
OrderExecutionApicancel_orderDELETE /v3/orderexecution/orders/{orderID}Cancel Order
OrderExecutionApiconfirm_group_orderPOST /v3/orderexecution/ordergroupconfirmConfirm Group Order
OrderExecutionApiconfirm_orderPOST /v3/orderexecution/orderconfirmConfirm Order
OrderExecutionApiget_activation_triggersGET /v3/orderexecution/activationtriggersGet Activation Triggers
OrderExecutionApiplace_group_orderPOST /v3/orderexecution/ordergroupsPlace Group Order
OrderExecutionApiplace_orderPOST /v3/orderexecution/ordersPlace Order
OrderExecutionApireplace_orderPUT /v3/orderexecution/orders/{orderID}Replace Order
OrderExecutionApiroutesGET /v3/orderexecution/routesGet Routes

Not-yet Supported API Endpoints

All URIs are relative to https://api.tradestation.com

ClassMethodHTTP requestDescription
BrokerageApistream_ordersGET /v3/brokerage/stream/accounts/{accountIds}/ordersStream Orders
BrokerageApistream_orders_by_order_idGET /v3/brokerage/stream/accounts/{accountIds}/orders/{ordersIds}Stream Orders by Order Id
BrokerageApistream_positionsGET /v3/brokerage/stream/accounts/{accountIds}/positionsStream Positions
BrokerageApistream_walletsGET /v3/brokerage/stream/accounts/{account}/walletsStream Wallets
MarketDataApiget_option_chainGET /v3/marketdata/stream/options/chains/{underlying}Stream Option Chain
MarketDataApiget_option_quotesGET /v3/marketdata/stream/options/quotesStream Option Quotes
MarketDataApistream_barsGET /v3/marketdata/stream/barcharts/{symbol}Stream Bars
MarketDataApistream_market_depth_aggregatesGET /v3/marketdata/stream/marketdepth/aggregates/{symbol}Stream Market Depth Aggregates
MarketDataApistream_market_depth_quotesGET /v3/marketdata/stream/marketdepth/quotes/{symbol}Stream Market Depth Quotes
MarketdataApisearch_symbolsGET /v2/data/symbols/search/{criteria}Search for Symbols
MarketdataApisuggestsymbolsGET /v2/data/symbols/suggest/{text}Suggest Symbols
MarketDataApiget_quote_change_streamGET /v3/marketdata/stream/quotes/{symbols}Stream Quotes

Contributing

Start contributing right now

Open an issue

If you've found a problem, you can open an issue!

Solve an issue

If you have a solution to one of the open issues, you will need to fork the repository and submit a pull request.

Credits

Big thanks to the great people on Discord. You know who you are.

License

MIT License


GitHub @pattertj

Keywords

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc