Skip to content

quantpylib.gateway.executor

Executor

Bases: BaseGateway

all_mids_subscribe(handler, exc, **kwargs) async

Subscribe to mid prices.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
handler coroutine

Callback invoked for each mid-price update.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

all_mids_unsubscribe(exc, **kwargs) async

Unsubscribe from mid prices.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

bba_subscribe(ticker, handler, exc, **kwargs) async

Subscribe to best bid/ask updates.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy {ts,bid,ask,bid_sz,ask_sz} dictionary, and 2 emits quantpylib.standards.models.BBAUpdate.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
handler coroutine

Callback invoked for each best bid/ask update.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

bba_subscribe_batch(tickers, handlers, exc, **kwargs) async

Subscribe to best bid/ask updates for multiple tickers.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy {ts,bid,ask,bid_sz,ask_sz} dictionary, and 2 emits quantpylib.standards.models.BBAUpdate.

Parameters:

Name Type Description Default
tickers list

Ticker symbols.

required
handlers coroutine or list

Shared callback, or one callback per ticker.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

bba_unsubscribe(ticker, exc, **kwargs) async

Unsubscribe from best bid/ask updates.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

bba_unsubscribe_batch(tickers, exc, **kwargs) async

Unsubscribe from best bid/ask updates for multiple tickers.

Parameters:

Name Type Description Default
tickers list

Ticker symbols.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

cancel_open_orders(exc, **kwargs) async

Group cancel orders.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

cancel_order(exc, **kwargs) async

Cancel an order.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

cancel_wire(exc, **kwargs) async

Build an exchange-native cancel wire object.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

cancel_wire_submit(exc, cancel_wire, **kwargs) async

Submit a single exchange-native cancel wire.

cancel_wires_submit(exc, cancel_wires, **kwargs) async

Submit exchange-native cancel wires.

get_all_marks(exc, **kwargs) async

Retrieve all available mark prices.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
dict

Mark prices keyed by ticker.

get_all_mids(exc, **kwargs) async

Retrieve all available mid prices.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
dict

Mid prices keyed by ticker.

l2_book_get(ticker, exc, **kwargs) async

Retrieve an L2 order-book snapshot.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 returns the raw provider payload, 1 returns the legacy {ts,b,a} dictionary, and 2 returns quantpylib.standards.models.BookUpdate.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
dict | BookUpdate

Snapshot payload in the selected schema.

l2_book_mirror(ticker, exc, **kwargs) async

Keep a live, internal L2 Order Book representation using a l2-book subscription.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
LOB | None

Local order-book object when requested by the wrapper, otherwise None.

l2_book_peek(ticker, exc, **kwargs)

Return the local L2 order-book mirror created by l2_book_mirror().

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
dict | LOB

Current mirrored order-book state.

l2_book_subscribe(ticker, handler, exc, **kwargs) async

Subscribe to L2 order-book updates.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy {ts,b,a} dictionary, and 2 emits quantpylib.standards.models.BookUpdate.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
handler coroutine

Callback invoked for each order-book update.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

l2_book_subscribe_batch(tickers, handlers, exc, **kwargs) async

Subscribe to L2 order-book updates for multiple tickers.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy {ts,b,a} dictionary, and 2 emits quantpylib.standards.models.BookUpdate.

Parameters:

Name Type Description Default
tickers list

Ticker symbols.

required
handlers coroutine or list

Shared callback, or one callback per ticker.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

l2_book_subscriptions(exc, **kwargs)

Return active L2 order-book subscription identifiers.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

Returns:

Type Description
set | list

Open L2 order-book subscription identifiers.

l2_book_unsubscribe(ticker, exc, **kwargs) async

Unsubscribe from L2 order-book updates.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

limit_order(ticker, amount, exc, **kwargs) async

Submit limit order.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
amount float or Decimal

The positive/negative quantity of contracts to long/short.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

market_order(ticker, amount, exc, **kwargs) async

Submit market order.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
amount float or Decimal

The positive/negative quantity of contracts to long/short.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

oracle_subscribe(exc, **kwargs) async

Subscribe to oracle price updates.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

oracle_unsubscribe(exc, **kwargs) async

Unsubscribe from oracle price updates.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

order_wire(exc, **kwargs) async

Build an exchange-native order wire object.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

order_wire_submit(exc, order_wire, **kwargs) async

Submit a single exchange-native order wire.

order_wires_submit(exc, order_wires, **kwargs) async

Submit exchange-native order wires.

rand_cloid(exc, **kwargs)

Generate a random client order id.

Parameters:

Name Type Description Default
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

trades_subscribe(ticker, handler, exc, **kwargs) async

Subscribe to public trade updates.

Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy normalized (ts,price,sz,dir) tuple, and 2 emits quantpylib.standards.models.TradeUpdate.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
handler coroutine

Callback invoked for each trade update.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

trades_subscribe_batch(tickers, handlers, exc, **kwargs) async

Subscribe to public trade updates for multiple tickers.

If standardize_schema is omitted, the gateway forwards 1. Schema modes follow the wrapper contract: 0 passes the raw provider payload, 1 emits the legacy normalized (ts,price,sz,dir) tuple, and 2 emits quantpylib.standards.models.TradeUpdate.

Parameters:

Name Type Description Default
tickers list

Ticker symbols.

required
handlers coroutine or list

Shared callback, or one callback per ticker.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}

trades_unsubscribe(ticker, exc, **kwargs) async

Unsubscribe from public trade updates.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
exc str

Alias for the exchange client.

required
**kwargs

Exchange wrapper specific keyword arguments.

{}