A small, Sandbox-first Python client for the INFINN API. Beginners can log in in a few lines.
The SDK defaults to env="sandbox" (alias "uat"). Hosts stay on uat.infinn.in. Live needs env="live" and prints a warning.
On this page
Install
Not on PyPI yet. Install the wheel bundled with these docs:
pip install ./infinn-0.1.2-py3-none-any.whl "websocket-client>=1.6"
# optional live ticker support, if you did not install websocket-client above
pip install "infinn[ticker]"pip install infinn is not on PyPI yet. Or from the source tree: pip install . inside downloads/sdk/infinn_sdk_src/. Older 0.1.1 files stay in that folder for history only. Use 0.1.2.
5-line Sandbox quickstart
from infinn import Infinn
api = Infinn(env="sandbox") # Sandbox (UAT / Test — NOT live)
print(api.login_url()) # open in browser; login with UPPERCASE user ID + password + TOTP
api.generate_session(input("Paste full redirect URL: "))
print(api.limits()) # read-only checkSet INFINN_API_KEY and INFINN_API_SECRET in your environment before running. The SDK uppercases the user ID, pulls code= out of a full redirect URL, and builds checksum = sha256(api_key + secret + code) for you.
Read-only Sandbox checks passed: login / generate_session, user_details, search_instrument, quote, WebSocket ticker. Package infinn 0.1.1. No orders were placed.
On Sandbox (uat.infinn.in), Limits sometimes hangs with a read timeout. Other reads (UserDetails, SearchScrip, GetQuotes) and the ticker work. The SDK uses a connect/read request timeout so your script does not freeze forever. Retry later, or skip Limits while testing on Sandbox.
Beginner test steps (Sandbox)
- Install the 0.1.2 wheel from downloads/sdk/.
- Set
INFINN_API_KEYandINFINN_API_SECRET. - Run the 5-line quickstart above with
env="sandbox". - Open the login URL, sign in with an UPPERCASE user ID, password and TOTP, then paste the full redirect URL.
- Call
user_details(),search_instrument(...),quote(...). Optional:api.ticker()for a few seconds. - Do not place orders on Sandbox until you are ready. Prefer Live only after Sandbox checks pass.
Method table
| Method | What it does | API endpoint |
|---|---|---|
login_url() | Browser login link | OAuth page |
generate_session(url_or_code) | Exchange code for token | GenAcsTok |
set_session / load_session / save_session | Reuse a plain JSON session | — |
user_details() | Account profile | UserDetails |
limits() | Cash / margin | Limits |
search_instrument(text) | Find symbols | SearchScrip |
quote / ltp | Snapshot price | GetQuotes |
option_chain(exch, tsym, strike, count) | Option contracts around a strike (0.1.2) | GetOptionChain |
security_info(exch, token) | Lot size, tick size, expiry (0.1.2) | GetSecurityInfo |
place_order / modify_order / cancel_order | Orders | PlaceOrder / ModifyOrder / CancelOrder |
orders() / trades() | Books | OrderBook / TradeBook |
positions() / holdings() | Portfolio | PositionBook / Holdings |
ticker() | WebSocket callbacks | NorenWSTP |
totp(secret) | RFC 6238 helper | — |
option_chain and security_info
New in 0.1.2. option_chain(exchange, tradingsymbol, strike, count) returns option contracts around a strike (GetOptionChain). security_info(exchange, token) returns lot size, tick size and expiry (GetSecurityInfo). The Straddle / Strangle example uses both.
Examples
- Example: Straddle / Strangle — the tested program, Sandbox and dry run by default.
- Strategy Builder — a form that fills the settings in that same program. It does not turn on
--confirm-live.
Coming from Zerodha Kite?
This is an original INFINN library — not a fork, and not Zerodha-branded. Method names are intentionally familiar so porting is easy:
| Familiar name | INFINN SDK | Notes |
|---|---|---|
login_url | login_url() | Sandbox uses your app key as route_to |
generate_session(request_token) | generate_session(url_or_code) | Accepts full redirect URL |
place_order(...) | place_order(...) | Maps BUY/SELL, MARKET/LIMIT to Noren fields |
orders / positions / holdings | same | |
ltp / quote | same | Uses GetQuotes |
KiteTicker | Ticker via api.ticker() | Optional websocket-client |
Safety notes
- Default env is Sandbox (UAT / Test — NOT live).
- Secrets only from
INFINN_API_KEY/INFINN_API_SECRET. - Tokens are never written to logs;
repr()masks them. - Local write rate-limit stays under 10 orders/sec.
- Network retries only on read endpoints.
- The tick-recorder’s encrypted
token.json(binaryIA2T) is not loadable — usesave_session()/load_session()plain JSON. - Do not place live orders until you have tested on Sandbox.
Downloads
- infinn-0.1.2-py3-none-any.whl — install this one
- infinn-0.1.2.tar.gz — source archive
- Source tree
- Python SDK downloads — file list and install steps
0.1.1 files are in the same folder for history only. Use 0.1.2.
Version: infinn 0.1.2.