Split exchange and strategy modules for future Binance support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from .adapter import BinanceExchange
|
||||
|
||||
__all__ = ["BinanceExchange"]
|
||||
@@ -0,0 +1,62 @@
|
||||
"""币安交易所适配器占位:后期接入,接口与 OKX 对齐。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Sequence
|
||||
|
||||
from ...config import Settings, get_settings
|
||||
from ..types import BookLevel, MarketSnapshot, OptionPair, Quote
|
||||
|
||||
|
||||
class BinanceExchange:
|
||||
name = "binance"
|
||||
|
||||
def __init__(self, settings: Settings | None = None) -> None:
|
||||
self.settings = settings or get_settings()
|
||||
|
||||
async def start(self) -> None:
|
||||
raise NotImplementedError("币安交易所模块尚未接入,请配置 EXCHANGE=okx")
|
||||
|
||||
async def stop(self) -> None:
|
||||
return
|
||||
|
||||
def list_option_contracts(self, family: str) -> list[dict[str, Any]]:
|
||||
raise NotImplementedError("BinanceExchange.list_option_contracts")
|
||||
|
||||
def fetch_index(self, index_id: str) -> float | None:
|
||||
raise NotImplementedError("BinanceExchange.fetch_index")
|
||||
|
||||
def fetch_mark(self, inst_id: str) -> float | None:
|
||||
raise NotImplementedError("BinanceExchange.fetch_mark")
|
||||
|
||||
def fetch_book(
|
||||
self, inst_id: str, depth: int = 5
|
||||
) -> tuple[list[BookLevel], list[BookLevel], int | None]:
|
||||
raise NotImplementedError("BinanceExchange.fetch_book")
|
||||
|
||||
def get_ct_mult(self, option_inst_id: str, family: str, default: float) -> float:
|
||||
return float(default)
|
||||
|
||||
def set_pair(self, pair: OptionPair | None) -> None:
|
||||
raise NotImplementedError("BinanceExchange.set_pair")
|
||||
|
||||
def warm_and_subscribe(self, inst_ids: Sequence[str]) -> None:
|
||||
raise NotImplementedError("BinanceExchange.warm_and_subscribe")
|
||||
|
||||
async def resubscribe(self, inst_ids: Sequence[str]) -> None:
|
||||
raise NotImplementedError("BinanceExchange.resubscribe")
|
||||
|
||||
def quote(self, inst_id: str) -> Quote | None:
|
||||
return None
|
||||
|
||||
def snapshot(self, perp_inst_id: str) -> MarketSnapshot:
|
||||
raise NotImplementedError("BinanceExchange.snapshot")
|
||||
|
||||
def snapshot_dict(self, perp_inst_id: str) -> dict[str, Any]:
|
||||
raise NotImplementedError("BinanceExchange.snapshot_dict")
|
||||
|
||||
def set_index_px(self, px: float | None) -> None:
|
||||
return
|
||||
|
||||
def set_mark_px(self, inst_id: str, mark_px: float | None) -> None:
|
||||
return
|
||||
Reference in New Issue
Block a user