This folder contains ready-to-use Python samples for the Upstox API. Each example shows how to call the API using the official Upstox Python SDK (upstox_client).
PlaceOrderRequest, historical data params, and other API payloads.Use these samples to build trading apps, dashboards, or integrations without guessing request shapes or SDK usage.
pip install upstox-python-sdkFor full setup, sandbox mode, and auth flow, see the main Upstox Python SDK README in the repo root.
Samples are grouped by API area. Each .md file contains one or more Python snippets you can run after replacing placeholders like {your_access_token} and {your_client_id}.
| Folder | Description |
|---|---|
| login/ | Authentication: get token from auth code, access-token request, logout. |
| user/ | User profile, fund and margin details. |
| orders/ | Order lifecycle: place (single/multi, v2 & v3), modify, cancel, order book, order details, order history, trades, historical trades, exit all positions. |
| portfolio/ | Positions, holdings, MTF positions, convert positions. |
| market-quote/ | LTP, full market quotes, OHLC (v2 & v3), option Greeks. |
| historical-data/ | Historical and intraday candle data (v2 & v3). |
| option-chain/ | Option contracts, put-call option chain. |
| expired-instruments/ | Expiries, expired future/option contracts, expired historical candle data. |
| market-information/ | Exchange status, market timings, market holidays. |
| gtt-orders/ | Place, modify, cancel, and get details for GTT (Good Till Triggered) orders. |
| margins/ | Margin details. |
| charges/ | Brokerage details. |
| trade-profit-and-loss/ | P&L report, report metadata, trade charges. |