tradingapi 0.3.4__tar.gz → 0.3.5__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.
- {tradingapi-0.3.4 → tradingapi-0.3.5}/PKG-INFO +1 -1
- {tradingapi-0.3.4 → tradingapi-0.3.5}/pyproject.toml +1 -1
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/allocation.py +18 -4
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/fivepaisa.py +3 -6
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/utils.py +1 -1
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/PKG-INFO +1 -1
- {tradingapi-0.3.4 → tradingapi-0.3.5}/README.md +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/setup.cfg +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tests/test_find_option_with_delta.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/__init__.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/attribution.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/broker_base.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/config/commissions_20241216.yaml +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/config/config_sample.yaml +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/config.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/dhan.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/error_handling.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/exceptions.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/flattrade.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/globals.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/icicidirect.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/icicidirect_generate_session.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/market_data_exchanges.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/proxy_utils.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/shoonya.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi/span.py +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/SOURCES.txt +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/dependency_links.txt +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/entry_points.txt +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/requires.txt +0 -0
- {tradingapi-0.3.4 → tradingapi-0.3.5}/tradingapi.egg-info/top_level.txt +0 -0
|
@@ -21,13 +21,15 @@ _ALLOCATIONS_DIR = Path(os.path.expanduser("~/onedrive/.tradingapi/allocations")
|
|
|
21
21
|
_TODAY_SYMLINK = _ALLOCATIONS_DIR / "master_allocation_today.yaml"
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def
|
|
25
|
-
"""Return the
|
|
24
|
+
def load_today_allocation_entry(broker_name: str, strategy_name: str) -> dict:
|
|
25
|
+
"""Return the full allocation entry dict for strategy_name on broker_name today.
|
|
26
|
+
|
|
27
|
+
Example return value: {'pct': 0.275, 'redis_db': 8}
|
|
28
|
+
SCALPING strategies include a 'redis_db' key; others have only 'pct'.
|
|
26
29
|
|
|
27
30
|
Reads master_allocation_today.yaml (a symlink to today's dated file).
|
|
28
31
|
Raises FileNotFoundError if the symlink/file is missing.
|
|
29
32
|
Raises ValueError if the date in the file does not match today.
|
|
30
|
-
Returns 0.0 if the strategy is listed with pct == 0 (inactive today).
|
|
31
33
|
Raises KeyError if the broker/strategy is not found in the file at all.
|
|
32
34
|
"""
|
|
33
35
|
if not _TODAY_SYMLINK.exists():
|
|
@@ -63,7 +65,19 @@ def load_today_allocation(broker_name: str, strategy_name: str) -> float:
|
|
|
63
65
|
f"Available strategies: {list(strategies.keys())}"
|
|
64
66
|
)
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
return dict(strategies[strategy_key])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def load_today_allocation(broker_name: str, strategy_name: str) -> float:
|
|
72
|
+
"""Return the pct (0.0–1.0) allocated to strategy_name on broker_name today.
|
|
73
|
+
|
|
74
|
+
Reads master_allocation_today.yaml (a symlink to today's dated file).
|
|
75
|
+
Raises FileNotFoundError if the symlink/file is missing.
|
|
76
|
+
Raises ValueError if the date in the file does not match today.
|
|
77
|
+
Returns 0.0 if the strategy is listed with pct == 0 (inactive today).
|
|
78
|
+
Raises KeyError if the broker/strategy is not found in the file at all.
|
|
79
|
+
"""
|
|
80
|
+
entry = load_today_allocation_entry(broker_name, strategy_name)
|
|
67
81
|
return float(entry.get("pct", 0.0))
|
|
68
82
|
|
|
69
83
|
|
|
@@ -3860,12 +3860,9 @@ class FivePaisa(BrokerBase):
|
|
|
3860
3860
|
|
|
3861
3861
|
# Start the connection and receiving data in a separate thread
|
|
3862
3862
|
if not has_live_stream():
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
)
|
|
3866
|
-
self.subscribe_thread.start()
|
|
3867
|
-
time.sleep(2)
|
|
3868
|
-
trading_logger.log_info("Streaming thread started", {"thread_name": "MarketDataStreamer"})
|
|
3863
|
+
# WS is dead — full reconnect restoring all subscribed_symbols (already updated above).
|
|
3864
|
+
# Connecting with just the current op's req_data would lose all prior subscriptions.
|
|
3865
|
+
reconnect_stream()
|
|
3869
3866
|
else:
|
|
3870
3867
|
trading_logger.log_info(
|
|
3871
3868
|
"Requesting streaming for existing connection", {"req_data": json.dumps(req_data)}
|
|
@@ -93,7 +93,7 @@ empty_trades = pd.DataFrame(
|
|
|
93
93
|
"exit_time": pd.Series(dtype="string"),
|
|
94
94
|
"exit_quantity": pd.Series(dtype="float64"),
|
|
95
95
|
"exit_price": pd.Series(dtype="float64"),
|
|
96
|
-
"commission": pd.Series(dtype="
|
|
96
|
+
"commission": pd.Series(dtype="float64"),
|
|
97
97
|
"int_order_id": pd.Series(dtype="object"),
|
|
98
98
|
"entry_keys": pd.Series(dtype="object"),
|
|
99
99
|
"exit_keys": pd.Series(dtype="object"),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|