zenith-trade-client 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zenith_trade_client-0.1.0/LICENSE +0 -0
- zenith_trade_client-0.1.0/PKG-INFO +23 -0
- zenith_trade_client-0.1.0/README.md +8 -0
- zenith_trade_client-0.1.0/pyproject.toml +22 -0
- zenith_trade_client-0.1.0/setup.cfg +4 -0
- zenith_trade_client-0.1.0/zenith_trade_client/__init__.py +4 -0
- zenith_trade_client-0.1.0/zenith_trade_client/client.py +67 -0
- zenith_trade_client-0.1.0/zenith_trade_client/exceptions.py +3 -0
- zenith_trade_client-0.1.0/zenith_trade_client/models.py +12 -0
- zenith_trade_client-0.1.0/zenith_trade_client.egg-info/PKG-INFO +23 -0
- zenith_trade_client-0.1.0/zenith_trade_client.egg-info/SOURCES.txt +12 -0
- zenith_trade_client-0.1.0/zenith_trade_client.egg-info/dependency_links.txt +1 -0
- zenith_trade_client-0.1.0/zenith_trade_client.egg-info/requires.txt +2 -0
- zenith_trade_client-0.1.0/zenith_trade_client.egg-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zenith-trade-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for accessing Zenith-Trade FastAPI backend
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/zenith-trade-client
|
|
8
|
+
Project-URL: Issues, https://github.com/yourusername/zenith-trade-client/issues
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: requests>=2.31.0
|
|
13
|
+
Requires-Dist: pydantic>=1.10
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# Zenith Trade Client
|
|
17
|
+
|
|
18
|
+
A simple Python client to interact with the **Zenith-Trade FastAPI backend**.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install zenith-trade-client
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "zenith-trade-client"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for accessing Zenith-Trade FastAPI backend"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name="Your Name", email="your.email@example.com" }
|
|
11
|
+
]
|
|
12
|
+
license = { text = "MIT" }
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"requests>=2.31.0",
|
|
17
|
+
"pydantic>=1.10"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
Homepage = "https://github.com/yourusername/zenith-trade-client"
|
|
22
|
+
Issues = "https://github.com/yourusername/zenith-trade-client/issues"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from typing import List, Dict, Any, Optional
|
|
3
|
+
|
|
4
|
+
class ZenithTradeClient:
|
|
5
|
+
def __init__(self, mode: str = None, tailscale_host: str = "teesta", port: int = 8000):
|
|
6
|
+
"""
|
|
7
|
+
Python client for Zenith-Trade backend.
|
|
8
|
+
:param base_url: URL where FastAPI service is hosted
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
if mode is None or mode == "localhost":
|
|
12
|
+
base_url = f"http://localhost:{port}"
|
|
13
|
+
else:
|
|
14
|
+
base_url = f"http://{tailscale_host}:{port}"
|
|
15
|
+
|
|
16
|
+
self.base_url = base_url.rstrip("/")
|
|
17
|
+
|
|
18
|
+
# -------------------------------
|
|
19
|
+
# Exchange APIs
|
|
20
|
+
# -------------------------------
|
|
21
|
+
def list_exchanges(self) -> Dict[str, Any]:
|
|
22
|
+
"""Get all available exchanges with metadata."""
|
|
23
|
+
url = f"{self.base_url}/exchnages"
|
|
24
|
+
resp = requests.get(url)
|
|
25
|
+
resp.raise_for_status()
|
|
26
|
+
return resp.json()
|
|
27
|
+
|
|
28
|
+
def get_exchange_info(self, exchange: str, datasource: str = None) -> Dict[str, Any]:
|
|
29
|
+
"""
|
|
30
|
+
Get exchange metadata.
|
|
31
|
+
- If datasource is None → return full exchange info
|
|
32
|
+
- If datasource provided → return datasource-specific info
|
|
33
|
+
"""
|
|
34
|
+
if datasource is None:
|
|
35
|
+
url = f"{self.base_url}/exchnages/{exchange}"
|
|
36
|
+
else:
|
|
37
|
+
url = f"{self.base_url}/exchnages/{exchange}/{datasource}"
|
|
38
|
+
|
|
39
|
+
resp = requests.get(url)
|
|
40
|
+
resp.raise_for_status()
|
|
41
|
+
return resp.json()
|
|
42
|
+
|
|
43
|
+
# -------------------------------
|
|
44
|
+
# Data APIs
|
|
45
|
+
# -------------------------------
|
|
46
|
+
def check_data_availability(
|
|
47
|
+
self,
|
|
48
|
+
exchange: str,
|
|
49
|
+
symbol: str,
|
|
50
|
+
data_type: str,
|
|
51
|
+
from_date: str,
|
|
52
|
+
to_date: str
|
|
53
|
+
) -> Dict[str, Any]:
|
|
54
|
+
"""
|
|
55
|
+
Check whether requested data is in ClickHouse, Storage, or needs to be fetched from Tardis.
|
|
56
|
+
"""
|
|
57
|
+
url = f"{self.base_url}/data"
|
|
58
|
+
payload = {
|
|
59
|
+
"exchange": exchange,
|
|
60
|
+
"symbol": symbol,
|
|
61
|
+
"data_type": data_type,
|
|
62
|
+
"from_date": from_date,
|
|
63
|
+
"to_date": to_date
|
|
64
|
+
}
|
|
65
|
+
resp = requests.post(url, json=payload)
|
|
66
|
+
resp.raise_for_status()
|
|
67
|
+
return resp.json()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zenith-trade-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for accessing Zenith-Trade FastAPI backend
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/zenith-trade-client
|
|
8
|
+
Project-URL: Issues, https://github.com/yourusername/zenith-trade-client/issues
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: requests>=2.31.0
|
|
13
|
+
Requires-Dist: pydantic>=1.10
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# Zenith Trade Client
|
|
17
|
+
|
|
18
|
+
A simple Python client to interact with the **Zenith-Trade FastAPI backend**.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install zenith-trade-client
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
zenith_trade_client/__init__.py
|
|
5
|
+
zenith_trade_client/client.py
|
|
6
|
+
zenith_trade_client/exceptions.py
|
|
7
|
+
zenith_trade_client/models.py
|
|
8
|
+
zenith_trade_client.egg-info/PKG-INFO
|
|
9
|
+
zenith_trade_client.egg-info/SOURCES.txt
|
|
10
|
+
zenith_trade_client.egg-info/dependency_links.txt
|
|
11
|
+
zenith_trade_client.egg-info/requires.txt
|
|
12
|
+
zenith_trade_client.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zenith_trade_client
|