Metadata-Version: 2.4
Name: sysstra-data
Version: 0.1.0
Summary: Lightweight, generalized market data client for the Sysstra trading platform.
Author-email: Sysstra Team <dev@sysstra.com>
License: MIT
Keywords: trading,market-data,finance,crypto,options,sysstra
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Provides-Extra: pandas
Requires-Dist: pandas>=2.0.0; extra == "pandas"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: uvicorn>=0.20.0; extra == "dev"
Requires-Dist: fastapi>=0.90.0; extra == "dev"
Requires-Dist: fastmcp>=0.1.0; extra == "dev"
Dynamic: license-file

# sysstra-data

Lightweight, generalized market data client for the Sysstra trading platform. Wraps
[sysstra-data-services](https://gitlab.com/sysstra_tech/sysstra-data-services) with a
typed, domain-namespaced Python interface.

## Install

```bash
pip install sysstra-data
```

## Quickstart

```python
from sysstra_data import SysstraData

client = SysstraData(api_key="sk-...")

# Equities
eod = client.equities.eod("SBIN", "2025-01-01", "2025-06-30", exchange="XNSE")
intraday = client.equities.candles("SBIN", "2025-01-01", "2025-01-02", interval=5)

# Futures & Options
futures = client.futures.candles("NIFTY", "2025-01-01", "2025-01-31")
options = client.options.candles("BANKNIFTY", "2025-01-01", "2025-01-31",
                                 option_type="CE", strike=48000)
chain = client.options.chain("BANKNIFTY", date="2025-01-15")

# Crypto & Forex
btc = client.crypto.candles("BTCUSDT", "2025-01-01", "2025-01-02", interval="1h")
eurusd = client.forex.candles("EURUSD", "2025-01-01", "2025-01-02", interval="1h")

# Reference data
exchanges = client.market.exchanges(market="IN")
symbols = client.market.symbols(exchange="XNSE", query="RELIANCE")

# Fundamentals
fii_dii = client.fundamentals.fii_dii("2025-01-01", "2025-01-31")

# Account (your own key/credits only)
me = client.account.me()
keys = client.account.list_keys()
```

A process-wide default client is also available for scripts that only need one:

```python
import sysstra_data as sd

sd.set_api_key("sk-...")
candles = sd.equities.eod("SBIN", "2025-01-01", "2025-06-30")
```

## Error handling

Every non-2xx response raises a specific exception, all subclassing `SysstraDataError`:

| Exception | Meaning |
|---|---|
| `SysstraAuthError` | Missing/invalid API key, or insufficient privilege |
| `SysstraValidationError` | Bad request shape |
| `SysstraSymbolNotFoundError` | Symbol doesn't exist |
| `SysstraAmbiguousSymbolError` | Symbol resolves to multiple exchanges — `.candidates` lists them |
| `SysstraInsufficientCreditsError` | Account is out of API credits |
| `SysstraServiceUnavailableError` | Backend reference/warehouse store unreachable |
| `SysstraConnectionError` | Network-level failure (timeout, DNS, SSL) |
| `SysstraAPIError` | Any other non-2xx response — carries `.status_code` |

## Not yet implemented server-side

A few methods exist on the client for API symmetry but raise `NotImplementedError`
until `sysstra-data-services` grows the matching route: `options.greeks()`,
`equities.announcements()`, `equities.fundamentals()`,
`fundamentals.earnings_calendar()`, `fundamentals.earnings_transcript()`.

## Development

```bash
pip install -e ".[dev]"
pytest tests/ --ignore=tests/test_uat_integration.py
```

`tests/test_uat_integration.py` boots a real `sysstra-data-services` instance
in-process and needs that package importable plus a provisioned test API key.

## License

MIT
