Qubx 0.5.7__cp312-cp312-manylinux_2_39_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.

Files changed (100) hide show
  1. qubx/__init__.py +207 -0
  2. qubx/_nb_magic.py +100 -0
  3. qubx/backtester/__init__.py +5 -0
  4. qubx/backtester/account.py +145 -0
  5. qubx/backtester/broker.py +87 -0
  6. qubx/backtester/data.py +296 -0
  7. qubx/backtester/management.py +378 -0
  8. qubx/backtester/ome.py +296 -0
  9. qubx/backtester/optimization.py +201 -0
  10. qubx/backtester/simulated_data.py +558 -0
  11. qubx/backtester/simulator.py +362 -0
  12. qubx/backtester/utils.py +780 -0
  13. qubx/cli/__init__.py +0 -0
  14. qubx/cli/commands.py +67 -0
  15. qubx/connectors/ccxt/__init__.py +0 -0
  16. qubx/connectors/ccxt/account.py +495 -0
  17. qubx/connectors/ccxt/broker.py +132 -0
  18. qubx/connectors/ccxt/customizations.py +193 -0
  19. qubx/connectors/ccxt/data.py +612 -0
  20. qubx/connectors/ccxt/exceptions.py +17 -0
  21. qubx/connectors/ccxt/factory.py +93 -0
  22. qubx/connectors/ccxt/utils.py +307 -0
  23. qubx/core/__init__.py +0 -0
  24. qubx/core/account.py +251 -0
  25. qubx/core/basics.py +850 -0
  26. qubx/core/context.py +420 -0
  27. qubx/core/exceptions.py +38 -0
  28. qubx/core/helpers.py +480 -0
  29. qubx/core/interfaces.py +1150 -0
  30. qubx/core/loggers.py +514 -0
  31. qubx/core/lookups.py +475 -0
  32. qubx/core/metrics.py +1512 -0
  33. qubx/core/mixins/__init__.py +13 -0
  34. qubx/core/mixins/market.py +94 -0
  35. qubx/core/mixins/processing.py +428 -0
  36. qubx/core/mixins/subscription.py +203 -0
  37. qubx/core/mixins/trading.py +88 -0
  38. qubx/core/mixins/universe.py +270 -0
  39. qubx/core/series.cpython-312-x86_64-linux-gnu.so +0 -0
  40. qubx/core/series.pxd +125 -0
  41. qubx/core/series.pyi +118 -0
  42. qubx/core/series.pyx +988 -0
  43. qubx/core/utils.cpython-312-x86_64-linux-gnu.so +0 -0
  44. qubx/core/utils.pyi +6 -0
  45. qubx/core/utils.pyx +62 -0
  46. qubx/data/__init__.py +25 -0
  47. qubx/data/helpers.py +416 -0
  48. qubx/data/readers.py +1562 -0
  49. qubx/data/tardis.py +100 -0
  50. qubx/gathering/simplest.py +88 -0
  51. qubx/math/__init__.py +3 -0
  52. qubx/math/stats.py +129 -0
  53. qubx/pandaz/__init__.py +23 -0
  54. qubx/pandaz/ta.py +2757 -0
  55. qubx/pandaz/utils.py +638 -0
  56. qubx/resources/instruments/symbols-binance.cm.json +1 -0
  57. qubx/resources/instruments/symbols-binance.json +1 -0
  58. qubx/resources/instruments/symbols-binance.um.json +1 -0
  59. qubx/resources/instruments/symbols-bitfinex.f.json +1 -0
  60. qubx/resources/instruments/symbols-bitfinex.json +1 -0
  61. qubx/resources/instruments/symbols-kraken.f.json +1 -0
  62. qubx/resources/instruments/symbols-kraken.json +1 -0
  63. qubx/ta/__init__.py +0 -0
  64. qubx/ta/indicators.cpython-312-x86_64-linux-gnu.so +0 -0
  65. qubx/ta/indicators.pxd +149 -0
  66. qubx/ta/indicators.pyi +41 -0
  67. qubx/ta/indicators.pyx +787 -0
  68. qubx/trackers/__init__.py +3 -0
  69. qubx/trackers/abvanced.py +236 -0
  70. qubx/trackers/composite.py +146 -0
  71. qubx/trackers/rebalancers.py +129 -0
  72. qubx/trackers/riskctrl.py +641 -0
  73. qubx/trackers/sizers.py +235 -0
  74. qubx/utils/__init__.py +5 -0
  75. qubx/utils/_pyxreloader.py +281 -0
  76. qubx/utils/charting/lookinglass.py +1057 -0
  77. qubx/utils/charting/mpl_helpers.py +1183 -0
  78. qubx/utils/marketdata/binance.py +284 -0
  79. qubx/utils/marketdata/ccxt.py +90 -0
  80. qubx/utils/marketdata/dukas.py +130 -0
  81. qubx/utils/misc.py +541 -0
  82. qubx/utils/ntp.py +63 -0
  83. qubx/utils/numbers_utils.py +7 -0
  84. qubx/utils/orderbook.py +491 -0
  85. qubx/utils/plotting/__init__.py +0 -0
  86. qubx/utils/plotting/dashboard.py +150 -0
  87. qubx/utils/plotting/data.py +137 -0
  88. qubx/utils/plotting/interfaces.py +25 -0
  89. qubx/utils/plotting/renderers/__init__.py +0 -0
  90. qubx/utils/plotting/renderers/plotly.py +0 -0
  91. qubx/utils/runner/__init__.py +1 -0
  92. qubx/utils/runner/_jupyter_runner.pyt +60 -0
  93. qubx/utils/runner/accounts.py +88 -0
  94. qubx/utils/runner/configs.py +65 -0
  95. qubx/utils/runner/runner.py +470 -0
  96. qubx/utils/time.py +312 -0
  97. qubx-0.5.7.dist-info/METADATA +105 -0
  98. qubx-0.5.7.dist-info/RECORD +100 -0
  99. qubx-0.5.7.dist-info/WHEEL +4 -0
  100. qubx-0.5.7.dist-info/entry_points.txt +3 -0
qubx/ta/__init__.py ADDED
File without changes
qubx/ta/indicators.pxd ADDED
@@ -0,0 +1,149 @@
1
+ cimport numpy as np
2
+ from qubx.core.series cimport Indicator, IndicatorOHLC, RollingSum, TimeSeries, OHLCV, Bar
3
+
4
+ cdef class Sma(Indicator):
5
+ cdef unsigned int period
6
+ cdef RollingSum summator
7
+
8
+ cpdef double calculate(self, long long time, double value, short new_item_started)
9
+
10
+ cdef class Ema(Indicator):
11
+ cdef int period
12
+ cdef np.ndarray __s
13
+ cdef int __i
14
+ cdef double alpha
15
+ cdef double alpha_1
16
+ cdef unsigned short init_mean
17
+ cdef unsigned short _init_stage
18
+
19
+ cpdef double calculate(self, long long time, double value, short new_item_started)
20
+
21
+ cdef class Tema(Indicator):
22
+ cdef int period
23
+ cdef unsigned short init_mean
24
+ cdef TimeSeries ser0
25
+ cdef Ema ema1
26
+ cdef Ema ema2
27
+ cdef Ema ema3
28
+ cpdef double calculate(self, long long time, double value, short new_item_started)
29
+
30
+ cdef class Dema(Indicator):
31
+ cdef int period
32
+ cdef unsigned short init_mean
33
+ cdef TimeSeries ser0
34
+ cdef Ema ema1
35
+ cdef Ema ema2
36
+
37
+ cpdef double calculate(self, long long time, double value, short new_item_started)
38
+
39
+ cdef class Kama(Indicator):
40
+ cdef int period
41
+ cdef int fast_span
42
+ cdef int slow_span
43
+ cdef double _S1
44
+ cdef double _K1
45
+ cdef _x_past
46
+ cdef RollingSum summator
47
+
48
+ cpdef double calculate(self, long long time, double value, short new_item_started)
49
+
50
+ cdef class Highest(Indicator):
51
+ cdef int period
52
+ cdef object queue
53
+ cpdef double calculate(self, long long time, double value, short new_item_started)
54
+
55
+ cdef class Lowest(Indicator):
56
+ cdef int period
57
+ cdef object queue
58
+ cpdef double calculate(self, long long time, double value, short new_item_started)
59
+
60
+ cdef class Std(Indicator):
61
+ cdef int period
62
+ cdef RollingSum rolling_sum, variance_sum
63
+ cpdef double calculate(self, long long time, double value, short new_item_started)
64
+
65
+
66
+ cdef class Zscore(Indicator):
67
+ cdef TimeSeries tr
68
+ cdef Indicator ma, std
69
+ cpdef double calculate(self, long long time, double value, short new_item_started)
70
+
71
+ cdef class Pewma(Indicator):
72
+ cdef public TimeSeries std
73
+ cdef double alpha, beta
74
+ cdef int T
75
+
76
+ cdef double _mean, _vstd, _var
77
+ cdef double mean, vstd, var
78
+ cdef long _i
79
+
80
+ cpdef double calculate(self, long long time, double value, short new_item_started)
81
+
82
+ cdef class PewmaOutliersDetector(Indicator):
83
+ cdef public TimeSeries upper, lower, outliers, std
84
+ cdef double alpha, beta, threshold
85
+ cdef int T
86
+ cdef str dist
87
+
88
+ cdef double student_t_df
89
+ cdef long _i
90
+ cdef double mean, vstd, variance
91
+ cdef double _mean, _vstd, _variance, _z_thr
92
+
93
+ cpdef double calculate(self, long long time, double x, short new_item_started)
94
+
95
+ cdef double _get_z_thr(self)
96
+ cdef double _get_alpha(self, double p_t)
97
+ cdef double _get_mean(self, double x, double alpha_t)
98
+ cdef double _get_variance(self, double x, double alpha_t)
99
+ cdef double _get_std(self, double variance, double mean)
100
+ cdef double _get_p(self, double x)
101
+
102
+ cdef class Psar(IndicatorOHLC):
103
+ cdef int _bull
104
+ cdef double _af
105
+ cdef double _psar
106
+ cdef double _lp
107
+ cdef double _hp
108
+
109
+ cdef int bull
110
+ cdef double af
111
+ cdef double psar
112
+ cdef double lp
113
+ cdef double hp
114
+
115
+ cdef public TimeSeries upper
116
+ cdef public TimeSeries lower
117
+
118
+ cdef double iaf
119
+ cdef double maxaf
120
+
121
+ cdef _store(self)
122
+ cdef _restore(self)
123
+
124
+ cpdef double calculate(self, long long time, Bar bar, short new_item_started)
125
+
126
+ cdef class Atr(IndicatorOHLC):
127
+ cdef short percentage
128
+ cdef TimeSeries tr
129
+ cdef Indicator ma
130
+
131
+ cpdef double calculate(self, long long time, Bar bar, short new_item_started)
132
+
133
+ cdef class Swings(IndicatorOHLC):
134
+ cdef double _min_l
135
+ cdef long long _min_t
136
+ cdef double _max_h
137
+ cdef long long _max_t
138
+ cdef OHLCV base
139
+ cdef Indicator trend
140
+
141
+ cdef object _trend_indicator
142
+ cdef object _indicator_args
143
+ # tops contain upper pivot point prices
144
+ # tops_detection_lag contain time lag when top was actually spotted
145
+ cdef public TimeSeries tops, tops_detection_lag
146
+ cdef public TimeSeries bottoms, bottoms_detection_lag
147
+ cdef public TimeSeries middles, deltas
148
+
149
+ cpdef double calculate(self, long long time, Bar bar, short new_item_started)
qubx/ta/indicators.pyi ADDED
@@ -0,0 +1,41 @@
1
+ from qubx.core.series import OHLCV, Indicator, TimeSeries, IndicatorOHLC
2
+
3
+ def sma(series: TimeSeries, period: int): ...
4
+ def ema(series: TimeSeries, period: int, init_mean: bool = True): ...
5
+ def tema(series: TimeSeries, period: int, init_mean: bool = True): ...
6
+ def dema(series: TimeSeries, period: int, init_mean: bool = True): ...
7
+ def kama(series: TimeSeries, period: int, fast_span: int = 2, slow_span: int = 30): ...
8
+ def highest(series: TimeSeries, period: int): ...
9
+ def lowest(series: TimeSeries, period: int): ...
10
+ def std(series: TimeSeries, period: int, mean=0): ...
11
+ def zscore(series: TimeSeries, period: int): ...
12
+ def pewma(series: TimeSeries, alpha: float, beta: float, T: int = 30): ...
13
+ def pewma_outliers_detector(series: TimeSeries, alpha: float, beta: float, T: int = 30, threshold=0.05, **kwargs): ...
14
+ def psar(series: OHLCV, iaf: float = 0.02, maxaf: float = 0.2): ...
15
+ def smooth(series: TimeSeries, smoother: str, *args, **kwargs) -> Indicator: ...
16
+ def atr(series: OHLCV, period: int = 14, smoother="sma", percentage: bool = False): ...
17
+ def swings(series: OHLCV, trend_indicator, **indicator_args) -> Indicator: ...
18
+
19
+ class Sma(Indicator):
20
+ def __init__(self, name: str, series: TimeSeries, period: int): ...
21
+
22
+ class Std(Indicator):
23
+ def __init__(self, name: str, series: TimeSeries, period: int): ...
24
+
25
+ class Zscore(Indicator):
26
+ def __init__(self, name: str, series: TimeSeries, period: int, smoother: str): ...
27
+
28
+ class Ema(Indicator):
29
+ def __init__(self, name: str, series: TimeSeries, period: int, init_mean: bool = True): ...
30
+
31
+ class Kama(Indicator):
32
+ def __init__(self, name: str, series: TimeSeries, period: int, fast_span: int = 2, slow_span: int = 30): ...
33
+
34
+ class Atr(IndicatorOHLC):
35
+ def __init__(self, name: str, series: OHLCV, period: int, smoother: str, percentage: bool): ...
36
+
37
+ class Swings(IndicatorOHLC):
38
+ tops: TimeSeries
39
+ bottoms: TimeSeries
40
+ middles: TimeSeries
41
+ deltas: TimeSeries