Qubx 0.1.85__cp311-cp311-manylinux_2_35_x86_64.whl → 0.1.86__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/core/series.pyx CHANGED
@@ -142,6 +142,14 @@ cdef class TimeSeries:
142
142
  def __len__(self) -> int:
143
143
  return len(self.times)
144
144
 
145
+ def loc(self, str t):
146
+ _t = np.datetime64(t, 'ns').item()
147
+ ix = int(np.searchsorted(self.times.values, _t, side='right'))
148
+ ix = min(ix, len(self.values))
149
+ if ix == 0:
150
+ raise ValueError(f"Time {t} not found in {self.name} !")
151
+ return np.datetime64(self.times.values[ix - 1], 'ns'), self.values.values[ix - 1]
152
+
145
153
  def _on_attach_indicator(self, indicator: Indicator, indicator_input: TimeSeries):
146
154
  self.calculation_order.append((
147
155
  id(indicator_input), indicator, id(indicator)
@@ -169,7 +177,7 @@ cdef class TimeSeries:
169
177
  # - disable first notification because first item may be incomplete
170
178
  self._is_new_item = False
171
179
 
172
- elif time - self.times[0] >= self.timeframe:
180
+ elif (_dt := time - self.times[0]) >= self.timeframe:
173
181
  # - add new item
174
182
  self._add_new_item(item_start_time, value)
175
183
 
@@ -186,6 +194,8 @@ cdef class TimeSeries:
186
194
 
187
195
  return self._is_new_item
188
196
  else:
197
+ if _dt < 0:
198
+ raise ValueError(f"Attempt to update past data at {time_to_str(time)} !")
189
199
  self._update_last_item(item_start_time, value)
190
200
 
191
201
  # - update indicators by new data
@@ -746,7 +756,7 @@ cdef class OHLCV(TimeSeries):
746
756
  # Here we disable first notification because first item may be incomplete
747
757
  self._is_new_item = False
748
758
 
749
- elif time - self.times[0] >= self.timeframe:
759
+ elif (_dt := time - self.times[0]) >= self.timeframe:
750
760
  b = Bar(bar_start_time, price, price, price, price, volume, bvolume)
751
761
 
752
762
  # - add new item
@@ -757,6 +767,9 @@ cdef class OHLCV(TimeSeries):
757
767
 
758
768
  return self._is_new_item
759
769
  else:
770
+ if _dt < 0:
771
+ raise ValueError(f"Attempt to update past data at {time_to_str(time)} !")
772
+
760
773
  self._update_last_item(bar_start_time, self[0].update(price, volume, bvolume))
761
774
 
762
775
  # - update indicators by new data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Qubx
3
- Version: 0.1.85
3
+ Version: 0.1.86
4
4
  Summary: Qubx - quantitative trading framework
5
5
  Home-page: https://github.com/dmarienko/Qubx
6
6
  Author: Dmitry Marienko
@@ -6,11 +6,11 @@ qubx/core/basics.py,sha256=2u7WV5KX-RbTmzoKfi1yT4HNLDPfQcFMCUZ1pVsM_VE,14777
6
6
  qubx/core/helpers.py,sha256=gPE78dO718NBY0-JbfqNGCzIvr4BVatFntNIy2RUrEY,11559
7
7
  qubx/core/loggers.py,sha256=HpgavBZegoDv9ssihtqX0pitXKULVAPHUpoE_volJw0,11910
8
8
  qubx/core/lookups.py,sha256=4aEC7b2AyEXFqHHGDenex3Z1FZGrpDSb8IwzBZrSqIA,13688
9
- qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=7NNiUCoh0udFOk9wJ5tp_ym28TSLDTfNF1-NwEucClQ,728584
9
+ qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=4Io0Hu1pigs8yTyQLyTWlgk2fIKDc-WfyIqDqW8aShA,736872
10
10
  qubx/core/series.pxd,sha256=YC1w11gzn1eq6kBrLTufLlECsKd0YWLu70k_CuAMksg,2916
11
- qubx/core/series.pyx,sha256=MAONNY5MFQuAx_a3ERdApHIht8V_ZfEumlXnuN5-1Mg,28795
11
+ qubx/core/series.pyx,sha256=zO1M9MtVgzQyy0oVhO9HOWaIqT2HwcqhR-MdxpEk-HI,29401
12
12
  qubx/core/strategy.py,sha256=Fs4fFyHaEGYuz7mBeQHBWFu3Ipg0yFzcxXhskgsPxJE,30330
13
- qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=opsPUzbiwyWHKQr0Z8mE3RETboosalQHNGXXOk2IiSY,74248
13
+ qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=TOc2_8Yp5GTKZopTe4NOzMRCuxhQsIZ413Uj7KY25hM,74248
14
14
  qubx/core/utils.pyx,sha256=csSIwI_lwvCd8CTbsp9Q0XiRCtGAHEuF62afHOJzCGQ,1382
15
15
  qubx/data/readers.py,sha256=YQvVbjyHsWDL54bVOzm78sTAF1ORYGT1eW4tVpnv5uA,32481
16
16
  qubx/impl/ccxt_connector.py,sha256=NqF-tgxfTATnmVqKUonNXCAzECrDU8YrgqM3Nq06fw8,9150
@@ -23,7 +23,7 @@ qubx/pandaz/__init__.py,sha256=Iw5uzicYGSC3FEKZ-W1O5-7cXq_P0kH11-EcXV0zZhs,175
23
23
  qubx/pandaz/ta.py,sha256=O17JPtee8MLyBoS8zdm32qsQcBJNtAPUpgFj3SMUKsA,85060
24
24
  qubx/pandaz/utils.py,sha256=FyLKQy8spkqxhBij_nPFC_ZzI_L3-IgB9O53MqWKmq0,19109
25
25
  qubx/ta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256=cA1RQP0fVjIE259qv2LG7uPMT8tCvPMetbSC_sjA2WA,505832
26
+ qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256=ZfURBU5ZuAjDAJcOAeTQtndUo0NGCvQXOoMMMA8PKuE,505832
27
27
  qubx/ta/indicators.pyx,sha256=VKSkRbG-98bpI9skelJPAaY9WF6Cnql_qZkuKdz-i2M,21326
28
28
  qubx/trackers/__init__.py,sha256=1y_yvIy0OQwBqfhAW_EY33NxFzFSWvI0qNAPU6zchYc,60
29
29
  qubx/trackers/rebalancers.py,sha256=QCzANCooZBi2VMCBjjCPMq_Dt1h1zrBelATnfmVve74,5522
@@ -34,6 +34,6 @@ qubx/utils/marketdata/binance.py,sha256=36dl4rxOAGTeY3uoONmiPanj8BkP0oBdDiH-URJJ
34
34
  qubx/utils/misc.py,sha256=hmG_c7nneLiJ-xgyeOQucckPRemNAQ0Hsr7OqDdhbhU,9868
35
35
  qubx/utils/runner.py,sha256=OY7SoRfxHwzn0rKTGB_lbg5zNASEL_49hQXWqs-LiMk,9306
36
36
  qubx/utils/time.py,sha256=_DjCdQditzZwMy_8rvPdWyw5tjw__2p24LMPgXdZ8i0,4911
37
- qubx-0.1.85.dist-info/METADATA,sha256=f4Mb45hu9qq2VwRHmPquzz_skD31ry8v3BQ1QTzXmEw,2524
38
- qubx-0.1.85.dist-info/WHEEL,sha256=MLOa6LysROdjgj4FVxsHitAnIh8Be2D_c9ZSBHKrz2M,110
39
- qubx-0.1.85.dist-info/RECORD,,
37
+ qubx-0.1.86.dist-info/METADATA,sha256=CsA5airqL-02CdzTmn8Q4jb4mpjfTu87h6fodPMoREM,2524
38
+ qubx-0.1.86.dist-info/WHEEL,sha256=MLOa6LysROdjgj4FVxsHitAnIh8Be2D_c9ZSBHKrz2M,110
39
+ qubx-0.1.86.dist-info/RECORD,,
File without changes