package gemini
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=272dee4881951e559c66dc65d524373132d592af70c5612ae6ce9845956a4b77
sha512=2f6e73ee03d688d7b6f0fd3ec97c67d9bdfee03868ec45c28acb58a7cf71f50f070020f335531c476b11354dff0393cb2d8084e28747d0d5bd8e1ce2a603f0ea
README.md.html
Introduction
This library implements the Gemini exchange v1 REST, Market Data, and Order events websockets services. It is backed by 'yojson', cohttp-async
and cohttp_async_websocket
to do the heavy lifting. A provisional console interface is also provided using s-expressions to encode request parameters.
Installation
From your project directory run
opam pin . -y
You can also build the code locally with make or dune.
Api Documentation
The autogenerated api documentation is here.
Configuration
Default environment property
export GEMINI_ENV=production
or
export GEMINI_ENV=sandbox
Sandbox properties
export GEMINI_SANDBOX_API_KEY=...
export GEMINI_SANDBOX_API_SECRET=...
Production properties
export GEMINI_PRODUCTION_API_SECRET=...
export GEMINI_PRODUCTION_API_KEY=...
Example command line usage
gemini tradevolume
2018-03-30 22:01:44.029835-04:00 Info response:
((((account_id 123456) (symbol Ethusd) (base_currency Eth)
(notional_currency Usd) (data_date 2018-03-07)
(total_volume_base 1.35528896) (maker_buy_sell_ratio 0) (buy_maker_base 0)
(buy_maker_notional 0) (buy_maker_count 0) (sell_maker_base 0)
(sell_maker_notional 0) (sell_maker_count 0) (buy_taker_base 1.35528896)
(buy_taker_notional 997.5062274496) (buy_taker_count 1)
(sell_taker_base 0) (sell_taker_notional 0) (sell_taker_count 0))
((account_id 123456) (symbol Ethusd) (base_currency Eth)
(notional_currency Usd) (data_date 2018-03-12)
(total_volume_base 0.30208043) (maker_buy_sell_ratio 0) (buy_maker_base 0)
(buy_maker_notional 0) (buy_maker_count 0) (sell_maker_base 0)
(sell_maker_notional 0) (sell_maker_count 0) (buy_taker_base 0.80208043)
(buy_taker_notional 428.72431038315204) (buy_taker_count 10)
(sell_taker_base 0) (sell_taker_notional 0) (sell_taker_count 0))
....
gemini order new '((symbol Ethusd) (price 500.0) (amount .001) (type_ Exchange_limit) (client_order_id "test-order") (options ()) (side Sell))'
2018-03-30 22:18:01.210962-04:00 Info response:
((client_order_id (test-order)) (order_id 1392122353) (id 1190026576)
(symbol Ethusd) (exchange Gemini) (avg_execution_price 0.00) (side Sell)
(type_ Exchange_limit) (timestamp (2018-03-30 22:18:01.000000-04:00))
(timestampms (2018-03-30 22:18:01.198000-04:00)) (is_live true)
(is_cancelled false) (is_hidden false) (was_forced false)
(executed_amount 0) (remaining_amount 0.001) (options ()) (price 500.00)
(original_amount 0.001))
License
MIT
Features and Bugs
Open issues on github. I am too busy to add new features personally but will review and accept PRs when time permits.
TODO
[x] order status web sockets api
[x] fix unit test harness
[x] document code
[x] make opam release
[ ] rich cli support for order commands
[ ] write to binary format instead of csv
[ ] switch to eio where applicable
[ ] integration test against sandbox environment