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')
Metadata
Release files for tradestation 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tradestation-0.2.tar.gz | 66.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tradestation-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.2 kB
Release files / tradestation-0.2.tar.gz
| Download URL | tradestation-0.2.tar.gz |
|---|---|
| Size | 66.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5e692ea9e4a0dfdc45c687ed7e6afd7a45c8b500e3ff17487ea8c42d9c66b7c
|
|
BLAKE2b-256 checksum How to use checksums |
4b3bc17018516597640769085c221a3878ae9e8bdb50f63a3e61435f9ae70cba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2025.
Transparency logRelease files / tradestation-0.2-py3-none-any.whl
| Download URL | tradestation-0.2-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
857374b772e50a7abf84ecadfa1f1c7f5b1e2698a44979f3ad3fff2f0d9fb08d
|
|
BLAKE2b-256 checksum How to use checksums |
936629c4f33f813577ba88d3c63067ae26ea562fb9cd665dd4be42fbca44765b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2025.
Transparency log