Metadata-Version: 2.4
Name: infinn
Version: 0.1.2
Summary: Official-style Python SDK for the INFINN trading API (Sandbox / Live).
Author: HKKR Finserv (INFINN)
License: MIT
Project-URL: Documentation, https://docs.infinn.in/sdks/python/
Project-URL: Homepage, https://infinn.in
Keywords: infinn,trading,api,sandbox,noren
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28
Provides-Extra: ticker
Requires-Dist: websocket-client>=1.6; extra == "ticker"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: responses>=0.25; extra == "dev"

# infinn — INFINN Python SDK

Simple Python client for the INFINN trading API.

- Default environment is **Sandbox** (`env="sandbox"`, also accepts `"uat"`).
- Sandbox = UAT / Test — **NOT live**. No real money.
- Live needs `env="live"` and prints a clear warning.
- Secrets from env vars `INFINN_API_KEY` / `INFINN_API_SECRET` (never hard-code).
- Tokens are never logged.

## Install

```bash
pip install ./infinn-0.1.2-py3-none-any.whl
# or from source
pip install .
```

Optional live ticker: `pip install "infinn[ticker]"` (adds `websocket-client`).

## 5-line Sandbox quickstart

```python
from infinn import Infinn

api = Infinn(env="sandbox")                 # Sandbox (UAT / Test — NOT live)
print(api.login_url())                      # open in browser, login, copy full URL
api.generate_session(input("Paste full redirect URL: "))
print(api.limits())                         # read-only check
```

User ID is uppercased automatically. A full redirect URL or just the `code=` value both work.

## Coming from another broker?

Method names are deliberately simple (`place_order`, `orders`, `positions`, `ltp`, …).
This is an original INFINN library — not a fork of any other broker SDK.

## Sandbox tested (5 Nov 2026)

Read-only Sandbox checks passed: login, user_details, search, quote, ticker. Known: Sandbox `Limits` may hang/time out (server-side); the client uses a request timeout.

## Options helpers (0.1.2)

```python
chain = api.option_chain("NFO", "NIFTY26NOV26C26000", 26000, count=5)  # GetOptionChain -> list of contracts
info  = api.security_info("NFO", chain[0]["token"])                      # GetSecurityInfo -> lot size, tick size, expiry
```

Full example with stoploss and profit booking: `examples/straddle_strangle.py`
(educational example — not investment advice; DRY_RUN and Sandbox by default).

## Safety

- Rate-limits write calls below 10 orders/sec.
- Retries only safe read endpoints on network errors.
- Never commits secrets or tokens to source control.
- Do **not** publish this package to PyPI until INFINN releases it officially.

## Changelog

- 0.1.2 — `option_chain()` (GetOptionChain) and `security_info()` (GetSecurityInfo); Straddle / Strangle example.
- 0.1.1 — Sandbox default, request timeouts, ticker, TOTP helper.

## Licence

MIT — HKKR Finserv Pvt Ltd (INFINN).
