tai v0.0.17 Tai.Venues.Adapter behaviour

Link to this section Summary

Link to this section Types

Link to this type

account_id()
account_id() :: atom()

Link to this type

amend_attrs()
amend_attrs() :: Tai.Trading.Orders.Amend.attrs()

Link to this type

amend_order_error_reason()
amend_order_error_reason() ::
  shared_error_reason() | :not_found | :not_supported

Link to this type

amend_response()
amend_response() :: Tai.Trading.OrderResponses.Amend.t()

Link to this type

asset_balance()
asset_balance() :: Tai.Venues.AssetBalance.t()

Link to this type

cancel_order_error_reason()
cancel_order_error_reason() :: shared_error_reason() | :not_found

Link to this type

create_order_error_reason()
create_order_error_reason() :: shared_error_reason() | :insufficient_balance

Link to this type

credentials()
credentials() :: map()

Link to this type

position()
position() :: Tai.Trading.Position.t()

Link to this type

product()
product() :: Tai.Venues.Product.t()

Link to this type

shared_error_reason()
shared_error_reason() ::
  :not_implemented
  | :timeout
  | :connect_timeout
  | :overloaded
  | {:credentials, reason :: term()}
  | {:nonce_not_increasing, msg :: String.t()}
  | {:unhandled, reason :: term()}

Link to this type

t()
t() :: %Tai.Venues.Adapter{
  accounts: map(),
  adapter: :atom,
  id: :atom,
  products: String.t(),
  timeout: non_neg_integer()
}

Link to this type

venue_id()
venue_id() :: atom()

Link to this section Callbacks

Link to this callback

amend_order(order, amend_attrs, credentials)
amend_order(order(), amend_attrs(), credentials()) ::
  {:ok, amend_response()} | {:error, amend_order_error_reason()}

Link to this callback

asset_balances(venue_id, account_id, credentials)
asset_balances(venue_id :: atom(), account_id(), credentials()) ::
  {:ok, [asset_balance()]} | {:error, reason :: term()}

Link to this callback

cancel_order(order, credentials)
cancel_order(order(), credentials()) ::
  {:ok, cancel_response()} | {:error, cancel_order_error_reason()}

Link to this callback

create_order(order, credentials)
create_order(order(), credentials()) ::
  {:ok, create_response()} | {:error, create_order_error_reason()}

Link to this callback

maker_taker_fees(venue_id, account_id, credentials)
maker_taker_fees(venue_id(), account_id(), credentials()) ::
  {:ok, {maker :: Decimal.t(), taker :: Decimal.t()} | nil}
  | {:error, reason :: term()}

Link to this callback

order_book_feed()
order_book_feed() :: atom()

Link to this callback

positions(venue_id, account_id, credentials)
positions(venue_id(), account_id(), credentials()) ::
  {:ok, [position()]} | {:error, :not_supported | shared_error_reason()}

Link to this callback

products(venue_id)
products(venue_id()) :: {:ok, [product()]} | {:error, reason :: term()}

Link to this callback

stream_supervisor()
stream_supervisor() :: atom()