tradesmart — Python SDK for the TradeSmart API V2
TradeSmart's official Python client for the
TradeSmart API V2. Log in once a day, read your account,
find instruments, place and manage orders, and stream live prices and order updates, from plain
Python scripts or asyncio programs.
Version 2.0.0. Trading involves real money: read the Orders guide before sending anything that changes state.
What you get
- Two clients with the same methods:
TradeSmart(blocking) andAsyncTradeSmart(asyncio). - One-command daily login:
python -m tradesmart login; your scripts pick the token up withTradeSmart.from_env(), so no keys live in your code. - Orders: place, modify, cancel and exit; large orders sent in slices; GTT (good-till-triggered) orders. Orders are never retried automatically, and an unclear outcome is reported, not guessed.
- Market data: instrument search, the script master, quotes, candles, option chains, option Greeks.
- Live streaming: prices and order updates over a WebSocket that reconnects and resubscribes by itself.
- Typed results: Pydantic models, with prices as
Decimal. - Offline testing:
OfflineBrokerruns your strategy against a local fake broker, with no account or network.
New to TradeSmart? Start trading from code in three steps
- Open a TradeSmart account online. TradeSmart Fintech Securities Limited is a SEBI-registered stockbroker (NSE, BSE, MCX).
- Create your API app on the TradeSmart web platform's API Dashboard: self-service, with no API fee and no approval to wait for, for your own trading.
pip install tradesmart, log in with one command, and place your first order. The getting-started guide takes about 10 minutes.
Open your TradeSmart account → Already a client? Go straight to Get API access.
Install
Python 3.11 to 3.15:
pip install tradesmart
You also need a TradeSmart API app (free, self-service on the TradeSmart web platform's API
Dashboard): its App Key (shown as "App ID"), Secret Key, your Client ID, the Redirect URL
http://127.0.0.1:8080/callback and your static IP. Step by step:
Get API access.
Quick start
Log in once a day (the token is valid until 06:00 IST):
python -m tradesmart login
Then, in your script (illustrative):
from tradesmart import TradeSmart
with TradeSmart.from_env() as client: # uses the saved login
print(client.profile().user_id)
print(client.margins().cash)
New here? Follow Your first order in 10 minutes: API access, install, login, and a first order placed, checked, modified and cancelled.
User guide
| Page | What is in it |
|---|---|
| Getting started | API access, install, login, first call, first order |
| Authentication | The login command, the token file, from_env(), login in your own server |
| Orders | Every order call, validation, order status, finding an order after an unclear outcome |
| GTT orders | Good-till-triggered orders |
| Account and portfolio | Profile, funds, positions, holdings, trades |
| Market data | Search, script master, quotes, candles, option chains |
| Option Greeks and analytics | Implied volatility, Greeks, chain snapshots, put-call ratio, max pain |
| Streaming | Live prices and order updates |
| Testing your strategy offline | OfflineBroker: fills, rejections, lost replies, dropped streams |
| Configuration | Settings, rate limits, retries, logging |
| Troubleshooting | Error messages and what to do |
| Reference | Every method, model, enum, error and setting; known limitations |
Runnable scripts are in
examples/,
for example a strategy tested offline:
offline_strategy_test.py.
Switching from another broker
Guides for moving existing code: migration guides.
Support
- Bugs and questions: GitHub issues.
- Security issues: the security policy.
- Account and API access:
support@tradesmartonline.in. - Versions and deprecations: Versioning and support; changes: changelog.
- Contributing: CONTRIBUTING.md.
Risk notice
Investments in the securities market are subject to market risks; read all the related documents carefully before investing. Automated and API trading can place orders quickly: test your strategy offline first and start with small quantities.
Licence
Apache License 2.0, see LICENSE and NOTICE. Copyright (c) 2026 TradeSmart Fintech Securities Limited.
Metadata
Release files for tradesmart 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tradesmart-2.0.0.tar.gz | 175.8 kB | With provenance | Details for tradesmart-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tradesmart-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for tradesmart-2.0.0-py3-none-any.whl |
Total release size: 360.0 kB
Release files / tradesmart-2.0.0.tar.gz
| Download URL | tradesmart-2.0.0.tar.gz |
|---|---|
| Size | 175.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c2d694ddc65e9c17ba7e25dfd0280ccb6a5e1eff504a0856621fbab6926260b
|
|
BLAKE2b-256 checksum How to use checksums |
ac0aa5f744758019b91da8fdbb71b201596203f924d8cafaf7e5766e2a8ef36a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 15, 2026.
Transparency logRelease files / tradesmart-2.0.0-py3-none-any.whl
| Download URL | tradesmart-2.0.0-py3-none-any.whl |
|---|---|
| Size | 184.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
978e511343701b9de7b93e189210e25fc3e15cf631845c4d6da0d58e81e51d69
|
|
BLAKE2b-256 checksum How to use checksums |
1c7899d9e6b2ce4797a8792682b11d85609a49861e3911b8df2bca877fcf50a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 15, 2026.
Transparency logSecurity for tradesmart 2.0.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tradesmart-2.0.0.tar.gz
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 Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.