67 production .py modules that the running PINK service imports but which were never committed: prod/bingx/ (HTTP client, market/user streams, journal, config), prod/clean_arch/ adapters/persistence/runtime/dita/dita_v2 production modules and their co-located tests. Rule going forward: every module imported by launch_dolphin_pink.py / pink_direct.py must appear in git ls-files. Excludes _backup dirs, __pycache__, and non-code files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from nautilus_trader.config import LiveDataClientConfig
|
|
from nautilus_trader.config import PositiveInt
|
|
|
|
from .config import BingxInstrumentProviderConfig
|
|
from .config import require_mainnet_opt_in
|
|
from .enums import BINGX_VENUE
|
|
from .enums import BingxEnvironment
|
|
|
|
|
|
class BingxDataClientConfig(LiveDataClientConfig, frozen=True):
|
|
"""
|
|
Configuration for the BingX live market data client.
|
|
"""
|
|
|
|
venue = BINGX_VENUE
|
|
environment: BingxEnvironment = BingxEnvironment.VST
|
|
allow_mainnet: bool = False
|
|
base_url_ws_market: str | None = None
|
|
http_timeout_secs: PositiveInt = 10
|
|
instrument_provider: BingxInstrumentProviderConfig = BingxInstrumentProviderConfig(load_all=True)
|
|
|
|
use_book_ticker: bool = True
|
|
use_incr_depth: bool = True
|
|
depth_level: PositiveInt = 20
|
|
|
|
ws_reconnect_initial_ms: PositiveInt = 500
|
|
ws_reconnect_max_ms: PositiveInt = 10_000
|
|
|
|
def validate_mainnet_opt_in(self) -> None:
|
|
require_mainnet_opt_in(self.environment, self.allow_mainnet, context="BingX data client")
|
|
|
|
def __post_init__(self) -> None:
|
|
import enum
|
|
if isinstance(self.environment, enum.Enum):
|
|
env_val = self.environment.value
|
|
else:
|
|
env_val = str(self.environment)
|
|
if env_val.upper() == "LIVE" and not self.allow_mainnet:
|
|
raise ValueError(
|
|
"BingXDataClientConfig: LIVE environment requires allow_mainnet=True. "
|
|
"Pass allow_mainnet=True explicitly to opt in."
|
|
)
|