quantbt-engine 1.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantbt/__init__.py +862 -0
- quantbt/adapters/__init__.py +5 -0
- quantbt/adapters/nautilus/__init__.py +42 -0
- quantbt/adapters/nautilus/_dependency.py +53 -0
- quantbt/adapters/nautilus/backend.py +639 -0
- quantbt/adapters/nautilus/instruments.py +275 -0
- quantbt/adapters/nautilus/options.py +465 -0
- quantbt/adapters/nautilus/reports.py +231 -0
- quantbt/backends/__init__.py +29 -0
- quantbt/backends/_native_event_rust.py +2168 -0
- quantbt/backends/native_event.py +5048 -0
- quantbt/backends/native_option.py +796 -0
- quantbt/backends/native_portfolio.py +928 -0
- quantbt/backends/native_vectorized.py +1299 -0
- quantbt/backtester.py +485 -0
- quantbt/benchmarks/__init__.py +1 -0
- quantbt/benchmarks/compare_phase9_parity.py +302 -0
- quantbt/benchmarks/gamma_scalping_backtestsample.py +802 -0
- quantbt/benchmarks/profile_phase7.py +415 -0
- quantbt/benchmarks/run_arbitrage_phase_e.py +160 -0
- quantbt/benchmarks/run_optimization_overhead.py +195 -0
- quantbt/benchmarks/run_options_engine.py +272 -0
- quantbt/benchmarks/run_pct_equity_nautilus_smoke.py +227 -0
- quantbt/benchmarks/run_phase12_arbitrage_cert.py +402 -0
- quantbt/benchmarks/run_phase12_benchmark_nautilus_cert.py +430 -0
- quantbt/benchmarks/run_phase13_portfolio_report.py +97 -0
- quantbt/benchmarks/run_phase13_wfo_cache.py +162 -0
- quantbt/benchmarks/run_phase14_service_loop.py +694 -0
- quantbt/benchmarks/run_phase15a_nautilus_certification.py +514 -0
- quantbt/benchmarks/run_phase15b_synthetic_depth.py +175 -0
- quantbt/benchmarks/run_phase16_performance_debt.py +389 -0
- quantbt/benchmarks/run_phase30e_reactive_runner.py +161 -0
- quantbt/benchmarks/run_phase31_intrabar.py +441 -0
- quantbt/benchmarks/run_phase34a_native_event_memory.py +179 -0
- quantbt/benchmarks/run_phase34b_native_event_prepared_score.py +173 -0
- quantbt/benchmarks/run_phase34c_native_event_single_pass.py +176 -0
- quantbt/benchmarks/run_phase7.py +654 -0
- quantbt/benchmarks/run_portfolio_real_parity.py +537 -0
- quantbt/core/__init__.py +323 -0
- quantbt/core/arbitrage.py +767 -0
- quantbt/core/basket.py +234 -0
- quantbt/core/certification.py +274 -0
- quantbt/core/constraints.py +155 -0
- quantbt/core/engine.py +1144 -0
- quantbt/core/event.py +869 -0
- quantbt/core/execution_contract.py +197 -0
- quantbt/core/execution_depth.py +613 -0
- quantbt/core/intrabar_kernel.py +1906 -0
- quantbt/core/intrabar_reference.py +907 -0
- quantbt/core/intrabar_session.py +156 -0
- quantbt/core/market_tape.py +480 -0
- quantbt/core/native_event_capabilities.py +121 -0
- quantbt/core/native_event_parity.py +336 -0
- quantbt/core/order_compiler.py +422 -0
- quantbt/core/orders.py +319 -0
- quantbt/core/portfolio.py +392 -0
- quantbt/core/preprocessor.py +256 -0
- quantbt/core/reactive.py +173 -0
- quantbt/core/results.py +341 -0
- quantbt/core/schema.py +211 -0
- quantbt/core/scopes.py +96 -0
- quantbt/core/structured_orders.py +378 -0
- quantbt/core/types.py +87 -0
- quantbt/core/vectorized.py +203 -0
- quantbt/endpoint.py +4465 -0
- quantbt/engines.py +1014 -0
- quantbt/metrics/__init__.py +45 -0
- quantbt/metrics/options_analytics.py +46 -0
- quantbt/metrics/performance.py +541 -0
- quantbt/optimization/__init__.py +94 -0
- quantbt/optimization/callbacks.py +116 -0
- quantbt/optimization/candidate_selection.py +397 -0
- quantbt/optimization/config.py +84 -0
- quantbt/optimization/constraints.py +22 -0
- quantbt/optimization/evaluator.py +21 -0
- quantbt/optimization/evaluators/__init__.py +32 -0
- quantbt/optimization/evaluators/arbitrage.py +22 -0
- quantbt/optimization/evaluators/generic.py +34 -0
- quantbt/optimization/evaluators/grid_dca.py +22 -0
- quantbt/optimization/evaluators/intrabar.py +54 -0
- quantbt/optimization/evaluators/native_event.py +51 -0
- quantbt/optimization/evaluators/options.py +22 -0
- quantbt/optimization/evaluators/portfolio.py +42 -0
- quantbt/optimization/evaluators/signal.py +43 -0
- quantbt/optimization/multiseed.py +176 -0
- quantbt/optimization/objectives.py +221 -0
- quantbt/optimization/optimizer.py +500 -0
- quantbt/optimization/result.py +80 -0
- quantbt/optimization/samplers.py +84 -0
- quantbt/optimization/space.py +223 -0
- quantbt/options/__init__.py +215 -0
- quantbt/options/cache.py +116 -0
- quantbt/options/conventions.py +158 -0
- quantbt/options/data.py +177 -0
- quantbt/options/execution.py +600 -0
- quantbt/options/fees.py +135 -0
- quantbt/options/greeks.py +173 -0
- quantbt/options/hedging.py +232 -0
- quantbt/options/iv.py +188 -0
- quantbt/options/ledger.py +263 -0
- quantbt/options/lifecycle.py +94 -0
- quantbt/options/margin.py +311 -0
- quantbt/options/packages.py +147 -0
- quantbt/options/pricing.py +191 -0
- quantbt/options/schema.py +227 -0
- quantbt/options/selectors.py +281 -0
- quantbt/options/strategy.py +249 -0
- quantbt/options/surface.py +142 -0
- quantbt/options/tape.py +226 -0
- quantbt/options/templates/__init__.py +33 -0
- quantbt/options/templates/packages.py +354 -0
- quantbt/portfolio.py +606 -0
- quantbt/py.typed +1 -0
- quantbt/reporting/__init__.py +38 -0
- quantbt/reporting/arbitrage_audit.py +211 -0
- quantbt/reporting/nautilus_bundle.py +758 -0
- quantbt/reporting/nautilus_certification.py +226 -0
- quantbt/reporting/nautilus_diagnostics.py +225 -0
- quantbt/reporting/parity.py +496 -0
- quantbt/reporting/portfolio_audit.py +206 -0
- quantbt/reporting/portfolio_nautilus.py +140 -0
- quantbt/sizing/__init__.py +3 -0
- quantbt/sizing/fast.py +67 -0
- quantbt/sizing/modes.py +162 -0
- quantbt/viz/__init__.py +4 -0
- quantbt/viz/plots.py +310 -0
- quantbt/viz/themes.py +102 -0
- quantbt/walkforward.py +3136 -0
- quantbt_engine-1.0.7.dist-info/METADATA +891 -0
- quantbt_engine-1.0.7.dist-info/RECORD +133 -0
- quantbt_engine-1.0.7.dist-info/WHEEL +5 -0
- quantbt_engine-1.0.7.dist-info/licenses/LICENSE +21 -0
- quantbt_engine-1.0.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Optional NautilusTrader backend adapter.
|
|
3
|
+
|
|
4
|
+
Importing this module does not require NautilusTrader to be installed. The
|
|
5
|
+
dependency is loaded lazily when a backend run is requested.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .backend import NautilusBackendConfig, NautilusBacktestEngine, build_nautilus_package_order_table
|
|
9
|
+
from .instruments import (
|
|
10
|
+
ensure_utc_ohlcv,
|
|
11
|
+
make_binance_perpetual,
|
|
12
|
+
normalize_binance_perp_symbol,
|
|
13
|
+
supported_binance_perpetuals,
|
|
14
|
+
timeframe_to_nautilus,
|
|
15
|
+
)
|
|
16
|
+
from .reports import result_from_nautilus_reports
|
|
17
|
+
from .options import (
|
|
18
|
+
NautilusOptionValidationConfig,
|
|
19
|
+
NautilusOptionValidationResult,
|
|
20
|
+
build_nautilus_option_quote_table,
|
|
21
|
+
inspect_nautilus_option_support,
|
|
22
|
+
make_nautilus_option_instrument,
|
|
23
|
+
validate_option_packages_with_nautilus,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"NautilusBackendConfig",
|
|
28
|
+
"NautilusBacktestEngine",
|
|
29
|
+
"build_nautilus_package_order_table",
|
|
30
|
+
"ensure_utc_ohlcv",
|
|
31
|
+
"make_binance_perpetual",
|
|
32
|
+
"normalize_binance_perp_symbol",
|
|
33
|
+
"result_from_nautilus_reports",
|
|
34
|
+
"NautilusOptionValidationConfig",
|
|
35
|
+
"NautilusOptionValidationResult",
|
|
36
|
+
"build_nautilus_option_quote_table",
|
|
37
|
+
"inspect_nautilus_option_support",
|
|
38
|
+
"make_nautilus_option_instrument",
|
|
39
|
+
"supported_binance_perpetuals",
|
|
40
|
+
"timeframe_to_nautilus",
|
|
41
|
+
"validate_option_packages_with_nautilus",
|
|
42
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Lazy NautilusTrader imports.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from types import SimpleNamespace
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def require_nautilus():
|
|
11
|
+
try:
|
|
12
|
+
from nautilus_trader.adapters.binance import BINANCE_VENUE
|
|
13
|
+
from nautilus_trader.backtest.engine import BacktestEngine, BacktestEngineConfig
|
|
14
|
+
from nautilus_trader.backtest.models import MakerTakerFeeModel
|
|
15
|
+
from nautilus_trader.config import LoggingConfig, RiskEngineConfig
|
|
16
|
+
from nautilus_trader.model.currencies import USDT
|
|
17
|
+
from nautilus_trader.model.data import Bar, BarType
|
|
18
|
+
from nautilus_trader.model.enums import AccountType, OmsType, OrderSide, PositionSide, PriceType, TimeInForce
|
|
19
|
+
from nautilus_trader.model.identifiers import InstrumentId, TraderId
|
|
20
|
+
from nautilus_trader.model.objects import Money
|
|
21
|
+
from nautilus_trader.persistence.wranglers import BarDataWrangler
|
|
22
|
+
from nautilus_trader.test_kit.providers import TestInstrumentProvider
|
|
23
|
+
from nautilus_trader.trading.strategy import Strategy, StrategyConfig
|
|
24
|
+
except ImportError as exc:
|
|
25
|
+
raise ImportError(
|
|
26
|
+
"NautilusTrader adapter requires the optional 'nautilus_trader' package. "
|
|
27
|
+
"Install NautilusTrader in the active environment or use a native quantbt backend."
|
|
28
|
+
) from exc
|
|
29
|
+
|
|
30
|
+
return SimpleNamespace(
|
|
31
|
+
AccountType=AccountType,
|
|
32
|
+
BacktestEngine=BacktestEngine,
|
|
33
|
+
BacktestEngineConfig=BacktestEngineConfig,
|
|
34
|
+
Bar=Bar,
|
|
35
|
+
BarDataWrangler=BarDataWrangler,
|
|
36
|
+
BarType=BarType,
|
|
37
|
+
BINANCE_VENUE=BINANCE_VENUE,
|
|
38
|
+
InstrumentId=InstrumentId,
|
|
39
|
+
LoggingConfig=LoggingConfig,
|
|
40
|
+
MakerTakerFeeModel=MakerTakerFeeModel,
|
|
41
|
+
Money=Money,
|
|
42
|
+
OmsType=OmsType,
|
|
43
|
+
OrderSide=OrderSide,
|
|
44
|
+
PositionSide=PositionSide,
|
|
45
|
+
PriceType=PriceType,
|
|
46
|
+
RiskEngineConfig=RiskEngineConfig,
|
|
47
|
+
Strategy=Strategy,
|
|
48
|
+
StrategyConfig=StrategyConfig,
|
|
49
|
+
TestInstrumentProvider=TestInstrumentProvider,
|
|
50
|
+
TimeInForce=TimeInForce,
|
|
51
|
+
TraderId=TraderId,
|
|
52
|
+
USDT=USDT,
|
|
53
|
+
)
|