Qubx 0.1.85__tar.gz → 0.1.86__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.
Potentially problematic release.
This version of Qubx might be problematic. Click here for more details.
- {qubx-0.1.85 → qubx-0.1.86}/PKG-INFO +1 -1
- {qubx-0.1.85 → qubx-0.1.86}/pyproject.toml +1 -1
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/series.pyx +15 -2
- {qubx-0.1.85 → qubx-0.1.86}/README.md +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/build.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/_nb_magic.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/account.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/basics.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/helpers.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/loggers.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/lookups.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/series.pxd +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/strategy.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/core/utils.pyx +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/data/readers.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/impl/ccxt_connector.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/impl/ccxt_customizations.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/impl/ccxt_trading.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/impl/ccxt_utils.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/math/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/math/stats.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/pandaz/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/pandaz/ta.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/pandaz/utils.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/ta/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/ta/indicators.pyx +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/trackers/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/trackers/rebalancers.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/__init__.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/_pyxreloader.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/charting/mpl_helpers.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/marketdata/binance.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/misc.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/runner.py +0 -0
- {qubx-0.1.85 → qubx-0.1.86}/src/qubx/utils/time.py +0 -0
|
@@ -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
|
|
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
|
|
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
|