stock-platform-sdk 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.
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: stock-platform-sdk
3
+ Version: 0.1.0
4
+ Summary: QMT trading SDK with WebSocket (Centrifugo) integration
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: centrifuge-python>=0.12.0
9
+ Requires-Dist: aiohttp>=3.9.0
10
+ Requires-Dist: pandas>=1.5.3
11
+
12
+ # Stock Platform SDK
13
+
14
+ QMT trading SDK with WebSocket (Centrifugo) integration.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install stock-platform-sdk
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from stock_platform_sdk import configure, init
26
+
27
+ # Step 1: Configure connection
28
+ configure(
29
+ access_key="your_access_key",
30
+ secret_key="your_secret_key",
31
+ strategy_name="my_strategy",
32
+ backend_url="http://localhost:8888", # optional
33
+ centrifugo_url="http://localhost:8000" # optional
34
+ )
35
+
36
+ # Step 2: Initialize in QMT strategy
37
+ def init(C):
38
+ from stock_platform_sdk import init as sdk_init
39
+ sdk_init(C)
40
+ ```
41
+
42
+ ## API
43
+
44
+ - `configure(access_key, secret_key, strategy_name, ...)` - Set connection parameters
45
+ - `init(C)` - Initialize SDK with QMT ContextInfo
46
+ - `get_config()` - Get current configuration
47
+ - `create_websocket_handler(access_key, secret_key, strategy_name)` - Create WebSocket handler
48
+
49
+ ## Constants
50
+
51
+ ```python
52
+ from stock_platform_sdk import constants
53
+
54
+ constants.OrderStatus.FILLED # 56
55
+ constants.TradeConfig.BUY_PRICE_MULTIPLIER # 1.012
56
+ constants.ChannelPrefix.make_trade_channel("my_strategy") # "trade:my_strategy"
57
+ ```
@@ -0,0 +1,46 @@
1
+ # Stock Platform SDK
2
+
3
+ QMT trading SDK with WebSocket (Centrifugo) integration.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install stock-platform-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from stock_platform_sdk import configure, init
15
+
16
+ # Step 1: Configure connection
17
+ configure(
18
+ access_key="your_access_key",
19
+ secret_key="your_secret_key",
20
+ strategy_name="my_strategy",
21
+ backend_url="http://localhost:8888", # optional
22
+ centrifugo_url="http://localhost:8000" # optional
23
+ )
24
+
25
+ # Step 2: Initialize in QMT strategy
26
+ def init(C):
27
+ from stock_platform_sdk import init as sdk_init
28
+ sdk_init(C)
29
+ ```
30
+
31
+ ## API
32
+
33
+ - `configure(access_key, secret_key, strategy_name, ...)` - Set connection parameters
34
+ - `init(C)` - Initialize SDK with QMT ContextInfo
35
+ - `get_config()` - Get current configuration
36
+ - `create_websocket_handler(access_key, secret_key, strategy_name)` - Create WebSocket handler
37
+
38
+ ## Constants
39
+
40
+ ```python
41
+ from stock_platform_sdk import constants
42
+
43
+ constants.OrderStatus.FILLED # 56
44
+ constants.TradeConfig.BUY_PRICE_MULTIPLIER # 1.012
45
+ constants.ChannelPrefix.make_trade_channel("my_strategy") # "trade:my_strategy"
46
+ ```
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "stock-platform-sdk"
7
+ version = "0.1.0"
8
+ description = "QMT trading SDK with WebSocket (Centrifugo) integration"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ dependencies = [
13
+ "centrifuge-python>=0.12.0",
14
+ "aiohttp>=3.9.0",
15
+ "pandas>=1.5.3",
16
+ ]
17
+
18
+ [tool.setuptools.packages.find]
19
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,86 @@
1
+ """
2
+ Stock Platform SDK
3
+
4
+ QMT trading SDK with WebSocket (Centrifugo) integration.
5
+ Provides QMT-compatible interfaces using WebSocket instead of Redis Stream.
6
+ """
7
+
8
+ # Global config
9
+ _config = None
10
+
11
+
12
+ def configure(access_key, secret_key, strategy_name, backend_url=None, centrifugo_url=None):
13
+ """
14
+ Configure Centrifugo connection parameters.
15
+
16
+ Args:
17
+ access_key: Access key
18
+ secret_key: Secret key
19
+ strategy_name: Strategy name
20
+ backend_url: Backend server URL (optional)
21
+ centrifugo_url: Centrifugo server URL (optional)
22
+ """
23
+ global _config
24
+ from .centrifugo_websocket_client import CentrifugoClientConfig
25
+ _config = CentrifugoClientConfig(
26
+ access_key=access_key,
27
+ secret_key=secret_key,
28
+ strategy_name=strategy_name,
29
+ backend_url=backend_url,
30
+ centrifugo_url=centrifugo_url
31
+ )
32
+
33
+
34
+ def get_config():
35
+ """Get current configuration."""
36
+ return _config
37
+
38
+
39
+ # Export all public interfaces
40
+ from .centrifugo_websocket_client import (
41
+ CentrifugoClientConfig,
42
+ create_websocket_handler,
43
+ )
44
+ from .qmt_state import QMTState
45
+ from .qmt_mock import MockContextInfo
46
+ from . import constants
47
+ from .centrifugo_qmt import (
48
+ init,
49
+ process_centrifugo_messages,
50
+ process_signal,
51
+ handle_buy_signal,
52
+ handle_sell_signal,
53
+ refresh_waiting_dict,
54
+ refresh_bought_list,
55
+ refresh_timeout_orders,
56
+ refresh_order_status,
57
+ )
58
+
59
+
60
+ __all__ = [
61
+ # Config
62
+ 'configure',
63
+ 'get_config',
64
+
65
+ # Classes
66
+ 'CentrifugoClientConfig',
67
+ 'QMTState',
68
+ 'MockContextInfo',
69
+
70
+ # Core functions
71
+ 'init',
72
+ 'process_centrifugo_messages',
73
+ 'process_signal',
74
+ 'handle_buy_signal',
75
+ 'handle_sell_signal',
76
+ 'refresh_waiting_dict',
77
+ 'refresh_bought_list',
78
+ 'refresh_timeout_orders',
79
+ 'refresh_order_status',
80
+
81
+ # Factory
82
+ 'create_websocket_handler',
83
+
84
+ # Constants module
85
+ 'constants',
86
+ ]