I'm releasing Ccxtex 0.1, a first version of FLOSS Elixir package for Elixir/Erlang interoperability with python version of ccxt library. Ccxt provides unified API for fetching of historical data and trading operations for multiple cryptocurrency exchanges including GDAX, Bitfinex, Poloniex, Binance and others.
<h1><a href="https://github.com/cyberpunk-ventures/ccxtex" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Ccxtex repo and docs
<h2>Installation
<h3>Elixir
<p dir="auto">Add the following line to your package mix.exs:
<pre><code>def deps do
[
{:ccxtex, github: "cyberpunk-ventures/ccxtex"}
]
end
<h3>Python
<p dir="auto">You need Python 3 and <a href="https://pypi.org/project/ccxt/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">ccxt python package installed for this module to work.
<p dir="auto">To install ccxt use <code>pip3 install ccxt
<p dir="auto">Python interop is implemented with Erlport and Export libraries.
<h2>Status and roadmap
<p dir="auto">Ccxtex is usable, but is under active development, API is unstable and will change. Some exchanges do not support all methods/require CORS/have other esoteric requirements. Please consult <a href="https://github.com/ccxt/ccxt" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">ccxt documentation for more.
<h3>Public APIs in progress
<ul>
<li>[x] fetch_ticker
<li>[x] fetch_ohlcv
<li>[x] fetch_exchanges
<li>[x] fetch_markets
<li>[ ] fetch_trades
<li>[ ] fetch_order_book
<li>[ ] fetch_l2_order_book
<h3>Developer experience improvements
<ul>
<li>[ ] unified public API call option structs
<li>[ ] integrate python 3 async calls and remove a pid arg from module functions
<li>[ ] capture exceptions generated by ccxt python library and convert to elixir success tuples
<h3>Private APIs implementation are under consideration
<h2>Examples
<p dir="auto"><span>Default process id (<a href="/@pid">@pid) is Ccxtex.Port. You can always start and use another process with Ccxtex.Port.start_link/2
<h3>Fetch exchanges
<p dir="auto">Usage:<br />
<code>exchanges = Ccxtex.fetch_exchanges(Ccxtex.Port)
<pre><code>[
...
%{
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
}
]
<h3>Fetch ticker
<p dir="auto">Usage:
<pre><code>exchange = "bitstamp"
symbol = "ETH/USD"
ticker = Ccxtex.fetch_ticker(Ccxtex.Port, exchange, symbol)
<p dir="auto">Return value example:
<pre><code>%{
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,
symbol: "ETH/USD",
timestamp: 1527170769000,
vwap: 582.86
}
<h3>Fetch OHLCV
<p dir="auto">Usage:
<pre><code>exchange = "bitstamp"
symbol = "ETH/USD"
ticker = Ccxtex.fetch_ticker(Ccxtex.Port, exchange, symbol)
<p dir="auto">Return value example:
<pre><code>%{
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]
}
<p dir="auto"><center> (*`□)<炎炎炎炎
Thanks for the contribution!
Looks like a cool project! The commit messages are great and it looks like quite a lot of work went into it, so keep it up!
One thing that is always appreciated is including a link to a PR or a comparison like this for example. It would also be cool if you could tell a bit more about how you implemented the features (just my opinion, as I am curious myself).
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.
Chat with us on Discord.
[utopian-moderator]Need help? Write a ticket on https://support.utopian.io/.
Thanks for the review, @amosbastian! Got it, will include commit history comparison in the future posts.
Yeah, thanks for the suggestion, I'm planning to maybe do a tutorial on Elixir/Python interop after a few iterations of the library.
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!Hey @ontofractal
Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!