Qubx 3.17.3.dev3__tar.gz → 3.19.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.
- {qubx-3.17.3.dev3 → qubx-3.19.0}/PKG-INFO +3 -5
- {qubx-3.17.3.dev3 → qubx-3.19.0}/README.md +0 -4
- {qubx-3.17.3.dev3 → qubx-3.19.0}/pyproject.toml +4 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/_version.py +2 -2
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/__init__.py +6 -1
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/cache.py +223 -9
- qubx-3.19.0/src/qubx/data/storages/dukascopy.py +764 -0
- qubx-3.19.0/src/qubx/data/storages/yahoo.py +415 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/indicator.py +11 -1
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/misc.py +12 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/rate_limiter.py +45 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/.gitignore +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/LICENSE +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/scripts/build.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/_nb_magic.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/data.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/iteratedstream.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/management.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/ome.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/optimization.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/runner.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/sentinels.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/simulated_data.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/simulated_exchange.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/simulator.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/transfers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/backtester/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/commands.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/deploy.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/misc.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/release.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/resolver.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/s3.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/theme.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/tui.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/cli/user_config.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/config.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/adapters/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/adapters/polling_adapter.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/connection_manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/data.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exceptions.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchange_manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/_two_stream.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/binance/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/binance/exchange.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/bitfinex/bitfinex.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/bitfinex/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/bybit/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/bybit/bybit.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/bybit/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/gateio/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/gateio/gateio.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/hyperliquid/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/hyperliquid/hyperliquid.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/kraken/kraken.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/okx/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/okx/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/exchanges/okx/okx.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/factory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/factory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/funding_rate.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/liquidation.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/ohlc.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/open_interest.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/orderbook.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/quote.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/handlers/trade.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/plugin.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/rate_limits.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/subscription_config.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/subscription_manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/subscription_orchestrator.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/ccxt/warmup_service.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/plugin.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/registry.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/tardis/data.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/tardis/plugin.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/connectors/tardis/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/builtin.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/decorator.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/executor.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/interfaces.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/server.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/control/types.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/config.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/diffs.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/reconciler.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/reducer.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/state.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/account_manager/state_machine.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/basics.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/boot.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/connector.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/context.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/detectors/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/detectors/delisting.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/detectors/stale.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/errors.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/events.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/exceptions.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/fit_context.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/fit_executor.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/helpers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/initializer.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/instrument_service.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/interfaces.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/loggers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/lookups.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/metrics.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/instrument_service.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/market.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/processing.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/subscription.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/trading.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/universe.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/mixins/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/series.pxd +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/series.pyi +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/series.pyx +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/state_snapshot.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/status.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/subscription_watchdog.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/utils.pyi +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/core/utils.pyx +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/containers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/guards.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/registry.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storage.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/ccxt.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/csv.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/handy.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/multi.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/questdb.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/stub.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/storages/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/data/transformers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/composite.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/csv.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/inmemory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/prometheus.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/emitters/questdb.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/composite.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/formatters/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/formatters/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/formatters/incremental.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/formatters/slack.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/formatters/target_position.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/redis_streams.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/exporters/slack.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/gathering/simplest.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/health/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/health/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/health/dummy.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/health/status.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/csv.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/factory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/inmemory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/mongo.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/loggers/postgres.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/notifications/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/notifications/composite.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/notifications/slack.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/notifications/throttler.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/pandaz/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/pandaz/stats.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/pandaz/ta.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/pandaz/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/plugins/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/plugins/loader.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/backend.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/config.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/engine.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/ip_resolver.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/pools.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/redis_backend.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/rate_limiting/resilient.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/_build.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/crypto-fees.ini +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/hyperliquid-spot.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/hyperliquid.f-perpetual.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-binance-spot.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-binance.cm-future.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-binance.cm-perpetual.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-binance.um-future.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-binance.um-perpetual.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-bitfinex.f-perpetual.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-kraken-spot.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-kraken.f-future.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/resources/instruments/symbols-kraken.f-perpetual.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restarts/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restarts/state_resolvers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restarts/time_finders.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/balance.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/factory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/interfaces.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/position.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/signal.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/state.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/restorers/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/state/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/state/dummy.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/state/redis.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/state/runtime_info.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/state/safe.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/ta/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/ta/indicators.pxd +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/ta/indicators.pyi +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/ta/indicators.pyx +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/base.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/accounts.toml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/config.yml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/jlive.sh.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/jpaper.sh.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/pyproject.toml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/src/{{ strategy_name }}/__init__.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/src/{{ strategy_name }}/strategy.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/project/template.yml +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.claude/skills/qubx-cli/SKILL.md +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.claude/skills/qubx-indicators/SKILL.md +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.claude/skills/simulation-explorer/SKILL.md +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.claude/skills/strategy-release/SKILL.md +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.github/workflows/ci.yml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.gitignore.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.python-version +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.vscode/launch.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.vscode/settings.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/.vscode/tasks.json +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/CLAUDE.md.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/README.md.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/configs/.gitkeep +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/justfile.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/pyproject.toml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/research/.gitkeep +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/src/{{ strategy_name }}/__init__.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/src/{{ strategy_name }}/cli.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/src/{{ strategy_name }}/strategy.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/template.yml +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/repo/tests/test_strategy.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/__init__.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/accounts.toml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/config.yml.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/jlive.sh.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/jpaper.sh.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/strategy.py.j2 +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/templates/simple/template.yml +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/advanced.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/composite.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/rebalancers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/riskctrl.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/trackers/sizers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/_pyxreloader.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/charting/lookinglass.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/charting/mpl_helpers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/charting/orderbook.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/clock.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/collections.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/hft/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/hft/numba_utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/hft/orderbook.pyi +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/hft/orderbook.pyx +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/marketdata/binance.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/marketdata/ccxt.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/marketdata/dukas.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/nonce.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/numbers_utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/orderbook.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/dashboard.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/data.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/interfaces.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/renderers/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/plotting/renderers/plotly.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/questdb.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/results.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/ringbuffer.pxd +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/ringbuffer.pyi +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/ringbuffer.pyx +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/_jupyter_runner.pyt +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/accounts.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/configs.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/factory.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/kernel_service.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/runner.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/app.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/handlers.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/init_code.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/kernel.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/styles.tcss +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/__init__.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/account_summary.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/command_input.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/debug_log.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/log_filter.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/orders_table.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/positions_table.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/quotes_table.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/runner/textual/widgets/repl_output.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/s3.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/slack.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/threading.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/throttler.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/time.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/src/qubx/utils/websocket_manager.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/tests/strategies/macd_crossover/src/macd_crossover/indicators/macd.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/tests/strategies/macd_crossover/src/macd_crossover/models/macd_crossover.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.0}/tests/strategies/macd_crossover/src/macd_crossover/models/utils.py +0 -0
- {qubx-3.17.3.dev3 → qubx-3.19.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.
|
|
3
|
+
Version: 3.19.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
|
|
@@ -67,6 +67,8 @@ Requires-Dist: dash-bootstrap-components<2,>=1.6.0; extra == 'viz'
|
|
|
67
67
|
Requires-Dist: dash<3,>=2.18.2; extra == 'viz'
|
|
68
68
|
Requires-Dist: matplotlib<4,>=3.8.4; extra == 'viz'
|
|
69
69
|
Requires-Dist: plotly<6,>=5.22.0; extra == 'viz'
|
|
70
|
+
Provides-Extra: yahoo
|
|
71
|
+
Requires-Dist: yfinance>=0.2.54; extra == 'yahoo'
|
|
70
72
|
Description-Content-Type: text/markdown
|
|
71
73
|
|
|
72
74
|
# Qubx - Quantitative Trading Framework
|
|
@@ -216,10 +218,6 @@ just test
|
|
|
216
218
|
- Build package: `just build`
|
|
217
219
|
- Run verbose tests: `just test-verbose`
|
|
218
220
|
|
|
219
|
-
## In Production
|
|
220
|
-
|
|
221
|
-
Qubx powers the [AllegedAlpha](https://app.lighter.xyz/public-pools/281474976625478) public pool on Lighter. Public pools allow users to deposit funds from their blockchain wallet into a smart contract. The pool operator manages the trading strategy, and a performance fee is taken from profits (X: [@allegedalpha](https://x.com/allegedalpha)).
|
|
222
|
-
|
|
223
221
|
## About xLydian
|
|
224
222
|
|
|
225
223
|
Qubx is developed by [xLydian](https://xlydian.com/).
|
|
@@ -145,10 +145,6 @@ just test
|
|
|
145
145
|
- Build package: `just build`
|
|
146
146
|
- Run verbose tests: `just test-verbose`
|
|
147
147
|
|
|
148
|
-
## In Production
|
|
149
|
-
|
|
150
|
-
Qubx powers the [AllegedAlpha](https://app.lighter.xyz/public-pools/281474976625478) public pool on Lighter. Public pools allow users to deposit funds from their blockchain wallet into a smart contract. The pool operator manages the trading strategy, and a performance fee is taken from profits (X: [@allegedalpha](https://x.com/allegedalpha)).
|
|
151
|
-
|
|
152
148
|
## About xLydian
|
|
153
149
|
|
|
154
150
|
Qubx is developed by [xLydian](https://xlydian.com/).
|
|
@@ -104,6 +104,10 @@ connectors = ["ccxt>=4.5.46,<5"]
|
|
|
104
104
|
binance = ["python-binance>=1.0.19,<2"]
|
|
105
105
|
# - - - Bitfinex-specific (custom API client) - - -
|
|
106
106
|
bitfinex = ["qubx-bitfinex-api>=3.0.7,<4"]
|
|
107
|
+
# - - - Yahoo Finance data (qubx.data.storages.yahoo) - - -
|
|
108
|
+
# - Yahoo rejects plain HTTP clients (429 even with browser headers and a session cookie);
|
|
109
|
+
# - yfinance carries the browser-impersonation machinery that gets past it.
|
|
110
|
+
yahoo = ["yfinance>=0.2.54"]
|
|
107
111
|
# - - - Visualization & charting - - -
|
|
108
112
|
viz = [
|
|
109
113
|
"matplotlib>=3.8.4,<4",
|
|
@@ -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.
|
|
22
|
-
__version_tuple__ = version_tuple = (3,
|
|
21
|
+
__version__ = version = '3.19.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (3, 19, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -11,14 +11,19 @@ __all__ = [
|
|
|
11
11
|
# - new IStorage-based cache layer -
|
|
12
12
|
"ICache",
|
|
13
13
|
"MemoryCache",
|
|
14
|
+
"ParquetCache",
|
|
14
15
|
"CachedReader",
|
|
15
16
|
"CachedStorage",
|
|
17
|
+
"YahooStorage",
|
|
18
|
+
"DukascopyStorage",
|
|
16
19
|
]
|
|
17
20
|
|
|
18
|
-
from .cache import CachedReader, CachedStorage, ICache, MemoryCache
|
|
21
|
+
from .cache import CachedReader, CachedStorage, ICache, MemoryCache, ParquetCache
|
|
19
22
|
from .storages.ccxt import CcxtStorage
|
|
20
23
|
from .storages.csv import CsvStorage
|
|
24
|
+
from .storages.dukascopy import DukascopyStorage
|
|
21
25
|
from .storages.handy import HandyStorage
|
|
22
26
|
from .storages.multi import MultiStorage
|
|
23
27
|
from .storages.questdb import QuestDBStorage
|
|
28
|
+
from .storages.yahoo import YahooStorage
|
|
24
29
|
from .transformers import OHLCVSeries, PandasFrame, TypedRecords
|
|
@@ -6,8 +6,9 @@ Designed as transparent wrappers following the same decorator pattern as
|
|
|
6
6
|
TimeGuardedReader / TimeGuardedStorage.
|
|
7
7
|
|
|
8
8
|
Architecture:
|
|
9
|
-
ICache
|
|
10
|
-
MemoryCache(ICache)
|
|
9
|
+
ICache — backend interface for storing/retrieving RawData
|
|
10
|
+
MemoryCache(ICache) — in-memory dict-based implementation with Arrow concat/slice
|
|
11
|
+
ParquetCache(ICache) — on-disk parquet files plus a JSON range index, survives the process
|
|
11
12
|
CachedReader(IReader) — wraps IReader, caches read() results
|
|
12
13
|
CachedStorage(IStorage) — wraps IStorage, returns CachedReader from get_reader()
|
|
13
14
|
|
|
@@ -22,19 +23,26 @@ Composition with TimeGuard:
|
|
|
22
23
|
|
|
23
24
|
from __future__ import annotations
|
|
24
25
|
|
|
26
|
+
import json
|
|
27
|
+
import os
|
|
28
|
+
import re
|
|
29
|
+
import shutil
|
|
25
30
|
from collections import OrderedDict
|
|
26
31
|
from collections.abc import Callable, Iterator
|
|
32
|
+
from pathlib import Path
|
|
33
|
+
from urllib.parse import quote
|
|
27
34
|
|
|
28
35
|
import numpy as np
|
|
29
36
|
import pandas as pd
|
|
30
37
|
import pyarrow as pa
|
|
31
38
|
import pyarrow.compute as pc
|
|
39
|
+
import pyarrow.parquet as pq
|
|
32
40
|
|
|
33
41
|
from qubx import logger
|
|
34
42
|
from qubx.core.basics import DataType
|
|
35
43
|
from qubx.data.containers import RawData, RawMultiData
|
|
36
44
|
from qubx.data.storage import IReader, IStorage, Transformable
|
|
37
|
-
from qubx.utils.time import now_utc, to_timedelta, to_timestamp
|
|
45
|
+
from qubx.utils.time import now_utc, timedelta_to_str, to_timedelta, to_timestamp
|
|
38
46
|
|
|
39
47
|
|
|
40
48
|
class ICache:
|
|
@@ -215,8 +223,8 @@ class MemoryCache(ICache):
|
|
|
215
223
|
merged = _merge_time_ranges(ranges)
|
|
216
224
|
req_start = to_timestamp(start) if start else pd.Timestamp.min
|
|
217
225
|
req_stop = to_timestamp(stop) if stop else pd.Timestamp.max
|
|
218
|
-
for rs,
|
|
219
|
-
if rs <= req_start and
|
|
226
|
+
for rs, re_ in merged:
|
|
227
|
+
if rs <= req_start and re_ >= req_stop:
|
|
220
228
|
return True
|
|
221
229
|
return False
|
|
222
230
|
|
|
@@ -278,7 +286,9 @@ def _merge_batches(existing: pa.RecordBatch, incoming: pa.RecordBatch, time_col_
|
|
|
278
286
|
|
|
279
287
|
merged_schema = tbl.schema
|
|
280
288
|
pdf = tbl.to_pandas()
|
|
281
|
-
dedup_cols = [time_col_name] + [
|
|
289
|
+
dedup_cols = [time_col_name] + [
|
|
290
|
+
f.name for f in existing.schema if pa.types.is_string(f.type) or pa.types.is_large_string(f.type)
|
|
291
|
+
]
|
|
282
292
|
pdf = pdf.drop_duplicates(subset=dedup_cols, keep="last")
|
|
283
293
|
|
|
284
294
|
batch = pa.RecordBatch.from_pandas(pdf, schema=merged_schema, preserve_index=False)
|
|
@@ -355,6 +365,191 @@ def _merge_time_ranges(ranges: list[tuple[str, str]]) -> list[tuple[pd.Timestamp
|
|
|
355
365
|
return merged
|
|
356
366
|
|
|
357
367
|
|
|
368
|
+
class ParquetCache(ICache):
|
|
369
|
+
"""
|
|
370
|
+
On-disk cache backend: Hive-partitioned parquet, ranges in a JSON index.
|
|
371
|
+
|
|
372
|
+
Layout under `root`:
|
|
373
|
+
|
|
374
|
+
cache_key=<key>/data_id=<symbol>/data.parquet
|
|
375
|
+
_index/<key>.json — covered time ranges, globally and per symbol, and each symbol's
|
|
376
|
+
data type
|
|
377
|
+
|
|
378
|
+
DuckDB reads the layout directly, with the partition keys as columns:
|
|
379
|
+
|
|
380
|
+
SELECT * FROM read_parquet('<root>/**/*.parquet', hive_partitioning = 1)
|
|
381
|
+
WHERE data_id = 'SPY'
|
|
382
|
+
|
|
383
|
+
Persists across processes. Range bookkeeping matches MemoryCache: a symbol counts as covered
|
|
384
|
+
only when one merged range spans the whole request.
|
|
385
|
+
"""
|
|
386
|
+
|
|
387
|
+
_root: Path
|
|
388
|
+
_index: dict[str, dict]
|
|
389
|
+
_dirty: set[str]
|
|
390
|
+
|
|
391
|
+
def __init__(self, root: str | Path) -> None:
|
|
392
|
+
self._root = Path(os.path.expanduser(str(root)))
|
|
393
|
+
self._root.mkdir(parents=True, exist_ok=True)
|
|
394
|
+
self._index = {}
|
|
395
|
+
self._dirty = set()
|
|
396
|
+
self._empty: dict[str, dict] = {}
|
|
397
|
+
|
|
398
|
+
def get(self, cache_key: str, data_id: str) -> RawData | None:
|
|
399
|
+
path = self._file(cache_key, data_id)
|
|
400
|
+
if not path.exists():
|
|
401
|
+
return None
|
|
402
|
+
dtype = self._load_index(cache_key)["symbols"].get(data_id, {}).get("dtype", str(DataType.ALL))
|
|
403
|
+
# - ParquetFile reads the file itself. pq.read_table() runs dataset discovery on the parent
|
|
404
|
+
# - directories and, as they are Hive-partitioned, returns cache_key and data_id as extra
|
|
405
|
+
# - columns that were never in the data.
|
|
406
|
+
return RawData.from_table(data_id, dtype, pq.ParquetFile(path).read()) # type: ignore[arg-type]
|
|
407
|
+
|
|
408
|
+
def put(self, cache_key: str, data: RawData, start: str, stop: str) -> None:
|
|
409
|
+
if len(data) == 0:
|
|
410
|
+
self._record_empty(cache_key, data.data_id, start, stop)
|
|
411
|
+
return
|
|
412
|
+
index = self._load_index(cache_key)
|
|
413
|
+
existing = self.get(cache_key, data.data_id)
|
|
414
|
+
batch = data._raw
|
|
415
|
+
if existing is not None and len(existing) > 0:
|
|
416
|
+
batch = _merge_batches(existing._raw, batch, existing.index)
|
|
417
|
+
path = self._file(cache_key, data.data_id)
|
|
418
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
419
|
+
pq.write_table(pa.Table.from_batches([batch]), path)
|
|
420
|
+
entry = index["symbols"].setdefault(data.data_id, {"ranges": [], "dtype": str(data.dtype)})
|
|
421
|
+
entry["dtype"] = str(data.dtype)
|
|
422
|
+
entry["ranges"] = _merged_strings(entry["ranges"] + [(start, stop)])
|
|
423
|
+
index["ranges"] = _merged_strings(index["ranges"] + [(start, stop)])
|
|
424
|
+
self._dirty.add(cache_key)
|
|
425
|
+
self._flush(cache_key)
|
|
426
|
+
|
|
427
|
+
def covers(self, cache_key: str, start: str | None, stop: str | None) -> bool:
|
|
428
|
+
index = self._load_index(cache_key)
|
|
429
|
+
seen = self._empty.get(cache_key, {})
|
|
430
|
+
if start is None and stop is None:
|
|
431
|
+
return bool(index["symbols"]) or bool(seen.get("symbols"))
|
|
432
|
+
return _ranges_cover(_merged_strings(index["ranges"] + seen.get("ranges", [])), start, stop)
|
|
433
|
+
|
|
434
|
+
def check(self, cache_key: str, ids: list[str], start: str | None, stop: str | None) -> list[str]:
|
|
435
|
+
symbols = self._load_index(cache_key)["symbols"]
|
|
436
|
+
empty = self._empty.get(cache_key, {}).get("symbols", {})
|
|
437
|
+
missing = []
|
|
438
|
+
for i in ids:
|
|
439
|
+
ranges = _merged_strings(symbols.get(i, {}).get("ranges", []) + empty.get(i, []))
|
|
440
|
+
if not _ranges_cover(ranges, start, stop):
|
|
441
|
+
missing.append(i)
|
|
442
|
+
return missing
|
|
443
|
+
|
|
444
|
+
def _record_empty(self, cache_key: str, data_id: str, start: str, stop: str) -> None:
|
|
445
|
+
"""
|
|
446
|
+
Remember a window the reader answered with no rows, for this process only.
|
|
447
|
+
|
|
448
|
+
It is deliberately not written to the index. A window can come back empty because the
|
|
449
|
+
source has nothing there, but also because a reader could not build it, and the two are
|
|
450
|
+
indistinguishable here. Persisting the second kind makes it permanent: the window reads as
|
|
451
|
+
covered from then on and is served empty, without a refetch and without an error. Keeping
|
|
452
|
+
it in memory stops one run asking repeatedly and still lets the next run find out.
|
|
453
|
+
"""
|
|
454
|
+
seen = self._empty.setdefault(cache_key, {"ranges": [], "symbols": {}})
|
|
455
|
+
seen["symbols"][data_id] = _merged_strings(seen["symbols"].get(data_id, []) + [(start, stop)])
|
|
456
|
+
seen["ranges"] = _merged_strings(seen["ranges"] + [(start, stop)])
|
|
457
|
+
|
|
458
|
+
def get_ranges(self, cache_key: str) -> list[tuple[str, str]]:
|
|
459
|
+
return [(str(s), str(e)) for s, e in self._load_index(cache_key)["ranges"]]
|
|
460
|
+
|
|
461
|
+
def get_stored_ids(self, cache_key: str) -> list[str]:
|
|
462
|
+
return list(self._load_index(cache_key)["symbols"].keys())
|
|
463
|
+
|
|
464
|
+
def clear(self, cache_key: str | None = None) -> None:
|
|
465
|
+
if cache_key is not None:
|
|
466
|
+
shutil.rmtree(self._dir(cache_key), ignore_errors=True)
|
|
467
|
+
self._index_file(cache_key).unlink(missing_ok=True)
|
|
468
|
+
else:
|
|
469
|
+
for d in self._root.iterdir():
|
|
470
|
+
if d.is_dir():
|
|
471
|
+
shutil.rmtree(d, ignore_errors=True)
|
|
472
|
+
if cache_key is None:
|
|
473
|
+
self._index.clear()
|
|
474
|
+
self._dirty.clear()
|
|
475
|
+
self._empty.clear()
|
|
476
|
+
else:
|
|
477
|
+
self._index.pop(cache_key, None)
|
|
478
|
+
self._dirty.discard(cache_key)
|
|
479
|
+
self._empty.pop(cache_key, None)
|
|
480
|
+
|
|
481
|
+
def size_bytes(self) -> int:
|
|
482
|
+
return sum(f.stat().st_size for f in self._root.rglob("*.parquet"))
|
|
483
|
+
|
|
484
|
+
def close(self) -> None:
|
|
485
|
+
for key in list(self._dirty):
|
|
486
|
+
self._flush(key)
|
|
487
|
+
|
|
488
|
+
@staticmethod
|
|
489
|
+
def _safe_key(value: str) -> str:
|
|
490
|
+
"""
|
|
491
|
+
Plain directory name for a cache key: `ohlc(1h)|side=bid` -> `ohlc_1h_side_bid`.
|
|
492
|
+
|
|
493
|
+
Letters, digits, `.`, `_` and `-` survive; every other run becomes one underscore. The key
|
|
494
|
+
is ours, built by `_make_cache_key`, so nothing reads it back - it only has to name a
|
|
495
|
+
directory, and brackets and pipes are awkward in a shell and illegal on Windows.
|
|
496
|
+
"""
|
|
497
|
+
return re.sub(r"[^A-Za-z0-9._-]+", "_", value).strip("_") or "_"
|
|
498
|
+
|
|
499
|
+
@staticmethod
|
|
500
|
+
def _safe_id(value: str) -> str:
|
|
501
|
+
"""
|
|
502
|
+
Hive partition value for a data id, percent-encoded where it has to be.
|
|
503
|
+
|
|
504
|
+
Unlike the cache key this must stay reversible: the id is the symbol, and a DuckDB query
|
|
505
|
+
reads it back with `WHERE data_id = '^GSPC'`. Only `=` and `/` are encoded - a second `=`
|
|
506
|
+
in `data_id=ES=F` makes the segment unparseable - and DuckDB decodes `%3D` on the way out.
|
|
507
|
+
"""
|
|
508
|
+
return quote(value, safe="._^-")
|
|
509
|
+
|
|
510
|
+
def _dir(self, cache_key: str) -> Path:
|
|
511
|
+
return self._root / f"cache_key={self._safe_key(cache_key)}"
|
|
512
|
+
|
|
513
|
+
def _file(self, cache_key: str, data_id: str) -> Path:
|
|
514
|
+
return self._dir(cache_key) / f"data_id={self._safe_id(data_id)}" / "data.parquet"
|
|
515
|
+
|
|
516
|
+
def _index_file(self, cache_key: str) -> Path:
|
|
517
|
+
return self._root / "_index" / f"{self._safe_key(cache_key)}.json"
|
|
518
|
+
|
|
519
|
+
def _load_index(self, cache_key: str) -> dict:
|
|
520
|
+
if cache_key not in self._index:
|
|
521
|
+
try:
|
|
522
|
+
self._index[cache_key] = json.loads(self._index_file(cache_key).read_text())
|
|
523
|
+
except (OSError, json.JSONDecodeError):
|
|
524
|
+
self._index[cache_key] = {"ranges": [], "symbols": {}}
|
|
525
|
+
return self._index[cache_key]
|
|
526
|
+
|
|
527
|
+
def _flush(self, cache_key: str) -> None:
|
|
528
|
+
if cache_key not in self._dirty:
|
|
529
|
+
return
|
|
530
|
+
path = self._index_file(cache_key)
|
|
531
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
532
|
+
path.write_text(json.dumps(self._index[cache_key]))
|
|
533
|
+
self._dirty.discard(cache_key)
|
|
534
|
+
|
|
535
|
+
def __repr__(self) -> str:
|
|
536
|
+
return f"ParquetCache({self._root}, {self.size_bytes() // 1024} KB)"
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
def _ranges_cover(ranges, start: str | None, stop: str | None) -> bool:
|
|
540
|
+
"""
|
|
541
|
+
True when one merged range spans the whole request.
|
|
542
|
+
"""
|
|
543
|
+
merged = _merge_time_ranges([tuple(r) for r in ranges])
|
|
544
|
+
req_start = to_timestamp(start) if start else pd.Timestamp.min
|
|
545
|
+
req_stop = to_timestamp(stop) if stop else pd.Timestamp.max
|
|
546
|
+
return any(rs <= req_start and re_ >= req_stop for rs, re_ in merged)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def _merged_strings(ranges) -> list[tuple[str, str]]:
|
|
550
|
+
return [(str(s), str(e)) for s, e in _merge_time_ranges([tuple(r) for r in ranges])]
|
|
551
|
+
|
|
552
|
+
|
|
358
553
|
class CachedReader(IReader):
|
|
359
554
|
"""
|
|
360
555
|
Wraps an IReader with in-memory caching and optional prefetch.
|
|
@@ -468,7 +663,6 @@ class CachedReader(IReader):
|
|
|
468
663
|
ids = data_id if isinstance(data_id, (list, tuple)) else [data_id]
|
|
469
664
|
result = self._build_result(cache_key, ids, isinstance(data_id, str), start, stop)
|
|
470
665
|
|
|
471
|
-
|
|
472
666
|
return iter([result]) if chunksize > 0 else result
|
|
473
667
|
|
|
474
668
|
def get_data_id(self, dtype: DataType | str = DataType.ALL) -> list[str]:
|
|
@@ -499,7 +693,6 @@ class CachedReader(IReader):
|
|
|
499
693
|
|
|
500
694
|
# -- internal helpers --
|
|
501
695
|
|
|
502
|
-
|
|
503
696
|
def _compute_fetch_stop(self, stop: str | None) -> str | None:
|
|
504
697
|
"""
|
|
505
698
|
Extend stop by prefetch_period (clamped to now) for inner reader calls.
|
|
@@ -627,13 +820,34 @@ class CachedStorage(IStorage):
|
|
|
627
820
|
return f"CachedStorage({self._storage!r}{pf})"
|
|
628
821
|
|
|
629
822
|
|
|
823
|
+
def _canonical_dtype(dtype: DataType | str) -> str:
|
|
824
|
+
"""
|
|
825
|
+
One spelling per data type, so `ohlc(1Min)`, `ohlc(1min)`, `ohlc(1m)` and `ohlc(60s)` share one
|
|
826
|
+
cache entry instead of fetching the same bars into four.
|
|
827
|
+
|
|
828
|
+
Only a parameter shaped like a timeframe is rewritten. `orderbook(0.01,10)` and a bare `trade`
|
|
829
|
+
are left exactly as they came in.
|
|
830
|
+
"""
|
|
831
|
+
text = str(dtype)
|
|
832
|
+
head, sep, tail = text.partition("(")
|
|
833
|
+
if not sep or not tail.endswith(")"):
|
|
834
|
+
return text
|
|
835
|
+
param = tail[:-1].strip()
|
|
836
|
+
if not re.fullmatch(r"\d+\s*[A-Za-z]+", param):
|
|
837
|
+
return text
|
|
838
|
+
try:
|
|
839
|
+
return f"{head}({timedelta_to_str(to_timedelta(param))})"
|
|
840
|
+
except (ValueError, TypeError):
|
|
841
|
+
return text
|
|
842
|
+
|
|
843
|
+
|
|
630
844
|
def _make_cache_key(dtype: DataType | str, **kwargs) -> str:
|
|
631
845
|
"""
|
|
632
846
|
Generate a time-stripped cache key from dtype and extra kwargs.
|
|
633
847
|
Time parameters (start, stop) are excluded so the same cache entry
|
|
634
848
|
can serve overlapping time ranges.
|
|
635
849
|
"""
|
|
636
|
-
parts = [
|
|
850
|
+
parts = [_canonical_dtype(dtype)]
|
|
637
851
|
for k, v in sorted(kwargs.items()):
|
|
638
852
|
if k in ("start", "stop", "chunksize"):
|
|
639
853
|
continue
|