Ccxtex 0.3 released: call ccxt library from Elixir/Erlang

in #utopian-io6 years ago (edited)

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

  • [x] fetch_ticker
  • [x] fetch_tickers
  • [x] fetch_ohlcv
  • [x] fetch_exchanges
  • [x] fetch_markets
  • [ ] fetch_trades
  • [ ] fetch_order_book
  • [ ] fetch_l2_order_book

Developer experience improvements

  • [x] unified public API call option structs
  • [x] 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"
}
...
]

(∩`-´)⊃━☆゚.*・。゚

Sort:  

Thank you for your contribution. I love to see that you like Elixir so much. Is there any prominent reason of changing it from Python to JavaScript. I would love to see it in action, so if you could have added some GIF or Screenshot then it would have been better.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @codingdefined!

So far this week you've reviewed 5 contributions. Keep up the good work!

You motivate me to learn the elixir :) Very interesting language.

Happy to hear that! :) Elixir, imo, is the best* dynamically typed programming language for backend development.

Hi @ontofractal!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hello @ontofractal, thank you for contributing via Utopian. As you may have noticed, @utopian-io is facing a shortage of VP. This is happening due to many contributions waiting for @utopian-io's vote leaving the account VP little time to recharge. To solve this issue, we are currently working on a new bot with different voting behavior. Your contribution has been selected for a manual reward by the team. To receive this reward, we expect you to respond to this comment within 24 hours.
Thank you.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.20
TRX 0.20
JST 0.034
BTC 89640.94
ETH 3073.42
USDT 1.00
SBD 2.93