39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import asyncio
|
||
|
|
|
||
|
|
from nautilus_trader.cache.cache import Cache
|
||
|
|
from nautilus_trader.common.component import LiveClock
|
||
|
|
from nautilus_trader.common.component import MessageBus
|
||
|
|
from nautilus_trader.live.factories import LiveExecClientFactory
|
||
|
|
|
||
|
|
from .config import BingxExecClientConfig
|
||
|
|
from .http import BingxHttpClient
|
||
|
|
from .instrument_provider import BingxInstrumentProvider
|
||
|
|
from .execution import BingxExecutionClient
|
||
|
|
|
||
|
|
|
||
|
|
class BingxLiveExecClientFactory(LiveExecClientFactory):
|
||
|
|
@staticmethod
|
||
|
|
def create( # type: ignore[override]
|
||
|
|
loop: asyncio.AbstractEventLoop,
|
||
|
|
name: str,
|
||
|
|
config: BingxExecClientConfig,
|
||
|
|
msgbus: MessageBus,
|
||
|
|
cache: Cache,
|
||
|
|
clock: LiveClock,
|
||
|
|
) -> BingxExecutionClient:
|
||
|
|
config.validate_mainnet_opt_in()
|
||
|
|
client = BingxHttpClient(config)
|
||
|
|
provider = BingxInstrumentProvider(client=client, config=config.instrument_provider)
|
||
|
|
return BingxExecutionClient(
|
||
|
|
loop=loop,
|
||
|
|
client=client,
|
||
|
|
msgbus=msgbus,
|
||
|
|
cache=cache,
|
||
|
|
clock=clock,
|
||
|
|
instrument_provider=provider,
|
||
|
|
config=config,
|
||
|
|
name=name,
|
||
|
|
)
|