Qubx 0.2.70__cp311-cp311-manylinux_2_35_x86_64.whl → 0.2.72__cp311-cp311-manylinux_2_35_x86_64.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.
Potentially problematic release.
This version of Qubx might be problematic. Click here for more details.
- qubx/backtester/simulator.py +10 -4
- qubx/core/basics.py +6 -0
- qubx/core/series.cpython-311-x86_64-linux-gnu.so +0 -0
- qubx/core/utils.cpython-311-x86_64-linux-gnu.so +0 -0
- qubx/gathering/simplest.py +2 -2
- qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so +0 -0
- qubx/trackers/riskctrl.py +7 -3
- {qubx-0.2.70.dist-info → qubx-0.2.72.dist-info}/METADATA +1 -1
- {qubx-0.2.70.dist-info → qubx-0.2.72.dist-info}/RECORD +10 -10
- {qubx-0.2.70.dist-info → qubx-0.2.72.dist-info}/WHEEL +0 -0
qubx/backtester/simulator.py
CHANGED
|
@@ -468,11 +468,13 @@ class SimulatedExchange(IBrokerServiceProvider):
|
|
|
468
468
|
|
|
469
469
|
if silent:
|
|
470
470
|
for symbol, data_type, event in qiter:
|
|
471
|
-
_run(symbol, data_type, event)
|
|
471
|
+
if not _run(symbol, data_type, event):
|
|
472
|
+
break
|
|
472
473
|
else:
|
|
473
474
|
with tqdm(total=total_duration.total_seconds(), desc="Simulating", unit="s", leave=False) as pbar:
|
|
474
475
|
for symbol, data_type, event in qiter:
|
|
475
|
-
_run(symbol, data_type, event)
|
|
476
|
+
if not _run(symbol, data_type, event):
|
|
477
|
+
break
|
|
476
478
|
dt = pd.Timestamp(event.time)
|
|
477
479
|
# update only if date has changed
|
|
478
480
|
if dt - prev_dt > update_delta:
|
|
@@ -484,7 +486,7 @@ class SimulatedExchange(IBrokerServiceProvider):
|
|
|
484
486
|
|
|
485
487
|
logger.info(f"SimulatedExchangeService :: run :: Simulation finished at {end}")
|
|
486
488
|
|
|
487
|
-
def _run_generated_signals(self, symbol: str, data_type: str, data: Any) ->
|
|
489
|
+
def _run_generated_signals(self, symbol: str, data_type: str, data: Any) -> bool:
|
|
488
490
|
is_hist = data_type.startswith("hist")
|
|
489
491
|
if is_hist:
|
|
490
492
|
raise ValueError("Historical data is not supported for pre-generated signals !")
|
|
@@ -503,7 +505,9 @@ class SimulatedExchange(IBrokerServiceProvider):
|
|
|
503
505
|
cc.send((symbol, "event", {"order": sigs[0][1]}))
|
|
504
506
|
sigs.pop(0)
|
|
505
507
|
|
|
506
|
-
|
|
508
|
+
return cc.control.is_set()
|
|
509
|
+
|
|
510
|
+
def _run_as_strategy(self, symbol: str, data_type: str, data: Any) -> bool:
|
|
507
511
|
cc = self.get_communication_channel()
|
|
508
512
|
t = data.time # type: ignore
|
|
509
513
|
self._current_time = max(np.datetime64(t, "ns"), self._current_time)
|
|
@@ -525,6 +529,8 @@ class SimulatedExchange(IBrokerServiceProvider):
|
|
|
525
529
|
if q is not None and data_type != "quote":
|
|
526
530
|
cc.send((symbol, "quote", q))
|
|
527
531
|
|
|
532
|
+
return cc.control.is_set()
|
|
533
|
+
|
|
528
534
|
def get_quote(self, symbol: str) -> Optional[Quote]:
|
|
529
535
|
return self._last_quotes[symbol]
|
|
530
536
|
|
qubx/core/basics.py
CHANGED
|
@@ -570,6 +570,12 @@ class SimulatedCtrlChannel(CtrlChannel):
|
|
|
570
570
|
def receive(self) -> Any:
|
|
571
571
|
raise ValueError("This method should not be called in a simulated environment.")
|
|
572
572
|
|
|
573
|
+
def stop(self):
|
|
574
|
+
self.control.clear()
|
|
575
|
+
|
|
576
|
+
def start(self):
|
|
577
|
+
self.control.set()
|
|
578
|
+
|
|
573
579
|
|
|
574
580
|
class IComminucationManager:
|
|
575
581
|
databus: CtrlChannel
|
|
Binary file
|
|
Binary file
|
qubx/gathering/simplest.py
CHANGED
|
@@ -34,7 +34,7 @@ class SimplePositionGatherer(IPositionGathering):
|
|
|
34
34
|
|
|
35
35
|
if abs(to_trade) < instrument.min_size:
|
|
36
36
|
if current_position != 0:
|
|
37
|
-
logger.
|
|
37
|
+
logger.debug(
|
|
38
38
|
f"{instrument.exchange}:{instrument.symbol}: Unable change position from {current_position} to {new_size} : too small difference"
|
|
39
39
|
)
|
|
40
40
|
else:
|
|
@@ -45,7 +45,7 @@ class SimplePositionGatherer(IPositionGathering):
|
|
|
45
45
|
if at_price:
|
|
46
46
|
# - we already havbe position but it's requested to change at a specific price
|
|
47
47
|
if abs(current_position) > instrument.min_size:
|
|
48
|
-
logger.
|
|
48
|
+
logger.debug(
|
|
49
49
|
f"<green>{instrument.symbol}</green>: Attempt to change current position {current_position} to {new_size} at {at_price} !"
|
|
50
50
|
)
|
|
51
51
|
|
|
Binary file
|
qubx/trackers/riskctrl.py
CHANGED
|
@@ -201,6 +201,13 @@ class BrokerSideRiskController(RiskController):
|
|
|
201
201
|
|
|
202
202
|
case State.RISK_TRIGGERED:
|
|
203
203
|
c.status = State.DONE
|
|
204
|
+
|
|
205
|
+
# - remove from the tracking list
|
|
206
|
+
logger.debug(
|
|
207
|
+
f"<yellow>{self.__class__.__name__}</yellow> -- stops tracking -- <green>{instrument.symbol}</green>"
|
|
208
|
+
)
|
|
209
|
+
self._trackings.pop(instrument)
|
|
210
|
+
|
|
204
211
|
# - send service signal that risk triggeres (it won't be processed by StrategyContext)
|
|
205
212
|
if c.stop_executed_price:
|
|
206
213
|
return [
|
|
@@ -215,9 +222,6 @@ class BrokerSideRiskController(RiskController):
|
|
|
215
222
|
)
|
|
216
223
|
]
|
|
217
224
|
|
|
218
|
-
case State.OPEN:
|
|
219
|
-
pass
|
|
220
|
-
|
|
221
225
|
case State.DONE:
|
|
222
226
|
logger.debug(
|
|
223
227
|
f"<yellow>{self.__class__.__name__}</yellow> -- stops tracking -- <green>{instrument.symbol}</green>"
|
|
@@ -4,27 +4,27 @@ qubx/backtester/__init__.py,sha256=g9K4pp4ieY4rRKE0eA_02LMo-c4vnk-QqtVn_ff9F5U,6
|
|
|
4
4
|
qubx/backtester/ome.py,sha256=i6J4B4K_LS-3-HhbmtwNJu-NyORZLA7NGlUqdb_EiYQ,10853
|
|
5
5
|
qubx/backtester/optimization.py,sha256=wn48ppzziiNTG37tipY4HfRpqLKl2Y5iVCVO6NsCKRM,6588
|
|
6
6
|
qubx/backtester/queue.py,sha256=ys9tHyrqx3NKbcoTAoOn0m0caIk5F0GpS2x7_sCikro,14997
|
|
7
|
-
qubx/backtester/simulator.py,sha256=
|
|
7
|
+
qubx/backtester/simulator.py,sha256=6sftpEmA9mwIOVvvMKAO7wid84LpRTagkSH8Z69qE2I,34252
|
|
8
8
|
qubx/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
qubx/core/account.py,sha256=uIU-EUMuH5owWhHTmU1pZ0WrkQkiv9YiFqSZW9dFDK8,9066
|
|
10
|
-
qubx/core/basics.py,sha256=
|
|
10
|
+
qubx/core/basics.py,sha256=WA6LrmCG1si6pfyvezLRkfts575912AhGJMVbwBWSa0,21802
|
|
11
11
|
qubx/core/context.py,sha256=WnHsItJ1OQ2jD0cHbYOMQ9ck4txLTwtf8Dp-zCLsUww,37759
|
|
12
12
|
qubx/core/exceptions.py,sha256=W1gG_0fE3o2EMGUfOeOl3vVJDp8Z1iHLv4iZ0ThNkTs,306
|
|
13
13
|
qubx/core/helpers.py,sha256=JAB1kcKO8l--gxg9_W2BzWW1N4x72sicw1oBszKYcbo,12657
|
|
14
14
|
qubx/core/loggers.py,sha256=zpehm2-RdKG1ISe6t3DiM3RrL_zzGni3YFcxfgDkV24,16575
|
|
15
15
|
qubx/core/lookups.py,sha256=qGOSb2SIxmgVPGJFLJnPDI1P9hCzFMVipRDcVLUm8qk,14599
|
|
16
16
|
qubx/core/metrics.py,sha256=pL1obxnk8I7bDF41bQcOZ7MDsq4Wmj6g5cRiV7cFZKQ,38657
|
|
17
|
-
qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=
|
|
17
|
+
qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=X1G0XIdp5bY8vFYlfLYIz4AHpj1l0y8FSGkX8KE81EU,779016
|
|
18
18
|
qubx/core/series.pxd,sha256=kF7QeLFgCM-C2hDxVvJM97ZOmyw1v7JEI9WfPKtQ6xs,3002
|
|
19
19
|
qubx/core/series.pyi,sha256=QeOSi57-NxHEfiP-i7IImf-06KrqSHob5dr6kp45mM4,2603
|
|
20
20
|
qubx/core/series.pyx,sha256=UhZsnT7R3-UED05Fnp3mGxr4RSdMpWAHB4lkcz46MFo,32598
|
|
21
21
|
qubx/core/strategy.py,sha256=tTXhDbFTH63yj53mLgVEDBZxYOxC51prcsyXWkdTgLs,10991
|
|
22
|
-
qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=
|
|
22
|
+
qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=9WudikrXHekK8Y2mZ4yWjplKkXUCxMjJU2cJPEBqLfg,82504
|
|
23
23
|
qubx/core/utils.pyi,sha256=DAjyRVPJSxK4Em-9wui2F0yYHfP5tI5DjKavXNOnHa8,276
|
|
24
24
|
qubx/core/utils.pyx,sha256=-8ek58CrbqWZq0-OY7WSREsCXBoBeWrD_wEYbIBS9rI,1696
|
|
25
25
|
qubx/data/helpers.py,sha256=A0NGzhpXYWD92-GeB8TghwMnR0NW8bjcNJOCXybQw3g,782
|
|
26
26
|
qubx/data/readers.py,sha256=HzNkFI2W4Rkh2AZWsOnnsi9VlHmlBCKaigyMd0T0Jiw,39523
|
|
27
|
-
qubx/gathering/simplest.py,sha256=
|
|
27
|
+
qubx/gathering/simplest.py,sha256=Ez3YFZMKH3o0jV0Qbg1SuZiuFNs_5No_C7wZ6vOeqfo,3814
|
|
28
28
|
qubx/impl/ccxt_connector.py,sha256=ja_0WJDyZfkzqhNvoV-c5CCg15YnbRIThxw0TTNdwcc,13066
|
|
29
29
|
qubx/impl/ccxt_customizations.py,sha256=WUhDT9x2SYuFrOyBIbk2D9Q_U_5QZhtLomLq88Egf_c,6230
|
|
30
30
|
qubx/impl/ccxt_trading.py,sha256=OW0s_kW7GZlbDz_pGBlzLCUT2iDK4dhaBtmIAvj7QDw,9889
|
|
@@ -35,14 +35,14 @@ qubx/pandaz/__init__.py,sha256=Iw5uzicYGSC3FEKZ-W1O5-7cXq_P0kH11-EcXV0zZhs,175
|
|
|
35
35
|
qubx/pandaz/ta.py,sha256=NthiiueUoqWGRcjovcKKThcCcdImZn3JRdWDA2vL28k,85075
|
|
36
36
|
qubx/pandaz/utils.py,sha256=XB28Zwv3cXWbKFXbcV5QGj_d6w-i8Yo4LYkX8aPuCHo,19613
|
|
37
37
|
qubx/ta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256
|
|
38
|
+
qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256=-RacTu0NMTk5SQWRuOCeu5oTrb1salL9VEvDsCsg-FU,576168
|
|
39
39
|
qubx/ta/indicators.pxd,sha256=YzPDhbbNPmy3m4NafwIRF5sNFsmkq-MM1gbeAygtBwM,4007
|
|
40
40
|
qubx/ta/indicators.pyi,sha256=mM_7ISmGQDgjhwxCoZXDw7Rm9fynQSYjevV7fRoLdNc,1683
|
|
41
41
|
qubx/ta/indicators.pyx,sha256=GuxB63YApFnA9IWNJDbBt90J1sOoxTf3jDWYQ3uD9So,24306
|
|
42
42
|
qubx/trackers/__init__.py,sha256=-Hmlc8Mpdi_t6kyeW4ZtmYkHzrULaIb6gUsAkhUxA-4,169
|
|
43
43
|
qubx/trackers/composite.py,sha256=rYQCaxu4IKLf5sS3DCyUUJaSUQwbCy6UMoVjsS-481A,6222
|
|
44
44
|
qubx/trackers/rebalancers.py,sha256=dp-jemxczT8ndkjjzljsIgGnnA6lZQhsf5c4YdmHKCw,6048
|
|
45
|
-
qubx/trackers/riskctrl.py,sha256=
|
|
45
|
+
qubx/trackers/riskctrl.py,sha256=N0CQeCHnL8OI1LST9CAVmyirKRfBbfXQcCjHt8DGSfI,22978
|
|
46
46
|
qubx/trackers/sizers.py,sha256=vh49p2I_5LxYfznOQxlM6f0K1wadgtz7y9NSxg3WdNQ,5953
|
|
47
47
|
qubx/utils/__init__.py,sha256=AL2YibJ3tqBKsZZLUjM9N2J5yy-Kq__k_44oTODQ5sM,321
|
|
48
48
|
qubx/utils/_pyxreloader.py,sha256=FyqGzfSpZGYziB8JYS5AP3cLRAvJSIPAKgwQn0E4YQ0,12017
|
|
@@ -53,6 +53,6 @@ qubx/utils/misc.py,sha256=Av0mhrPCy5NZRrRmjOAhTKusa8wVdL7vCQtEy9bVnz4,10450
|
|
|
53
53
|
qubx/utils/ntp.py,sha256=LZo4FPVY3rqLUV9VWkLcZaPOpUDFC8Qleynmfggg9No,1758
|
|
54
54
|
qubx/utils/runner.py,sha256=Czo01KUCc9Oj9TIcs03d6Qh7fOpQV5w8oH6UDZ6Yqn0,9539
|
|
55
55
|
qubx/utils/time.py,sha256=ioIos3VLA-iYI8LiQIn2m-t0Y37CEQAHFw_-C9Uwo0o,5188
|
|
56
|
-
qubx-0.2.
|
|
57
|
-
qubx-0.2.
|
|
58
|
-
qubx-0.2.
|
|
56
|
+
qubx-0.2.72.dist-info/METADATA,sha256=-Xexb_FokR6TpnLJok3GvGrHWqenagNcrnbtgbmTleM,2573
|
|
57
|
+
qubx-0.2.72.dist-info/WHEEL,sha256=MLOa6LysROdjgj4FVxsHitAnIh8Be2D_c9ZSBHKrz2M,110
|
|
58
|
+
qubx-0.2.72.dist-info/RECORD,,
|
|
File without changes
|