Skip to main content

An unofficial, sync/async SDK for Tradestation!

Project description

Docs PyPI Downloads Release)

tradestation

A simple, unofficial, sync/async SDK for Tradestation built on their public API. This will allow you to create trading algorithms for whatever strategies you may have quickly and painlessly in Python.

Features

  • Up to 10x less code than using the API directly
  • Sync/async functions for all endpoints
  • Powerful websocket implementation for account alerts and data streaming, with support for auto-reconnection and reconnection callbacks
  • 100% typed, with Pydantic models for all JSON responses from the API
  • 95%+ unit test coverage
  • Comprehensive documentation
  • Utility functions for timezone calculations, futures monthly expiration dates, and more

Installation

$ pip install tradestation

Initial setup

Tradestation uses OAuth for secure authentication to the API. In order to obtain access tokens, you need to authenticate with OAuth 2's authorization code flow, which requires a local HTTP server running to handle the callback. Fortunately, the SDK makes doing this easy:

from tradestation.oauth import login
login()

This will let you authenticate in your local browser. Fortunately, this only needs to be done once, as afterwards you can use the refresh token to obtain new access tokens indefinitely.

Creating a session

A session object is required to authenticate your requests to the Tradestation API. You can create a simulation session by passing is_test=True.

from tradestation import Session
session = Session('api_key', 'secret_key', 'refresh_token')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tradestation-0.2.tar.gz (66.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradestation-0.2-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file tradestation-0.2.tar.gz.

File metadata

  • Download URL: tradestation-0.2.tar.gz
  • Upload date:
  • Size: 66.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tradestation-0.2.tar.gz
Algorithm Hash digest
SHA256 d5e692ea9e4a0dfdc45c687ed7e6afd7a45c8b500e3ff17487ea8c42d9c66b7c
MD5 5b8d54b4f27ef79d5a181886160375cb
BLAKE2b-256 4b3bc17018516597640769085c221a3878ae9e8bdb50f63a3e61435f9ae70cba

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradestation-0.2.tar.gz:

Publisher: python-publish.yml on tastyware/tradestation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tradestation-0.2-py3-none-any.whl.

File metadata

  • Download URL: tradestation-0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tradestation-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 857374b772e50a7abf84ecadfa1f1c7f5b1e2698a44979f3ad3fff2f0d9fb08d
MD5 e41bac22ebe2cfac1e84b47b61cf6867
BLAKE2b-256 936629c4f33f813577ba88d3c63067ae26ea562fb9cd665dd4be42fbca44765b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradestation-0.2-py3-none-any.whl:

Publisher: python-publish.yml on tastyware/tradestation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page