Tradehub.Trade (Tradehub v0.1.7) View Source
This module uses to fetch trade, orders information of the chain.
Link to this section Summary
Functions
Requests an order details information by its order id
Requests orders of the given account
Get leverage of the given account in a specific market
Requests recent liquidations
Requests the position of the given account in a particular market
Requests avaiable positions of the given account in all markets which the account get involved
Get positions sorted by pnl of the given market.
Get positions sorted by risk of the given market.
Get positions sorted by size of the given market.
Requests recent trades of the market or filtered by the specific params
Requests recent trades by the given account
Link to this section Functions
Specs
get_order(String.t()) :: {:ok, Tradehub.order()} | {:error, HTTPoison.Error.t()}
Requests an order details information by its order id
Examples
iex> Tradehub.Trade.get_order("A186AC5F560BBD4B2C1F9B21C6EF1814F3295EBD863FA3655F74942CDB198530")
Specs
get_orders(String.t()) :: {:ok, [Tradehub.order()]} | {:error, HTTPoison.Error.t()}
Requests orders of the given account
Examples
iex> Tradehub.Trade.get_orders("swth1945upvdn2p2sgq7muyhfmygn3fu740jw9l73du")
Specs
leverage(String.t(), String.t()) :: {:ok, Tradehub.leverage()} | {:error, HTTPoison.Error.t()}
Get leverage of the given account in a specific market
Examples
iex> Tradehub.Trade.leverage("swth1945upvdn2p2sgq7muyhfmygn3fu740jw9l73du", "eth_h21")
liquidations(before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)
View SourceSpecs
liquidations(nil, nil, nil, nil) :: {:ok, [Tradehub.account_trade()]} | {:error, HTTPoison.Error.t()}
liquidations(String.t(), String.t(), String.t(), String.t()) :: {:ok, [Tradehub.account_trade()]} | {:error, HTTPoison.Error.t()}
Requests recent liquidations
Parameters
- before_id: filter trades before id
- after_id: filter trades after id
- order_by: TODO
- limit: limit the responsed results, max is 200
Examples
iex> Tradehub.Trade.liquidations
Specs
position(String.t(), String.t()) :: {:ok, Tradehub.position()} | {:error, HTTPoison.Error.t()}
Requests the position of the given account in a particular market
Examples
iex> Tradehub.Trade.position("swth1hydakm35hta8my0vkwd2dy6gu57tly39k8y9ul", "swth_eth1")
Specs
positions(String.t()) :: {:ok, [Tradehub.position()]} | {:error, HTTPoison.Error.t()}
Requests avaiable positions of the given account in all markets which the account get involved
Examples
iex> Tradehub.Trade.positions("swth1hydakm35hta8my0vkwd2dy6gu57tly39k8y9ul")
Specs
positions_sorted_pnl(String.t()) :: {:error, HTTPoison.Error.t()} | {:ok, any()}
Get positions sorted by pnl of the given market.
Examples
iex> Tradehub.Trade.positions_sorted_pnl("swth_eth1")
Specs
positions_sorted_risk(String.t(), String.t()) :: {:error, HTTPoison.Error.t()} | {:ok, any()}
Get positions sorted by risk of the given market.
Examples
iex> Tradehub.Trade.positions_sorted_risk("swth_eth1", "unknown")
Specs
positions_sorted_size(String.t()) :: {:error, HTTPoison.Error.t()} | {:ok, any()}
Get positions sorted by size of the given market.
Examples
iex> Tradehub.Trade.positions_sorted_size("swth_eth1")
trades(market \\ nil, before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)
View SourceSpecs
trades(nil, nil, nil, nil, nil) :: {:ok, [Tradehub.trade()]} | {:error, HTTPoison.Error.t()}
trades(String.t(), String.t(), String.t(), String.t(), String.t()) :: {:ok, [Tradehub.trade()]} | {:error, HTTPoison.Error.t()}
Requests recent trades of the market or filtered by the specific params
Parameters
- market: market ticker used by the chain, e.g
swth_eth1
- before_id: filter trades before id
- after_id: filter trades after id
- order_by: TODO
- limit: limit the responsed results, max is 200
Examples
iex> Tradehub.Trade.trades
trades_by_account(account, before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)
View SourceSpecs
trades_by_account(String.t(), nil, nil, nil, nil) :: {:ok, [Tradehub.account_trade()]} | {:error, HTTPoison.Error.t()}
trades_by_account(String.t(), String.t(), String.t(), String.t(), String.t()) :: {:ok, [Tradehub.account_trade()]} | {:error, HTTPoison.Error.t()}
Requests recent trades by the given account
Parameters
- account: the account
- before_id: filter trades before id
- after_id: filter trades after id
- order_by: TODO
- limit: limit the responsed results, max is 200
Examples
iex> Tradehub.Trade.trades_by_account("swth1hydakm35hta8my0vkwd2dy6gu57tly39k8y9ul")