Skip to content

quantpylib.hft.feed

Feed

__init__(gateway, exchanges=None)

Initialize the feeder object.

Parameters:

Name Type Description Default
gateway Gateway

Initialized gateway object.

required
exchanges list

The list of exchanges to subscribe to. If None, use the clients in the gateway.

None

add_handler_to_feed(feed_id, handler)

Add a handler to a feed.

Parameters:

Name Type Description Default
feed_id str

The feed id.

required
handler coroutine

The handler to add.

required

add_l2_book_feed(exc, ticker, handler=None, depth=20, buffer=100, **kwargs) async

Add a level 2 order book feed.

Parameters:

Name Type Description Default
exc str

The exchange.

required
ticker str

The ticker.

required
handler coroutine

The handler to add. Defaults to None.

None
depth int

The depth of the order book. Defaults to 20.

20
buffer int

The buffer size. Defaults to 100.

100

add_trades_feed(exc, ticker, handler=None, buffer=100, **kwargs) async

Add a trades feed.

Parameters:

Name Type Description Default
exc str

The exchange.

required
ticker str

The ticker.

required
handler coroutine

The handler to add. Defaults to None.

None
buffer int

The buffer size. Defaults to 100.

100

get_feed(feed_id)

Get the feed object or buffer associated with feed_id.

Parameters:

Name Type Description Default
feed_id str

The feed id.

required

get_feed_id(exc, feed_cls, feed_type, **kwargs)

Get the feed id.

Parameters:

Name Type Description Default
exc str

The exchange.

required
feed_cls str

The asset class.

required
feed_type str

The feed type.

required

get_feed_ids()

Get list of all feed ids.

FeedCls

Asset classes.

Attributes:

Name Type Description
PERPETUAL str

Perpetual futures.

FUTURES str

Futures.

SPOT str

Spot.

OPTIONS str

Options.

SWAPS str

Swaps.

FeedType

Types of feeds.

Attributes:

Name Type Description
L1BOOK str

Level 1 order book feed.

L2BOOK str

Level 2 order book feed.

L2DELTA str

Level 2 order book delta feed.

TRADES str

Trades feed.

MIDS str

Mid prices