tai v0.0.2 Tai.Advisor behaviour
A behavior for implementing a server that receives order book changes.
It can be used to monitor multiple quote streams and create, update or cancel orders.
Link to this section Summary
Functions
Returns an atom that will identify the process
Callbacks
Callback when the highest bid or lowest ask changes price or size
Callback when order book has bid or ask changes
Callback when an order has been cancelled on the exchange
Callback when an order has been cancelled in the outbox but before the request has been sent to the exchange
Callback when an order creation fails
Callback when an order is created on the server
Callback when an order is enqueued
Link to this section Types
The state of the running advisor
Link to this section Functions
Returns an atom that will identify the process
Examples
iex> Tai.Advisor.to_name(:my_test_advisor) :advisor_my_test_advisor
Link to this section Callbacks
handle_inside_quote( order_book_feed_id :: Atom.t(), symbol :: Atom.t(), inside_quote :: Tai.Markets.Quote.t(), changes :: Map.t() | List.t(), state :: Tai.Advisor.t() ) :: :ok | {:ok, actions :: Map.t()}
Callback when the highest bid or lowest ask changes price or size
handle_order_book_changes( order_book_feed_id :: Atom.t(), symbol :: Atom.t(), changes :: term(), state :: Tai.Advisor.t() ) :: :ok
Callback when order book has bid or ask changes
handle_order_cancelled(order :: Tai.Trading.Order.t(), state :: Tai.Advisor.t()) :: :ok
Callback when an order has been cancelled on the exchange
handle_order_cancelling( order :: Tai.Trading.Order.t(), state :: Tai.Advisor.t() ) :: :ok
Callback when an order has been cancelled in the outbox but before the request has been sent to the exchange.
handle_order_create_error( reason :: term(), order :: Tai.Trading.Order.t(), state :: Tai.Advisor.t() ) :: :ok
Callback when an order creation fails
handle_order_create_ok(order :: Tai.Trading.Order.t(), state :: Tai.Advisor.t()) :: :ok
Callback when an order is created on the server
handle_order_enqueued(order :: Tai.Trading.Order.t(), state :: Tai.Advisor.t()) :: :ok
Callback when an order is enqueued