ccxtex v0.4.0 Ccxtex

Ccxtex main module

Link to this section Summary

Functions

Usage example

Fetches markets for a given exchange

Fetches a list of ohlcv data, takes OHLCVS.Opts argument

Fetches ticker for a given exchange, base and quote symbols

Fetches all or some tickers for a given exchange

Link to this section Functions

Link to this function

call_js_main(jsfn, args)

Link to this function

exchanges()
exchanges() :: [String.t()]

Usage example:

exchanges = exchanges()

Return value example:

[
...
%{
has: %{
  cancel_order: true,
  cancel_orders: false,
  cors: false,
  create_deposit_address: true,
  create_limit_order: true,
  create_market_order: false,
  create_order: true,
  deposit: false,
  edit_order: true,
  fetch_balance: true,
  fetch_closed_orders: "emulated",
  fetch_currencies: true,
  fetch_deposit_address: true,
  fetch_funding_fees: false,
  fetch_l2_order_book: true,
  fetch_markets: true,
  fetch_my_trades: true,
  fetch_ohlcv: true,
  fetch_open_orders: true,
  fetch_order: "emulated",
  fetch_order_book: true,
  fetch_order_books: false,
  fetch_orders: "emulated",
  fetch_ticker: true,
  fetch_tickers: true,
  fetch_trades: true,
  fetch_trading_fees: true,
  private_api: true,
  public_api: true,
  withdraw: true
},
id: "poloniex",
timeout: 10000
}
]
Link to this function

fetch_markets(exchange)
fetch_markets(String.t()) :: {:ok, [Ccxtex.Market.t()]} | {:error, term()}

Fetches markets for a given exchange

Response example

[
...
%Ccxtex.Market{
  active: true,
  base: "ETH",
  base_id: "eth",
  id: "etheur",
  info: %{
    "base_decimals" => 8,
    "counter_decimals" => 2,
    "description" => "Ether / Euro",
    "minimum_order" => "5.0 EUR",
    "name" => "ETH/EUR",
    "trading" => "Enabled",
    "url_symbol" => "etheur"
  },
  limits: %{
    "amount" => %{"min" => 1.0e-8},
    "cost" => %{"min" => 5},
    "price" => %{"min" => 0.01}
  },
  precision: %{"amount" => 8, "price" => 2},
  quote: "EUR",
  quote_id: "eur",
  symbol: "ETH/EUR",
  symbol_id: "eth_eur"
}
...
]
Link to this function

fetch_ohlcvs(opts)
fetch_ohlcvs(Ccxtex.OhlcvOpts.t()) :: {:ok, Ccxtex.OHLCV.t()} | {:error, term()}

Fetches a list of ohlcv data, takes OHLCVS.Opts argument

opts =
  Ccxtex.OHLCVS.Opts.make!(%{
    exchange: "poloniex",
    base: "ETH",
    quote: "USDT",
    timeframe: "1h",
    since: ~N[2018-01-01T00:00:00],
    limit: 100
  })
ohlcvs = fetch_ohlcvs(opts)

Return value example:

%Ccxtex.OHLCV{
base: "ETH",
base_volume: 4234.62695691,
close: 731.16,
exchange: "bitfinex2",
high: 737.07,
low: 726,
open: 736.77,
quote: "USDT",
timestamp: ~N[2018-01-01 00:00:00.000]
}
Link to this function

fetch_ticker(exchange, base, quote)
fetch_ticker(String.t(), String.t(), String.t()) ::
  {:ok, Ccxtex.Ticker.t()} | {:error, term()}

Fetches ticker for a given exchange, base and quote symbols

exchange = "bitstamp"
base = "ETH"
quote = "USD"
ticker = fetch_ticker(exchange, base, quote)

Return value example:

%Ccxtex.Ticker{
ask: 577.35,
ask_volume: nil,
average: nil,
base_volume: 73309.52075575,
bid: 576.8,
bid_volume: nil,
change: nil,
close: 577.35,
datetime: "2018-05-24T14:06:09.000Z",
high: 619.95,
info: %{
  ask: "577.35",
  bid: "576.80",
  high: "619.95",
  last: "577.35",
  low: "549.28",
  open: "578.40",
  timestamp: "1527170769",
  volume: "73309.52075575",
  vwap: "582.86"
},
last: 577.35,
low: 549.28,
open: 578.4,
percentage: nil,
previous_close: nil,
quote_volume: 42729187.26769644,
pair_symbol: "ETH/USD",
timestamp: 1527170769000,
vwap: 582.86
}
Link to this function

fetch_tickers(symbols, params \\ %{})
fetch_tickers([String.t()], map()) ::
  {:ok, [Ccxtex.Ticker.t()]} | {:error, term()}

Fetches all or some tickers for a given exchange

Usage:

exchange = "poloniex"
ticker = fetch_tickers(exchange)

Return value example:

[
...
%Ccxtex.Ticker{
ask: 577.35,
ask_volume: nil,
average: nil,
base_volume: 73309.52075575,
bid: 576.8,
bid_volume: nil,
change: nil,
close: 577.35,
datetime: "2018-05-24T14:06:09.000Z",
high: 619.95,
info: %{
  ask: "577.35",
  bid: "576.80",
  high: "619.95",
  last: "577.35",
  low: "549.28",
  open: "578.40",
  timestamp: "1527170769",
  volume: "73309.52075575",
  vwap: "582.86"
},
last: 577.35,
low: 549.28,
open: 578.4,
percentage: nil,
previous_close: nil,
quote_volume: 42729187.26769644,
pair_symbol: "ETH/USD",
timestamp: 1527170769000,
vwap: 582.86
}
...
]