Ccxtex 0.3 released: call ccxt library from Elixir/Erlang

By @ontofractal10/18/2018utopian-io

I've released Ccxtex 0.3, an Elixir package for calling ccxt library from Elixir/Erlang. Ccxt provides an unified API for querying for historical/recent data and trading operations for multiple cryptocurrency exchanges including GDAX, Bitfinex, Poloniex, Binance and others.

Changelog

**Changelog commit history**

Breaking: Ccxtex now uses JavaScript version of ccxt library. Previously you had to have python and ccxt python package installed through pip to use Ccxtex. Starting from this version, you don't need to manage dependencies manually, the only requirement is nodejs (version >= 10).

JS version is significantly faster, more stable and has better errors.

[0.3.0] - 2018-10-18

Added

  • fetch_tickers function to (perhaps, unsuprisingly) fetch all tickers from an exchange (if supported by exchange)
  • Ccxtex.OHLCVS.Opts struct options for fetch_ohlcvs function
  • Ccxtex.Market struct and response parsing/casting for fetch_markets results
  • Ccxtex.OHLCV struct and response parsing/casting for fetch_ohlcvs results
  • Ccxtex.Ticker struct and response parsing/casting for fetch_ticker and fetch_tickers results
  • improved specs for all Ccxtex fns
  • package published on hex.pm
  • MIT license
  • JS bundle

Changed

  • Switched to JavaScript Ccxt port instead of Python port
  • Updated docs to match latest updates
  • fetch_exchanges() function renamed to exchanges()

Status and roadmap

Ccxtex is usable, but is under active development. Some exchanges do not support all methods/require CORS/have other esoteric requirements. Please consult ccxt documentation for more details.

Public APIs in progress

  • fetch_ticker
  • fetch_tickers
  • fetch_ohlcv
  • fetch_exchanges
  • fetch_markets
  • fetch_trades
  • fetch_order_book
  • fetch_l2_order_book

Developer experience improvements

  • unified public API call option structs
  • investigate alternative parallelism/concurrency implementation
  • improve general usability of library

Private APIs implementation and authentication are under consideration

Exchanges

Usage:

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
}
]

Fetch ticker and fetch tickers

fetch_ticker returns a ticker for a given exchange, base and quote symbols, while fetch_tickers(exchange) will return all tickers for a given exchange

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
}

Fetch OHLCV

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]
}

Fetch markets

Fetches markets for a given exchange

Example:

fetch_markets("poloniex")

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"
}
...
]
(∩`-´)⊃━☆゚.*・。゚
50

comments