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.
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,8 @@
1
+ # Zenith Trade Client
2
+
3
+ A simple Python client to interact with the **Zenith-Trade FastAPI backend**.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ 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,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .client import ZenithTradeClient
2
+
3
+ __all__ = ["ZenithTradeClient"]
4
+ __version__ = "0.1.0"
@@ -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,3 @@
1
+ class ZenithTradeError(Exception):
2
+ """Base class for all Zenith Trade client errors."""
3
+ pass
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel
2
+
3
+ class DataRequest(BaseModel):
4
+ exchange: str
5
+ symbol: str
6
+ data_type: str
7
+ from_date: str
8
+ to_date: str
9
+
10
+ class ExchangeInfoRequest(BaseModel):
11
+ exchange: str
12
+ datasource: str = None
@@ -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,2 @@
1
+ requests>=2.31.0
2
+ pydantic>=1.10
@@ -0,0 +1 @@
1
+ zenith_trade_client