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 the position of the given account in a particular market

positions(account) deprecated

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

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")
Link to this function

leverage(account, market)

View Source

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")
Link to this function

liquidations(before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)

View Source

Specs

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
Link to this function

position(account, market)

View Source

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")
This function is deprecated. The API does not well documetation, and I do not have much info about this endpoint.

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")
Link to this function

positions_sorted_pnl(market)

View Source
This function is deprecated. The API is not well documentation.

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")
Link to this function

positions_sorted_risk(market, direction)

View Source
This function is deprecated. The API is not well documentation.

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")
Link to this function

positions_sorted_size(market)

View Source
This function is deprecated. The API is not well documentation.

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")
Link to this function

trades(market \\ nil, before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)

View Source

Specs

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
Link to this function

trades_by_account(account, before_id \\ nil, after_id \\ nil, order_by \\ nil, limit \\ nil)

View Source

Specs

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")