Metadata-Version: 2.4
Name: insight-proxy-client
Version: 0.0.1
Summary: Python client for insight_proxy with Insight 6.1.2 compatible data APIs
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
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pandas<3,>=1.5
Requires-Dist: numpy<3,>=1.23

# insight-proxy-client

Python client for the **insight_proxy** TCP service. Data APIs target **Insight 6.1.2**;
the import namespace is `insight_proxy.com.insight`.
This is an independent adapter, not the official Insight SDK.

## Installation

```shell
python -m pip install insight-proxy-client==0.0.1
```

Supports Python 3.9–3.12. pandas and NumPy are installed as dependencies.
The client does not require the vendor SDK or native DLLs. A separately deployed
insight_proxy server with Insight 6.1.2 and valid data access is required.
This package does not include the server executable or account credentials.

## Quick start

```python
from datetime import datetime
from insight_proxy.com.insight import Client
from insight_proxy.com.insight.market_service import market_service

class Market(market_service):
    def on_subscribe_tick(self, result):
        print(result)

    def on_query_response(self, result):
        print(result)

# Both Client() and Client(Market()) are supported.
# Defaults: host="127.0.0.1", port=8765, token="123456".
# The token must match the server configuration.
with Client(Market()) as client:
    frame = client.query.get_kline(
        "601688.SH",
        [datetime(2026, 10, 19), datetime(2026, 10, 26, 23, 59, 59)],
        frequency="daily", fq="none",
    )
    print(frame)
    client.subscribe.subscribe_tick_by_id(["601688.SH"], mode="coverage")
    input("Press Enter to close the subscription session.\n")
```

Construction does not open a connection. Use `client.connect()` / `client.close()`
or a `with` block. Override connection settings using keyword arguments:
`Client(Market(), host="127.0.0.1", port=8765, token="your-server-token")`.
Example dates are fixed historical values; select dates and instruments available
to your server account.

## Migrating SDK data calls

Replace `insight_python.com.insight` imports with `insight_proxy.com.insight`.
Replace SDK login and initialization with the proxy connection:

```python
from insight_proxy.com.insight import connect, close, query, subscribe, playback

connect()  # or connect(Market(), host="...", port=8765, token="...")
try:
    result = query.get_kline()  # retains the SDK's missing-argument response
finally:
    close()
```

The compatibility layer exposes 80 query functions, 11 data subscription functions,
local `subscribe.sync()`, two playback functions and the `market_service` callbacks.
It preserves Insight 6.1.2 data function signatures, DataFrame/Series values,
column ordering, indexes, dtypes, datetime values, tuples and callback names.
SDK login/logging helpers and native gateway types are outside this client API.
One compatibility session exclusively owns the server's native SDK login.
Native SDK permissions and availability still determine which requests succeed.

Do not install the older combined `insight_proxy` distribution alongside this
client package in the same environment: they provide the same import namespace.
