tai v0.0.3 Tai.Exchanges.OrderBookFeed behaviour

Behaviour to connect to a WebSocket that streams quotes from order books

Link to this section Summary

Types

t()

The state of the running order book feed

Functions

Returns an atom that will identify the process

Callbacks

Invoked after a message is received on the socket and should be used to process the message

Invoked after the process is started and should be used to setup subscriptions

Link to this section Types

Link to this type t()
t() :: %Tai.Exchanges.OrderBookFeed{
  feed_id: term(),
  store: term(),
  symbols: term()
}

The state of the running order book feed

Link to this section Functions

Link to this function to_name(feed_id)

Returns an atom that will identify the process

Examples

iex> Tai.Exchanges.OrderBookFeed.to_name(:my_test_feed) :order_book_feed_my_test_feed

Link to this section Callbacks

Link to this callback handle_msg(msg, feed)
handle_msg(msg :: map(), feed :: t()) :: {:ok, state :: t()}

Invoked after a message is received on the socket and should be used to process the message

Link to this callback subscribe_to_order_books(pid, feed_id, symbols)
subscribe_to_order_books(pid :: pid(), feed_id :: atom(), symbols :: list()) ::
  :ok | {:error, bitstring()}

Invoked after the process is started and should be used to setup subscriptions