wiz-trader 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
wiz_trader/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """WizTrader SDK for connecting to the Wizzer."""
2
+
3
+ from .quotes import QuotesClient
4
+
5
+ __version__ = "0.2.0"
6
+
7
+ __all__ = ["QuotesClient"]
@@ -1,3 +1,5 @@
1
1
  # apis/__init__.py
2
2
  # Provision for REST API functionalities in future.
3
3
  # Currently, no APIs are implemented.
4
+
5
+ """Module for REST API integrations (future functionality)."""
@@ -0,0 +1,5 @@
1
+ """Quotes module for real-time market data."""
2
+
3
+ from .client import QuotesClient
4
+
5
+ __all__ = ["QuotesClient"]
@@ -8,10 +8,6 @@ from typing import Callable, List, Optional
8
8
  import websockets
9
9
  from websockets.exceptions import ConnectionClosed
10
10
  from websockets.protocol import State
11
- from dotenv import load_dotenv
12
-
13
- # Load environment variables from .env (if available)
14
- load_dotenv()
15
11
 
16
12
  # Setup module-level logger with a default handler if none exists.
17
13
  logger = logging.getLogger(__name__)
@@ -46,8 +42,9 @@ class QuotesClient:
46
42
  logger.setLevel(valid_levels[log_level])
47
43
 
48
44
  self.log_level = log_level
49
- self.base_url = base_url or os.getenv("WZ__QUOTES_BASE_URL")
50
- self.token = token or os.getenv("WZ__TOKEN")
45
+ # System env vars take precedence over .env
46
+ self.base_url = base_url or os.environ.get("WZ__QUOTES_BASE_URL")
47
+ self.token = token or os.environ.get("WZ__TOKEN")
51
48
  if not self.token:
52
49
  raise ValueError("JWT token must be provided as an argument or in .env (WZ__TOKEN)")
53
50
  if not self.base_url:
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.2
2
+ Name: wiz_trader
3
+ Version: 0.2.0
4
+ Summary: A Python SDK for connecting to the Wizzer.
5
+ Home-page: https://bitbucket.org/wizzer-tech/quotes_sdk.git
6
+ Author: Pawan Wagh
7
+ Author-email: Pawan Wagh <pawan@wizzer.in>
8
+ License: MIT
9
+ Project-URL: Homepage, https://bitbucket.org/wizzer-tech/quotes_sdk.git
10
+ Project-URL: Bug Tracker, https://bitbucket.org/wizzer-tech/quotes_sdk/issues
11
+ Keywords: finance,trading,sdk
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Topic :: Office/Business :: Financial
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: websockets
23
+ Dynamic: author
24
+ Dynamic: home-page
25
+ Dynamic: requires-python
26
+
27
+ # WizTrader SDK
28
+
29
+ A Python SDK for connecting to the Wizzer trading platform.
30
+
31
+ ## Installation
32
+
33
+ You can install the package directly from PyPI:
34
+
35
+ ```bash
36
+ pip install wiz_trader
37
+ ```
38
+
39
+ ## Features
40
+
41
+ - Real-time market data through WebSocket connection
42
+ - Automatic reconnection with exponential backoff
43
+ - Subscribe/unsubscribe to instruments
44
+ - Customizable logging levels
45
+
46
+ ## Quick Start
47
+
48
+ ```python
49
+ import asyncio
50
+ from wiz_trader import QuotesClient
51
+
52
+ # Callback function to process market data
53
+ def process_tick(data):
54
+ print(f"Received tick: {data}")
55
+
56
+ async def main():
57
+ # Initialize client with direct parameters
58
+ client = QuotesClient(
59
+ base_url="wss://your-websocket-url.com/quotes",
60
+ token="your-jwt-token",
61
+ log_level="info" # Options: "error", "info", "debug"
62
+ )
63
+
64
+ # Set callback
65
+ client.on_tick = process_tick
66
+
67
+ # Connect in the background
68
+ connection_task = asyncio.create_task(client.connect())
69
+
70
+ # Subscribe to instruments
71
+ await client.subscribe(["NSE:SBIN:3045"])
72
+
73
+ # Keep the connection running
74
+ try:
75
+ await asyncio.sleep(3600) # Run for 1 hour
76
+ except KeyboardInterrupt:
77
+ # Unsubscribe and close
78
+ await client.unsubscribe(["NSE:SBIN:3045"])
79
+ await client.close()
80
+
81
+ await connection_task
82
+
83
+ if __name__ == "__main__":
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ## Configuration
88
+
89
+ You can configure the client in two ways:
90
+
91
+ 1. **Direct parameter passing** (recommended):
92
+ ```python
93
+ client = QuotesClient(
94
+ base_url="wss://your-websocket-url.com/quotes",
95
+ token="your-jwt-token",
96
+ log_level="info"
97
+ )
98
+ ```
99
+
100
+ 2. **System environment variables**:
101
+ - `WZ__QUOTES_BASE_URL`: WebSocket URL for the quotes server
102
+ - `WZ__TOKEN`: JWT token for authentication
103
+
104
+ ```python
105
+ # The client will automatically use the environment variables if parameters are not provided
106
+ client = QuotesClient(log_level="info")
107
+ ```
108
+
109
+ ## Advanced Usage
110
+
111
+ Check the `examples/` directory for more detailed examples:
112
+
113
+ - `example_manual.py`: Demonstrates direct configuration with parameters
114
+
115
+ ## License
116
+
117
+ This project is licensed under the MIT License - see the LICENSE file for details.
118
+
119
+ ## Contributing
120
+
121
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -0,0 +1,9 @@
1
+ wiz_trader/__init__.py,sha256=eF_WT0HrgsF5TUUwqYzVybEmjT-q-hKPAV9Gi0txSTs,134
2
+ wiz_trader/apis/__init__.py,sha256=mcwt2QZZ1q576tKc4bXsx8PoFNimZkgYqOQrrbD43XE,172
3
+ wiz_trader/apis/client.py,sha256=NJ9cPIK0LIe1rhC8CIRIXRvQ3zksIuNJCFlnTJlYm9E,88
4
+ wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
+ wiz_trader/quotes/client.py,sha256=fUHTMGDauGF9cjsFsVAzoOwqSgD555_TLoNqmnFhLdQ,6203
6
+ wiz_trader-0.2.0.dist-info/METADATA,sha256=PdGKFSHFTxEgLTC6qzNOzgpmr1G4QS2v1df4ne9pXdA,3280
7
+ wiz_trader-0.2.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
8
+ wiz_trader-0.2.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
+ wiz_trader-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1 @@
1
+ wiz_trader
ticker/__init__.py DELETED
@@ -1,5 +0,0 @@
1
- from .client import QuotesClient
2
-
3
- __version__ = "0.1.0"
4
-
5
- __all__ = ["QuotesClient", "__version__"]
@@ -1,43 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: wiz_trader
3
- Version: 0.1.0
4
- Summary: A Python SDK for connecting to the Wizzer.
5
- Home-page: https://bitbucket.org/wizzer-tech/quotes_sdk.git
6
- Author: Pawan Wagh
7
- Author-email: pawan@wizzer.in
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Financial and Insurance Industry
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Operating System :: OS Independent
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Topic :: Office/Business :: Financial
15
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Requires-Python: >=3.6
17
- Description-Content-Type: text/markdown
18
- Requires-Dist: websockets
19
- Requires-Dist: python-dotenv
20
- Dynamic: author
21
- Dynamic: author-email
22
- Dynamic: classifier
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: home-page
26
- Dynamic: requires-dist
27
- Dynamic: requires-python
28
- Dynamic: summary
29
-
30
- # WizTrader SDK
31
-
32
- A Python SDK for connecting to the Wizzer.
33
-
34
- ## Installation
35
-
36
- Install the dependencies:
37
- ```
38
- pip install -r requirements.txt
39
- ```
40
-
41
- ## Usage Example
42
-
43
- See `example.py` for a complete example.
@@ -1,8 +0,0 @@
1
- apis/__init__.py,sha256=30bmGcN4MBabbN1-7wuowVRfwjuhdszhnF6uOoyIJoU,109
2
- apis/client.py,sha256=NJ9cPIK0LIe1rhC8CIRIXRvQ3zksIuNJCFlnTJlYm9E,88
3
- ticker/__init__.py,sha256=f4xaHOWLxEyckZpHbZFWHUbiaqqOTJ318Xi8vDJWGdg,99
4
- ticker/client.py,sha256=DR0RIqmLjuo3ZDs2rVzMib-NRyjh96Xq09ZhI7vR56k,6245
5
- wiz_trader-0.1.0.dist-info/METADATA,sha256=d36YvgtqisRnNhdZ9HyECOYGHwJ-TNqlKznMD_5AT1k,1158
6
- wiz_trader-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- wiz_trader-0.1.0.dist-info/top_level.txt,sha256=VDgCJWC-MmXn4pnnJXeasXwqKHN0Qhu0TmbEPbGU2Ro,12
8
- wiz_trader-0.1.0.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- apis
2
- ticker
File without changes