Betfair2 - Loren1166/NautilusTrader- GitHub Wiki

Betfair

Provides an API integration for the Betfair spots betting exchange.

为 Betfair 体育博彩交易所提供 API 集成。

Client 客户端

Common 通用

Config 配置

Data 数据

Data Types 数据类型

class SubscriptionStatus 订阅状态

class SubscriptionStatus(Enum)

Represents a Betfair subscription status.

表示 Betfair 订阅状态。

UNSUBSCRIBED = 0
PENDING_STARTUP = 1
RUNNING = 2
SUBSCRIBED = 3

class BSPOrderBookDelta BSP 订单簿增量

class BSPOrderBookDelta(OrderBookDelta)
@staticmethod
def from_batch(batch: RecordBatch) -> list[BSPOrderBookDelta]:
    ...

@staticmethod
def to_batch(self: BSPOrderBookDelta) -> RecordBatch:
    ...

@classmethod
def schema() -> Schema:
    ...

@property
def action(self) -> BookAction:
    """
    BookAction

    Return the deltas book action {ADD, UPDATE, DELETE, CLEAR}
    # 返回增量的操作 {ADD, UPDATE, DELETE, CLEAR}

    Returns
    -------
    BookAction

    """
    ...

@staticmethod
def capsule_from_list(items: list):
    ...

@staticmethod
def clear(instrument_id: InstrumentId, sequence: int, ts_event: int, ts_init: int) -> OrderBookDelta:
    """
    Return an order book delta which acts as an initial CLEAR.

    Returns
    -------
    OrderBookDelta

    """
    ...

@property
def flags(self) -> int:
    """
    uint8_t

    Return the flags for the delta.
    # 返回增量的标志。

    Returns
    -------
    uint8_t

    """
    ...

@staticmethod
def from_dict(values: dict) -> OrderBookDelta:
    """
    Return an order book delta from the given dict values.

    Parameters
    ----------
    values : dict[*str, object]
        The values for initialization.
        # 初始化的值。

    Returns
    -------
    OrderBookDelta

    """
    ...

@staticmethod
def from_pyo3(pyo3_delta) -> OrderBookDelta:
    """
    Return a legacy Cython order book delta converted from the given pyo3 Rust object.

    Parameters
    ----------
    pyo3_delta : nautilus_pyo3.OrderBookDelta
        The pyo3 Rust order book delta to convert from.
        # 要转换的 pyo3 Rust 订单簿增量。

    Returns
    -------
    OrderBookDelta

    """
    ...

@staticmethod
def from_pyo3_list(pyo3_deltas: list) -> list[OrderBookDelta]:
    """
    Return legacy Cython order book deltas converted from the given pyo3 Rust objects.

    Parameters
    ----------
    pyo3_deltas : list[*nautilus_pyo3.OrderBookDelta]
        The pyo3 Rust order book deltas to convert from.
        # 要转换的 pyo3 Rust 订单簿增量。

    Returns
    -------
    list[OrderBookDelta]

    """
    ...

@staticmethod
def from_raw(instrument_id: InstrumentId, action: BookAction, side: OrderSide, price_raw: int, price_prec: int, size_raw: int, size_prec: int, order_id: int, flags: int, sequence: int, ts_event: int, ts_init: int) -> OrderBookDelta:
    """
    Return an order book delta from the given raw values.

    Parameters
    ----------
    instrument_id : InstrumentId
        The trade instrument ID.
        # 交易Instrument ID。
    action : BookAction {ADD, UPDATE, DELETE, CLEAR}
        The order book delta action.
        # 订单簿增量操作。
    side : OrderSide {BUY, SELL}
        The order side.
        # 订单方向。
    price_raw : int64_t
        The order raw price (as a scaled fixed-point integer).
        # 订单原始价格(作为缩放的定点整数)。
    price_prec : uint8_t
        The order price precision.
        # 订单价格精度。
    size_raw : uint64_t
        The order raw size (as a scaled fixed-point integer).
        # 订单原始规模(作为缩放的定点整数)。
    size_prec : uint8_t
        The order size precision.
        # 订单规模精度。
    order_id : uint64_t
        The order ID.
        # 订单 ID。
    flags : uint8_t
        The record flags bit field, indicating event end and data information. A value of zero indicates no flags.
        # 记录标志位字段,指示事件结束和数据信息。值为零表示没有标志。
    sequence : uint64_t
        The unique sequence number for the update. If no sequence number provided in the source data then use a value of zero.
        # 更新的唯一序列号。如果源数据中没有提供序列号,则使用零值。
    ts_event : uint64_t
        UNIX timestamp (nanoseconds) when the tick event occurred.
        # 数据事件发生时的 UNIX 时间戳(纳秒)。
    ts_init : uint64_t
        UNIX timestamp (nanoseconds) when the data object was initialized.
        # 数据对象初始化时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    OrderBookDelta

    """
    ...

@classmethod
def fully_qualified_name(cls) -> str:
    """
    Return the fully qualified name for the Data class.

    Returns
    -------
    str

    """
    ...

@property
def instrument_id(self) -> InstrumentId:
    """
    InstrumentId

    Return the deltas book instrument ID.
    # 返回增量的订单簿Instrument ID。

    Returns
    -------
    InstrumentId

    """
    ...

@property
def is_add(self) -> bool:
    """
    BookAction

    If the deltas book action is an ADD.
    # 如果增量的操作是 ADD。

    Returns
    -------
    bool

    """
    ...

@property
def is_clear(self) -> bool:
    """
    BookAction

    If the deltas book action is a CLEAR.
    # 如果增量的操作是 CLEAR。

    Returns
    -------
    bool

    """
    ...

@property
def is_delete(self) -> bool:
    """
    BookAction

    If the deltas book action is a DELETE.
    # 如果增量的操作是 DELETE。

    Returns
    -------
    bool

    """
    ...

@classmethod
def is_signal(cls, name: str = "") -> bool:
    """
    Determine if the current class is a signal type, optionally checking for a specific signal name.

    Parameters
    ----------
    name : str, optional
        The specific signal name to check. If name not provided or if an empty string is passed,
        the method checks whether the class name indicates a general signal type. If name is
        provided, the method checks if the class name corresponds to that specific signal.
        # 要检查的特定信号名称。如果未提供名称或传递空字符串,则该方法检查类名是否指示
        # 一般信号类型。如果提供了名称,则该方法检查类名是否对应于该特定信号。

    Returns
    -------
    bool
        True if the class name matches the signal type or the specific signal name, otherwise False.
        # 如果类名与信号类型或特定信号名称匹配,则为 True,否则为 False。

    """
    ...

@property
def is_update(self) -> bool:
    """
    BookAction

    If the deltas book action is an UPDATE.
    # 如果增量的操作是 UPDATE。

    Returns
    -------
    bool

    """
    ...

@staticmethod
def list_from_capsule(capsule):
    ...

@property
def order(self) -> BookOrder | None:
    """
    BookOrder | None

    Return the deltas book order for the action.
    # 返回操作的增量订单簿订单。

    Returns
    -------
    BookOrder

    """
    ...

@property
def sequence(self) -> int:
    """
    uint64_t

    Return the sequence number for the delta.
    # 返回增量的序列号。

    Returns
    -------
    uint64_t

    """
    ...

@staticmethod
def to_dict(obj: OrderBookDelta) -> dict:
    """
    Return a dictionary representation of this object.

    Returns
    -------
    dict[str, object]

    """
    ...

@staticmethod
def to_pyo3_list(deltas: list) -> list:
    """
    Return pyo3 Rust order book deltas converted from the given legacy Cython objects.

    Parameters
    ----------
    pyo3_deltas : list[OrderBookDelta]
        The pyo3 Rust order book deltas to convert from.
        # 要转换的 pyo3 Rust 订单簿增量。

    Returns
    -------
    list[nautilus_pyo3.OrderBookDelta]

    """
    ...

@property
def ts_event(self) -> int:
    """
    int

    UNIX timestamp (nanoseconds) when the data event occurred.
    # 数据事件发生时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

@property
def ts_init(self) -> int:
    """
    int

    UNIX timestamp (nanoseconds) when the object was initialized.
    # 数据对象初始化时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

class BetfairTicker Betfair 行情

class BetfairTicker(Data)

Represents a Betfair ticker.

表示 Betfair 行情。

@property
def ts_event(self) -> int:
    """
    UNIX timestamp (nanoseconds) when the data event occurred.
    # 数据事件发生时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

@property
def ts_init(self) -> int:
    """
    UNIX timestamp (nanoseconds) when the object was initialized.
    # 数据对象初始化时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

@classmethod
def schema():
    ...

@classmethod
def from_dict(values: dict):
    ...

@staticmethod
def to_dict(self: BetfairTicker):
    ...

@classmethod
def fully_qualified_name(cls) -> str:
    """
    Return the fully qualified name for the Data class.

    Returns
    -------
    str

    """
    ...

@classmethod
def is_signal(cls, name: str = "") -> bool:
    """
    Determine if the current class is a signal type, optionally checking for a specific signal name.

    Parameters
    ----------
    name : str, optional
        The specific signal name to check. If name not provided or if an empty string is passed,
        the method checks whether the class name indicates a general signal type. If name is
        provided, the method checks if the class name corresponds to that specific signal.
        # 要检查的特定信号名称。如果未提供名称或传递空字符串,则该方法检查类名是否指示
        # 一般信号类型。如果提供了名称,则该方法检查类名是否对应于该特定信号。

    Returns
    -------
    bool
        True if the class name matches the signal type or the specific signal name, otherwise False.
        # 如果类名与信号类型或特定信号名称匹配,则为 True,否则为 False。

    """
    ...

class BetfairStartingPrice Betfair 起始价格

class BetfairStartingPrice(Data)

Represents the realised Betfair Starting Price.

表示已实现的 Betfair 起始价格。

@property
def ts_event(self) -> int:
    """
    UNIX timestamp (nanoseconds) when the data event occurred.
    # 数据事件发生时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

@property
def ts_init(self) -> int:
    """
    UNIX timestamp (nanoseconds) when the object was initialized.
    # 数据对象初始化时的 UNIX 时间戳(纳秒)。

    Returns
    -------
    int

    """
    ...

@classmethod
def schema():
    ...

@classmethod
def from_dict(values: dict):
    ...

@staticmethod
def to_dict(self):
    ...

@classmethod
def fully_qualified_name(cls) -> str:
    """
    Return the fully qualified name for the Data class.

    Returns
    -------
    str

    """
    ...

@classmethod
def is_signal(cls, name: str = "") -> bool:
    """
    Determine if the current class is a signal type, optionally checking for a specific signal name.

    Parameters
    ----------
    name : str, optional
        The specific signal name to check. If name not provided or if an empty string is passed,
        the method checks whether the class name indicates a general signal type. If name is
        provided, the method checks if the class name corresponds to that specific signal.
        # 要检查的特定信号名称。如果未提供名称或传递空字符串,则该方法检查类名是否指示
        # 一般信号类型。如果提供了名称,则该方法检查类名是否对应于该特定信号。

    Returns
    -------
    bool
        True if the class name matches the signal type or the specific signal name, otherwise False.
        # 如果类名与信号类型或特定信号名称匹配,则为 True,否则为 False。

    """
    ...

Execution 执行

Factories 工厂

OrderBook 订单簿

Providers 提供程序

Sockets 套接字