Metadata-Version: 2.4
Name: trading-static-ip
Version: 0.2.0
Summary: Official Python SDK for routing verified broker API traffic through a ServLoci dedicated IPv6.
Author: ServLoci
License-Expression: MIT
Project-URL: Homepage, https://comm.servloci.in
Project-URL: Docs, https://comm.servloci.in/docs
Project-URL: Package, https://pypi.org/project/trading-static-ip/
Keywords: servloci,trading,broker-api,socks5,proxy,ipv6,dhan,kite,zerodha,groww,fyers
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: Proxy Servers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Provides-Extra: socks
Requires-Dist: requests[socks]>=2.28; extra == "socks"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# trading-static-ip

Official Python SDK for sending verified broker order and trade API requests
through your dedicated ServLoci IPv6.

## Install

```bash
pip install trading-static-ip
```

The PyPI distribution is named `trading-static-ip`; the Python import remains
`servloci` so existing code stays compatible.

## One-token quickstart

Generate an access token in the ServLoci portal, verify the broker once, then:

```python
from servloci import Client

client = Client(token="sl_live_...", broker="dhan")

response = client.get(
    "/v2/orders",
    headers={
        "access-token": "YOUR_DHAN_ACCESS_TOKEN",
        "client-id": "YOUR_DHAN_CLIENT_ID",
    },
)
response.raise_for_status()
print(response.json())
```

The SDK adds `X-ServLoci-Token` and `X-ServLoci-Broker`. ServLoci confirms
that the selected broker was verified under your account, forwards only the
allowed order/trade path to that broker's official origin, and sends the
request from your assigned IPv6. Your broker authorization headers pass
through and are not stored.

Environment-variable setup is equally small:

```bash
export SERVLOCI_TOKEN='sl_live_...'
export SERVLOCI_BROKER='dhan'
```

```python
from servloci import Client

client = Client.from_env()
response = client.post("/v2/orders", headers={...}, json={...})
```

Supported fixed-origin HTTP routes: Dhan, Kite (Zerodha), Groww, FYERS,
Upstox, and ICICI Direct. Kotak Neo uses a per-session dynamic origin and
therefore remains available through SOCKS5 only.

## Existing broker SDKs / SOCKS5

The original helper remains backwards compatible:

```bash
pip install 'trading-static-ip[socks]'
```

```python
import servloci

servloci.configure(
    api_key="dhan:1000000001",
    api_secret="YOUR_SOCKS_PASSWORD",
)

# Import the broker SDK only after configure().
from dhanhq import dhanhq
```

Use the HTTP `Client` for the easiest setup. Use SOCKS5 when the broker's
official SDK must control the complete URL or its API origin is dynamic.

## Security

- Treat `sl_live_...` as a password; never commit or log it.
- Access tokens are displayed once, stored server-side only as SHA-256 hashes,
  and can be rotated or revoked in the portal.
- Only broker-native paths beginning with `/` are accepted by the SDK.
- ServLoci restricts the application forwarder to documented order/trade paths.
