Qubx 3.17.3.dev2__tar.gz → 3.18.0__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.
Files changed (335) hide show
  1. {qubx-3.17.3.dev2 → qubx-3.18.0}/PKG-INFO +1 -1
  2. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/_version.py +2 -2
  3. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/ohlc.py +23 -5
  4. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/rate_limits.py +83 -0
  5. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/basics.py +31 -10
  6. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/processing.py +10 -2
  7. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/ccxt.py +8 -76
  8. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/indicator.py +11 -1
  9. {qubx-3.17.3.dev2 → qubx-3.18.0}/.gitignore +0 -0
  10. {qubx-3.17.3.dev2 → qubx-3.18.0}/LICENSE +0 -0
  11. {qubx-3.17.3.dev2 → qubx-3.18.0}/README.md +0 -0
  12. {qubx-3.17.3.dev2 → qubx-3.18.0}/pyproject.toml +0 -0
  13. {qubx-3.17.3.dev2 → qubx-3.18.0}/scripts/build.py +0 -0
  14. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/__init__.py +0 -0
  15. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/_nb_magic.py +0 -0
  16. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/__init__.py +0 -0
  17. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/connector.py +0 -0
  18. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/data.py +0 -0
  19. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/iteratedstream.py +0 -0
  20. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/management.py +0 -0
  21. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/ome.py +0 -0
  22. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/optimization.py +0 -0
  23. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/runner.py +0 -0
  24. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/sentinels.py +0 -0
  25. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/simulated_data.py +0 -0
  26. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/simulated_exchange.py +0 -0
  27. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/simulator.py +0 -0
  28. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/transfers.py +0 -0
  29. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/backtester/utils.py +0 -0
  30. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/__init__.py +0 -0
  31. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/commands.py +0 -0
  32. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/deploy.py +0 -0
  33. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/misc.py +0 -0
  34. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/release.py +0 -0
  35. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/resolver.py +0 -0
  36. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/s3.py +0 -0
  37. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/theme.py +0 -0
  38. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/tui.py +0 -0
  39. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/cli/user_config.py +0 -0
  40. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/config.py +0 -0
  41. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/__init__.py +0 -0
  42. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/__init__.py +0 -0
  43. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/adapters/__init__.py +0 -0
  44. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/adapters/polling_adapter.py +0 -0
  45. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/connection_manager.py +0 -0
  46. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/connector.py +0 -0
  47. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/data.py +0 -0
  48. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exceptions.py +0 -0
  49. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchange_manager.py +0 -0
  50. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/__init__.py +0 -0
  51. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/_two_stream.py +0 -0
  52. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/base.py +0 -0
  53. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/binance/connector.py +0 -0
  54. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/binance/exchange.py +0 -0
  55. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/bitfinex/bitfinex.py +0 -0
  56. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/bitfinex/connector.py +0 -0
  57. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/bybit/__init__.py +0 -0
  58. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/bybit/bybit.py +0 -0
  59. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/bybit/connector.py +0 -0
  60. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/gateio/__init__.py +0 -0
  61. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/gateio/gateio.py +0 -0
  62. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/hyperliquid/__init__.py +0 -0
  63. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/hyperliquid/hyperliquid.py +0 -0
  64. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/kraken/kraken.py +0 -0
  65. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/okx/__init__.py +0 -0
  66. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/okx/connector.py +0 -0
  67. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/exchanges/okx/okx.py +0 -0
  68. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/factory.py +0 -0
  69. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/__init__.py +0 -0
  70. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/base.py +0 -0
  71. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/factory.py +0 -0
  72. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/funding_rate.py +0 -0
  73. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/liquidation.py +0 -0
  74. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/open_interest.py +0 -0
  75. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/orderbook.py +0 -0
  76. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/quote.py +0 -0
  77. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/handlers/trade.py +0 -0
  78. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/plugin.py +0 -0
  79. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/subscription_config.py +0 -0
  80. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/subscription_manager.py +0 -0
  81. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/subscription_orchestrator.py +0 -0
  82. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/utils.py +0 -0
  83. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/ccxt/warmup_service.py +0 -0
  84. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/plugin.py +0 -0
  85. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/registry.py +0 -0
  86. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/tardis/data.py +0 -0
  87. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/tardis/plugin.py +0 -0
  88. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/connectors/tardis/utils.py +0 -0
  89. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/__init__.py +0 -0
  90. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/builtin.py +0 -0
  91. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/decorator.py +0 -0
  92. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/executor.py +0 -0
  93. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/interfaces.py +0 -0
  94. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/server.py +0 -0
  95. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/control/types.py +0 -0
  96. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/__init__.py +0 -0
  97. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/__init__.py +0 -0
  98. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/config.py +0 -0
  99. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/diffs.py +0 -0
  100. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/manager.py +0 -0
  101. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/reconciler.py +0 -0
  102. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/reducer.py +0 -0
  103. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/state.py +0 -0
  104. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/account_manager/state_machine.py +0 -0
  105. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/boot.py +0 -0
  106. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/connector.py +0 -0
  107. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/context.py +0 -0
  108. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/detectors/__init__.py +0 -0
  109. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/detectors/delisting.py +0 -0
  110. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/detectors/stale.py +0 -0
  111. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/errors.py +0 -0
  112. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/events.py +0 -0
  113. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/exceptions.py +0 -0
  114. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/fit_context.py +0 -0
  115. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/fit_executor.py +0 -0
  116. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/helpers.py +0 -0
  117. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/initializer.py +0 -0
  118. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/instrument_service.py +0 -0
  119. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/interfaces.py +0 -0
  120. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/loggers.py +0 -0
  121. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/lookups.py +0 -0
  122. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/metrics.py +0 -0
  123. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/__init__.py +0 -0
  124. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/instrument_service.py +0 -0
  125. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/market.py +0 -0
  126. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/subscription.py +0 -0
  127. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/trading.py +0 -0
  128. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/universe.py +0 -0
  129. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/mixins/utils.py +0 -0
  130. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/series.pxd +0 -0
  131. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/series.pyi +0 -0
  132. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/series.pyx +0 -0
  133. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/state_snapshot.py +0 -0
  134. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/status.py +0 -0
  135. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/subscription_watchdog.py +0 -0
  136. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/utils.pyi +0 -0
  137. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/core/utils.pyx +0 -0
  138. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/__init__.py +0 -0
  139. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/cache.py +0 -0
  140. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/containers.py +0 -0
  141. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/guards.py +0 -0
  142. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/registry.py +0 -0
  143. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storage.py +0 -0
  144. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/csv.py +0 -0
  145. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/handy.py +0 -0
  146. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/multi.py +0 -0
  147. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/questdb.py +0 -0
  148. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/stub.py +0 -0
  149. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/storages/utils.py +0 -0
  150. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/data/transformers.py +0 -0
  151. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/__init__.py +0 -0
  152. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/base.py +0 -0
  153. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/composite.py +0 -0
  154. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/csv.py +0 -0
  155. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/inmemory.py +0 -0
  156. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/prometheus.py +0 -0
  157. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/emitters/questdb.py +0 -0
  158. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/__init__.py +0 -0
  159. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/composite.py +0 -0
  160. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/formatters/__init__.py +0 -0
  161. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/formatters/base.py +0 -0
  162. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/formatters/incremental.py +0 -0
  163. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/formatters/slack.py +0 -0
  164. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/formatters/target_position.py +0 -0
  165. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/redis_streams.py +0 -0
  166. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/exporters/slack.py +0 -0
  167. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/gathering/simplest.py +0 -0
  168. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/health/__init__.py +0 -0
  169. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/health/base.py +0 -0
  170. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/health/dummy.py +0 -0
  171. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/health/status.py +0 -0
  172. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/__init__.py +0 -0
  173. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/csv.py +0 -0
  174. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/factory.py +0 -0
  175. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/inmemory.py +0 -0
  176. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/mongo.py +0 -0
  177. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/loggers/postgres.py +0 -0
  178. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/notifications/__init__.py +0 -0
  179. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/notifications/composite.py +0 -0
  180. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/notifications/slack.py +0 -0
  181. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/notifications/throttler.py +0 -0
  182. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/pandaz/__init__.py +0 -0
  183. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/pandaz/stats.py +0 -0
  184. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/pandaz/ta.py +0 -0
  185. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/pandaz/utils.py +0 -0
  186. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/plugins/__init__.py +0 -0
  187. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/plugins/loader.py +0 -0
  188. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/__init__.py +0 -0
  189. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/backend.py +0 -0
  190. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/config.py +0 -0
  191. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/engine.py +0 -0
  192. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/ip_resolver.py +0 -0
  193. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/manager.py +0 -0
  194. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/pools.py +0 -0
  195. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/redis_backend.py +0 -0
  196. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/rate_limiting/resilient.py +0 -0
  197. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/_build.py +0 -0
  198. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/crypto-fees.ini +0 -0
  199. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/hyperliquid-spot.json +0 -0
  200. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/hyperliquid.f-perpetual.json +0 -0
  201. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-binance-spot.json +0 -0
  202. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-binance.cm-future.json +0 -0
  203. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-binance.cm-perpetual.json +0 -0
  204. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-binance.um-future.json +0 -0
  205. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-binance.um-perpetual.json +0 -0
  206. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-bitfinex.f-perpetual.json +0 -0
  207. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-kraken-spot.json +0 -0
  208. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-kraken.f-future.json +0 -0
  209. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/resources/instruments/symbols-kraken.f-perpetual.json +0 -0
  210. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restarts/__init__.py +0 -0
  211. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restarts/state_resolvers.py +0 -0
  212. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restarts/time_finders.py +0 -0
  213. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/__init__.py +0 -0
  214. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/balance.py +0 -0
  215. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/factory.py +0 -0
  216. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/interfaces.py +0 -0
  217. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/position.py +0 -0
  218. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/signal.py +0 -0
  219. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/state.py +0 -0
  220. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/restorers/utils.py +0 -0
  221. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/state/__init__.py +0 -0
  222. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/state/dummy.py +0 -0
  223. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/state/redis.py +0 -0
  224. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/state/runtime_info.py +0 -0
  225. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/state/safe.py +0 -0
  226. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/ta/__init__.py +0 -0
  227. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/ta/indicators.pxd +0 -0
  228. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/ta/indicators.pyi +0 -0
  229. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/ta/indicators.pyx +0 -0
  230. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/__init__.py +0 -0
  231. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/base.py +0 -0
  232. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/accounts.toml.j2 +0 -0
  233. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/config.yml.j2 +0 -0
  234. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/jlive.sh.j2 +0 -0
  235. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/jpaper.sh.j2 +0 -0
  236. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/pyproject.toml.j2 +0 -0
  237. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/src/{{ strategy_name }}/__init__.py.j2 +0 -0
  238. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/src/{{ strategy_name }}/strategy.py.j2 +0 -0
  239. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/project/template.yml +0 -0
  240. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.claude/skills/qubx-cli/SKILL.md +0 -0
  241. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.claude/skills/qubx-indicators/SKILL.md +0 -0
  242. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.claude/skills/simulation-explorer/SKILL.md +0 -0
  243. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.claude/skills/strategy-release/SKILL.md +0 -0
  244. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.github/workflows/ci.yml.j2 +0 -0
  245. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.gitignore.j2 +0 -0
  246. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.python-version +0 -0
  247. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.vscode/launch.json +0 -0
  248. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.vscode/settings.json +0 -0
  249. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/.vscode/tasks.json +0 -0
  250. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/CLAUDE.md.j2 +0 -0
  251. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/README.md.j2 +0 -0
  252. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/configs/.gitkeep +0 -0
  253. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/justfile.j2 +0 -0
  254. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/pyproject.toml.j2 +0 -0
  255. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/research/.gitkeep +0 -0
  256. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/src/{{ strategy_name }}/__init__.py.j2 +0 -0
  257. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/src/{{ strategy_name }}/cli.py.j2 +0 -0
  258. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/src/{{ strategy_name }}/strategy.py.j2 +0 -0
  259. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/template.yml +0 -0
  260. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/repo/tests/test_strategy.py.j2 +0 -0
  261. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/__init__.py.j2 +0 -0
  262. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/accounts.toml.j2 +0 -0
  263. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/config.yml.j2 +0 -0
  264. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/jlive.sh.j2 +0 -0
  265. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/jpaper.sh.j2 +0 -0
  266. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/strategy.py.j2 +0 -0
  267. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/templates/simple/template.yml +0 -0
  268. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/__init__.py +0 -0
  269. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/advanced.py +0 -0
  270. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/composite.py +0 -0
  271. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/rebalancers.py +0 -0
  272. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/riskctrl.py +0 -0
  273. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/trackers/sizers.py +0 -0
  274. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/__init__.py +0 -0
  275. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/_pyxreloader.py +0 -0
  276. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/charting/lookinglass.py +0 -0
  277. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/charting/mpl_helpers.py +0 -0
  278. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/charting/orderbook.py +0 -0
  279. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/clock.py +0 -0
  280. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/collections.py +0 -0
  281. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/hft/__init__.py +0 -0
  282. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/hft/numba_utils.py +0 -0
  283. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/hft/orderbook.pyi +0 -0
  284. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/hft/orderbook.pyx +0 -0
  285. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/marketdata/binance.py +0 -0
  286. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/marketdata/ccxt.py +0 -0
  287. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/marketdata/dukas.py +0 -0
  288. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/misc.py +0 -0
  289. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/nonce.py +0 -0
  290. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/numbers_utils.py +0 -0
  291. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/orderbook.py +0 -0
  292. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/__init__.py +0 -0
  293. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/dashboard.py +0 -0
  294. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/data.py +0 -0
  295. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/interfaces.py +0 -0
  296. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/renderers/__init__.py +0 -0
  297. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/plotting/renderers/plotly.py +0 -0
  298. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/questdb.py +0 -0
  299. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/rate_limiter.py +0 -0
  300. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/results.py +0 -0
  301. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/ringbuffer.pxd +0 -0
  302. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/ringbuffer.pyi +0 -0
  303. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/ringbuffer.pyx +0 -0
  304. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/__init__.py +0 -0
  305. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/_jupyter_runner.pyt +0 -0
  306. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/accounts.py +0 -0
  307. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/configs.py +0 -0
  308. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/factory.py +0 -0
  309. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/kernel_service.py +0 -0
  310. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/runner.py +0 -0
  311. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/__init__.py +0 -0
  312. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/app.py +0 -0
  313. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/handlers.py +0 -0
  314. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/init_code.py +0 -0
  315. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/kernel.py +0 -0
  316. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/styles.tcss +0 -0
  317. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/__init__.py +0 -0
  318. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/account_summary.py +0 -0
  319. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/command_input.py +0 -0
  320. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/debug_log.py +0 -0
  321. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/log_filter.py +0 -0
  322. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/orders_table.py +0 -0
  323. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/positions_table.py +0 -0
  324. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/quotes_table.py +0 -0
  325. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/runner/textual/widgets/repl_output.py +0 -0
  326. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/s3.py +0 -0
  327. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/slack.py +0 -0
  328. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/threading.py +0 -0
  329. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/throttler.py +0 -0
  330. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/time.py +0 -0
  331. {qubx-3.17.3.dev2 → qubx-3.18.0}/src/qubx/utils/websocket_manager.py +0 -0
  332. {qubx-3.17.3.dev2 → qubx-3.18.0}/tests/strategies/macd_crossover/src/macd_crossover/indicators/macd.py +0 -0
  333. {qubx-3.17.3.dev2 → qubx-3.18.0}/tests/strategies/macd_crossover/src/macd_crossover/models/macd_crossover.py +0 -0
  334. {qubx-3.17.3.dev2 → qubx-3.18.0}/tests/strategies/macd_crossover/src/macd_crossover/models/utils.py +0 -0
  335. {qubx-3.17.3.dev2 → qubx-3.18.0}/tests/strategies/obi_trader/src/obi_trader/models/obi_trader.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: Qubx
3
- Version: 3.17.3.dev2
3
+ Version: 3.18.0
4
4
  Summary: Qubx - Quantitative Trading Framework
5
5
  Project-URL: homepage, https://xlydian.com
6
6
  Project-URL: repository, https://github.com/xLydianSoftware/Qubx
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '3.17.3.dev2'
22
- __version_tuple__ = version_tuple = (3, 17, 3, 'dev2')
21
+ __version__ = version = '3.18.0'
22
+ __version_tuple__ = version_tuple = (3, 18, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -14,6 +14,7 @@ from qubx.core.exceptions import NotSupported
14
14
  from qubx.core.series import Bar, Quote
15
15
  from qubx.utils.time import to_timedelta
16
16
 
17
+ from ..rate_limits import retryable_fetch
17
18
  from ..subscription_config import SubscriptionConfiguration
18
19
  from ..utils import ccxt_find_instrument, create_market_type_batched_subscriber, instrument_to_ccxt_symbol
19
20
  from .base import BaseDataTypeHandler
@@ -31,6 +32,23 @@ class OhlcDataHandler(BaseDataTypeHandler):
31
32
  def data_type(self) -> str:
32
33
  return "ohlc"
33
34
 
35
+ async def _fetch_ohlcv_page(self, symbol: str, timeframe: str, since: int, limit: int) -> list:
36
+ """One kline page, retried once on a venue refusal.
37
+
38
+ The retry is paced by the gate the reported hit closes, so it is only armed when a
39
+ limiter is attached — an unpaced re-send is worse than none on a venue already
40
+ refusing. One attempt, not the helper's default five: ``get_ohlc`` blocks the caller
41
+ on a 60s future, which five gate waits would blow.
42
+ """
43
+ limiter = self._exchange_manager.rate_limiter
44
+ return await retryable_fetch(
45
+ # read the exchange late: a one-shot REST path must follow a recreation
46
+ lambda: self._exchange_manager.exchange.fetch_ohlcv(symbol, timeframe, since=since, limit=limit),
47
+ rate_limiter=limiter,
48
+ max_attempts=2 if limiter is not None else 1,
49
+ context=f"{self._exchange_id} {symbol} {timeframe}",
50
+ )
51
+
34
52
  def prepare_subscription(
35
53
  self,
36
54
  name: str,
@@ -107,11 +125,11 @@ class OhlcDataHandler(BaseDataTypeHandler):
107
125
  # Paginate: exchanges may return fewer bars than requested per call
108
126
  ohlcv_map: dict[int, list] = {}
109
127
  while len(ohlcv_map) < nbarsback:
110
- batch = await self._exchange_manager.exchange.fetch_ohlcv(
128
+ batch = await self._fetch_ohlcv_page(
111
129
  ccxt_symbol,
112
130
  exch_timeframe,
113
- since=start_since,
114
- limit=min(nbarsback - len(ohlcv_map), self.MAX_BARS_PER_REQUEST_FOR_PROVIDER) + 1,
131
+ start_since,
132
+ min(nbarsback - len(ohlcv_map), self.MAX_BARS_PER_REQUEST_FOR_PROVIDER) + 1,
115
133
  )
116
134
  if not batch:
117
135
  break
@@ -176,8 +194,8 @@ class OhlcDataHandler(BaseDataTypeHandler):
176
194
  while len(loaded_bars) < nbarsback:
177
195
  bars_to_request = min((nbarsback - len(loaded_bars)), self.MAX_BARS_PER_REQUEST_FOR_PROVIDER)
178
196
  if not (
179
- ohlcv_data := await self._exchange_manager.exchange.fetch_ohlcv(
180
- ccxt_symbol, exch_timeframe, since=start_since, limit=bars_to_request + 1
197
+ ohlcv_data := await self._fetch_ohlcv_page(
198
+ ccxt_symbol, exch_timeframe, start_since, bars_to_request + 1
181
199
  )
182
200
  ):
183
201
  break
@@ -16,8 +16,14 @@ References:
16
16
  - Bybit: https://bybit-exchange.github.io/docs/v5/rate-limit
17
17
  """
18
18
 
19
+ import asyncio
20
+ import random
21
+ from collections.abc import Awaitable, Callable
22
+ from typing import Any
19
23
  from weakref import WeakKeyDictionary
20
24
 
25
+ import ccxt
26
+
21
27
  from qubx import logger
22
28
  from qubx.rate_limiting import EndpointCosts, ExchangeRateLimitConfig, PoolConfig
23
29
 
@@ -429,3 +435,80 @@ def install_rate_limiter_hooks(exchange, rate_limiter, label: str = "") -> None:
429
435
  return original_on_rest(code, reason, url, method, headers, body, req_headers, req_body)
430
436
 
431
437
  exchange.on_rest_response = _header_sync_hook
438
+
439
+
440
+ _T = Any # explicit alias keeps the retry helper signature readable
441
+
442
+ # retry defaults — conservative. tuned for warmup OHLCV bursts where transient
443
+ # RateLimitExceeded / NetworkError are the dominant failure modes (see #264).
444
+ _RETRY_MAX_ATTEMPTS = 5
445
+ _RETRY_BASE_DELAY_S = 1.0
446
+ _RETRY_MAX_DELAY_S = 30.0
447
+ _RETRY_JITTER_S = 1.0
448
+
449
+
450
+ async def retryable_fetch(
451
+ call: Callable[[], Awaitable[_T]],
452
+ *,
453
+ rate_limiter: Any = None,
454
+ rate_limit_pool: str = "ccxt_rest",
455
+ max_attempts: int = _RETRY_MAX_ATTEMPTS,
456
+ base_delay: float = _RETRY_BASE_DELAY_S,
457
+ max_delay: float = _RETRY_MAX_DELAY_S,
458
+ jitter: float = _RETRY_JITTER_S,
459
+ context: str = "",
460
+ sleep: Callable[[float], Awaitable[None]] = asyncio.sleep,
461
+ ) -> _T:
462
+ """
463
+ Invoke ``call()`` with exponential backoff + jitter on transient CCXT errors.
464
+
465
+ Retryable errors:
466
+ * ``ccxt.RateLimitExceeded`` — exchange-level 429 / OKX 50011.
467
+ * ``ccxt.NetworkError`` (parent; also covers ``ExchangeNotAvailable``
468
+ and ``OnMaintenance``).
469
+ * ``asyncio.TimeoutError``.
470
+
471
+ Everything else (``ccxt.ExchangeError`` and subclasses like ``BadSymbol``,
472
+ ``AuthenticationError``, plus any non-CCXT exception) is re-raised
473
+ immediately — permanent errors should not consume retry budget.
474
+
475
+ Budget is acquired inside CCXT's own pipeline by the throttle hook, not here; this function only
476
+ reports ``RateLimitExceeded`` back so the pool's gate closes for ``cooldown`` seconds.
477
+
478
+ Args:
479
+ call: Zero-arg callable returning the coroutine to invoke.
480
+ rate_limiter: Optional ``ExchangeRateLimiter``; if provided, rate-limit
481
+ hits are reported back to it.
482
+ rate_limit_pool: Pool whose gate is closed on ``RateLimitExceeded``.
483
+ max_attempts: Total attempts including the initial one.
484
+ base_delay: First retry delay in seconds; doubles each attempt.
485
+ max_delay: Cap on the exponential delay.
486
+ jitter: Uniform jitter (0..jitter) added to each delay.
487
+ context: Short human label included in log lines (e.g. ``"OKX BTCUSDT"``).
488
+ sleep: Async sleep function (injectable for tests).
489
+
490
+ Raises:
491
+ The last retryable exception once ``max_attempts`` is exhausted.
492
+ """
493
+ last_exc: BaseException | None = None
494
+ for attempt in range(1, max_attempts + 1):
495
+ try:
496
+ return await call()
497
+ except (ccxt.NetworkError, asyncio.TimeoutError) as e:
498
+ last_exc = e
499
+ if isinstance(e, ccxt.RateLimitExceeded) and rate_limiter is not None:
500
+ rate_limiter.report_limit_hit(
501
+ pool_name=rate_limit_pool,
502
+ reason=(f"{context}: " if context else "") + str(e)[:120],
503
+ )
504
+ if attempt >= max_attempts:
505
+ break
506
+ delay = min(base_delay * (2 ** (attempt - 1)), max_delay) + random.uniform(0, jitter)
507
+ logger.warning(
508
+ f"[CCXT] transient error on {context or 'fetch'} "
509
+ f"(attempt {attempt}/{max_attempts}): {type(e).__name__}: {e}; "
510
+ f"retrying in {delay:.2f}s"
511
+ )
512
+ await sleep(delay)
513
+ assert last_exc is not None # unreachable: the loop always raises or returns
514
+ raise last_exc
@@ -328,6 +328,25 @@ class MarketType(StrEnum):
328
328
  INDEX = "INDEX"
329
329
 
330
330
 
331
+ # fixed multiplier set, not any digit run (1INCH, 10Y, KODEX200 survive); the lookahead rejects
332
+ # a bare "1000", which would otherwise strip to ""
333
+ _MULTIPLIER_PREFIX = re.compile(r"^1(0{3,7})(?=[A-Z])")
334
+ _MULTIPLIER_SUFFIX = re.compile(r"^(.+[A-Z])1000$")
335
+
336
+
337
+ def multiplier_coin(base: str) -> str:
338
+ """The coin under a multiplier contract: 1000PEPE, 10000SATS, SHIB1000 -> PEPE, SATS, SHIB.
339
+
340
+ The multiplier itself is not recoverable from the result, so this names the coin, never a
341
+ tradeable unit: 1000PEPE and 10000PEPE both answer PEPE.
342
+ """
343
+ if m := _MULTIPLIER_PREFIX.match(base):
344
+ return base[m.end() :]
345
+ if m := _MULTIPLIER_SUFFIX.match(base):
346
+ return m.group(1)
347
+ return base
348
+
349
+
331
350
  @dataclass(order=True)
332
351
  class Instrument:
333
352
  """
@@ -382,12 +401,7 @@ class Instrument:
382
401
 
383
402
  @property
384
403
  def asset(self) -> str:
385
- if self.base.startswith("1000"):
386
- return self.base.replace("1000", "")
387
- elif self.base.startswith("1000000"):
388
- return self.base.replace("1000000", "")
389
- else:
390
- return self.base
404
+ return multiplier_coin(self.base)
391
405
 
392
406
  def is_futures(self) -> bool:
393
407
  return self.market_type in [MarketType.FUTURE, MarketType.SWAP]
@@ -1984,13 +1998,11 @@ class InstrumentsLookup:
1984
1998
  - as_of is a string in format YYYY-MM-DD or pd.Timestamp or None
1985
1999
  """
1986
2000
  _limit_time = pd.Timestamp(as_of) if as_of else None
1987
- return [
2001
+ matched = [
1988
2002
  i
1989
2003
  for i in self.get_lookup().values()
1990
2004
  if i.exchange == exchange
1991
- and (
1992
- base is None or (i.base == base or i.base == f"1000{base}")
1993
- ) # this is a hack to support 1000DOGEUSDT and others
2005
+ and (base is None or i.base == base or multiplier_coin(i.base) == base)
1994
2006
  and (quote is None or i.quote == quote)
1995
2007
  and (market_type is None or i.market_type == market_type)
1996
2008
  and (
@@ -2002,6 +2014,15 @@ class InstrumentsLookup:
2002
2014
  or (i.delist_date is None or pd.Timestamp(i.delist_date).tz_localize(None) >= _limit_time)
2003
2015
  )
2004
2016
  ]
2017
+ if base is not None:
2018
+ aliases = sorted({i.base for i in matched} - {base})
2019
+ if aliases and any(i.base == base for i in matched):
2020
+ logger.warning(
2021
+ f"[lookup] {exchange} base <y>{base}</y> also matches {aliases} through a contract "
2022
+ f"multiplier; the exact base is listed first — pass the venue base to disambiguate"
2023
+ )
2024
+ matched.sort(key=lambda i: i.base != base)
2025
+ return matched
2005
2026
 
2006
2027
  def find_aux_instrument_for(
2007
2028
  self, instrument: Instrument, base_currency: str, market_type: MarketType | None = None
@@ -1486,25 +1486,33 @@ class ProcessingManager(IProcessingManager):
1486
1486
  _fit_is_running. Returning None hands control to
1487
1487
  _run_strategy_pipeline, which processes the drained signals immediately.
1488
1488
  """
1489
+ # A raised op leaves the mutation it was replaying half-applied — set_universe adds the
1490
+ # subscriptions before on_universe_change, so a failure there subscribes the instruments
1491
+ # but never updates ctx.instruments. Latching success on that trades a stale universe
1492
+ # until the next fit, so a replay failure fails the fit.
1493
+ replay_error: BaseException | None = None
1489
1494
  try:
1490
1495
  for op in commit.ops:
1491
1496
  try:
1492
1497
  op()
1493
1498
  except Exception as op_error:
1499
+ replay_error = replay_error or op_error
1494
1500
  logger.error(f"[{self.__class__.__name__}] :: deferred fit operation failed: {op_error}")
1495
1501
  logger.opt(colors=False).error(traceback.format_exc())
1496
1502
  try:
1497
1503
  self._subscription_manager.commit() # apply pending operations (mirrors __invoke_on_fit)
1498
1504
  except Exception as commit_error:
1505
+ replay_error = replay_error or commit_error
1499
1506
  logger.error(f"[{self.__class__.__name__}] :: post-fit subscription commit failed: {commit_error}")
1500
1507
  logger.opt(colors=False).error(traceback.format_exc())
1501
1508
  finally:
1502
1509
  if commit.signals:
1503
1510
  self._emitted_signals.extend(commit.signals)
1504
- if commit.error is None:
1511
+ failed = commit.error is not None or replay_error is not None
1512
+ if not failed:
1505
1513
  self._context._strategy_state.is_on_fit_called = True
1506
1514
  self._fit_is_running = False
1507
- self._report_boot_fit(commit.error is None)
1515
+ self._report_boot_fit(not failed)
1508
1516
 
1509
1517
  def _handle_subscription_swap(self, instrument: Instrument | None, event_type: str, apply_swap: Callable) -> None:
1510
1518
  """Apply a deferred subscription commit's swap on the ProcessorThread. Posted by
@@ -35,11 +35,9 @@ Supported data types
35
35
  from __future__ import annotations
36
36
 
37
37
  import asyncio
38
- import random
39
- from collections.abc import Awaitable, Callable, Iterator
38
+ from collections.abc import Callable, Iterator
40
39
  from typing import Any, cast
41
40
 
42
- import ccxt
43
41
  import numpy as np
44
42
  import pandas as pd
45
43
  import pyarrow as pa
@@ -274,10 +272,9 @@ class CcxtReader(IReader):
274
272
  pass
275
273
 
276
274
 
277
- _T = Any # explicit alias keeps the retry helper signature readable
278
-
279
- # retry defaults — conservative. tuned for warmup OHLCV bursts where transient
280
- # RateLimitExceeded / NetworkError are the dominant failure modes (see #264).
275
+ # retry defaults for this storage's OHLCV bursts (see #264). Mirrors the helper's own
276
+ # fallbacks in connectors.ccxt.rate_limits — these are ctor defaults, so they cannot be
277
+ # resolved lazily like the import below.
281
278
  _RETRY_MAX_ATTEMPTS = 5
282
279
  _RETRY_BASE_DELAY_S = 1.0
283
280
  _RETRY_MAX_DELAY_S = 30.0
@@ -306,73 +303,6 @@ class CcxtFetchExhausted(RuntimeError):
306
303
  )
307
304
 
308
305
 
309
- async def _retryable_fetch(
310
- call: Callable[[], Awaitable[_T]],
311
- *,
312
- rate_limiter: Any = None,
313
- rate_limit_pool: str = "ccxt_rest",
314
- max_attempts: int = _RETRY_MAX_ATTEMPTS,
315
- base_delay: float = _RETRY_BASE_DELAY_S,
316
- max_delay: float = _RETRY_MAX_DELAY_S,
317
- jitter: float = _RETRY_JITTER_S,
318
- context: str = "",
319
- sleep: Callable[[float], Awaitable[None]] = asyncio.sleep,
320
- ) -> _T:
321
- """
322
- Invoke ``call()`` with exponential backoff + jitter on transient CCXT errors.
323
-
324
- Retryable errors:
325
- * ``ccxt.RateLimitExceeded`` — exchange-level 429 / OKX 50011.
326
- * ``ccxt.NetworkError`` (parent; also covers ``ExchangeNotAvailable``
327
- and ``OnMaintenance``).
328
- * ``asyncio.TimeoutError``.
329
-
330
- Everything else (``ccxt.ExchangeError`` and subclasses like ``BadSymbol``,
331
- ``AuthenticationError``, plus any non-CCXT exception) is re-raised
332
- immediately — permanent errors should not consume retry budget.
333
-
334
- Budget is acquired inside CCXT's own pipeline by the throttle hook, not here; this function only
335
- reports ``RateLimitExceeded`` back so the pool's gate closes for ``cooldown`` seconds.
336
-
337
- Args:
338
- call: Zero-arg callable returning the coroutine to invoke.
339
- rate_limiter: Optional ``ExchangeRateLimiter``; if provided, rate-limit
340
- hits are reported back to it.
341
- rate_limit_pool: Pool whose gate is closed on ``RateLimitExceeded``.
342
- max_attempts: Total attempts including the initial one.
343
- base_delay: First retry delay in seconds; doubles each attempt.
344
- max_delay: Cap on the exponential delay.
345
- jitter: Uniform jitter (0..jitter) added to each delay.
346
- context: Short human label included in log lines (e.g. ``"OKX BTCUSDT"``).
347
- sleep: Async sleep function (injectable for tests).
348
-
349
- Raises:
350
- The last retryable exception once ``max_attempts`` is exhausted.
351
- """
352
- last_exc: BaseException | None = None
353
- for attempt in range(1, max_attempts + 1):
354
- try:
355
- return await call()
356
- except (ccxt.NetworkError, asyncio.TimeoutError) as e:
357
- last_exc = e
358
- if isinstance(e, ccxt.RateLimitExceeded) and rate_limiter is not None:
359
- rate_limiter.report_limit_hit(
360
- pool_name=rate_limit_pool,
361
- reason=(f"{context}: " if context else "") + str(e)[:120],
362
- )
363
- if attempt >= max_attempts:
364
- break
365
- delay = min(base_delay * (2 ** (attempt - 1)), max_delay) + random.uniform(0, jitter)
366
- logger.warning(
367
- f"[CCXT] transient error on {context or 'fetch'} "
368
- f"(attempt {attempt}/{max_attempts}): {type(e).__name__}: {e}; "
369
- f"retrying in {delay:.2f}s"
370
- )
371
- await sleep(delay)
372
- assert last_exc is not None # unreachable: the loop always raises or returns
373
- raise last_exc
374
-
375
-
376
306
  @storage("ccxt")
377
307
  class CcxtStorage(IStorage):
378
308
  """
@@ -600,7 +530,7 @@ class CcxtStorage(IStorage):
600
530
  current_since = since
601
531
 
602
532
  # Budget acquisition and header sync happen inside CCXT via the hooks installed by
603
- # ``_ensure_exchange``; retry + backoff are encapsulated in ``_retryable_fetch``.
533
+ # ``_ensure_exchange``; retry + backoff are encapsulated in ``retryable_fetch``.
604
534
  _rl = self._get_rate_limiter(ccxt_ex)
605
535
  _ex_id = getattr(ccxt_ex, "id", "ccxt")
606
536
 
@@ -610,7 +540,9 @@ class CcxtStorage(IStorage):
610
540
  async def _do_page() -> list:
611
541
  return await method(since=_since, limit=limit, **method_kwargs)
612
542
 
613
- batch = await _retryable_fetch(
543
+ from qubx.connectors.ccxt.rate_limits import retryable_fetch
544
+
545
+ batch = await retryable_fetch(
614
546
  _do_page,
615
547
  rate_limiter=_rl,
616
548
  max_attempts=self._retry_max_attempts,
@@ -24,6 +24,9 @@ class IndicatorEmitter(Indicator):
24
24
  of when certain calculation methods are called. For example, you might want to
25
25
  emit ATR values on every update, not just when calculate_risks() is called.
26
26
 
27
+ Only updates are emitted: the history an indicator already holds when the wrapper
28
+ attaches is replayed into the wrapper but never sent to the metric emitter.
29
+
27
30
  Example:
28
31
  # Create ATR indicator
29
32
  volatility = atr(ohlc_series, period=14, smoother="sma")
@@ -91,6 +94,13 @@ class IndicatorEmitter(Indicator):
91
94
  if not np.isfinite(current_value):
92
95
  current_value = np.nan
93
96
 
97
+ # Attaching to an indicator that already carries history replays that history through
98
+ # calculate() with the original bar times. Those values are not updates: emitted, they
99
+ # land in the store back-dated by the depth of the buffer (a whole warmup window after
100
+ # every restart) and force it to rewrite closed partitions.
101
+ if self.is_initial_recalculate:
102
+ return current_value
103
+
94
104
  # Decide whether to emit based on our configuration
95
105
  should_emit = False
96
106
 
@@ -102,7 +112,7 @@ class IndicatorEmitter(Indicator):
102
112
  if new_item_started and len(self._wrapped_indicator) >= 2:
103
113
  should_emit = True
104
114
  # Use the previous (completed) value, not the current one
105
- current_value = self._wrapped_indicator[1] if not self.is_initial_recalculate else value
115
+ current_value = self._wrapped_indicator[1]
106
116
 
107
117
  # Emit if we should and the value is valid
108
118
  if should_emit and not np.isnan(current_value):
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