bitmex alternatives and similar packages
Based on the "Third Party APIs" category.
Alternatively, view bitmex alternatives based on common mentions on social networks and blogs.
-
MongoosePush
MongoosePush is a simple Elixir RESTful service allowing to send push notification via FCM and/or APNS. -
sparkpost
SparkPost client library for Elixir https://developers.sparkpost.com -
elixtagram
:camera: Instagram API client for the Elixir language (elixir-lang) -
google_sheets
Elixir library for fetching Google Spreadsheet data in CSV format -
pay_pal
:money_with_wings: PayPal REST API client for the Elixir language (elixir-lang) -
amazon_product_advertising_client
An Amazon Product Advertising API client for Elixir -
cashier
Cashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP -
elixir_ipfs_api
The Elixir library that is used to communicate with the IPFS REST endpoint.
Updating dependencies is time-consuming.
Do you think we are missing an alternative of bitmex or a related project?
README
BitMEX
BitMEX client library for Elixir.
Documentation
See the online documentation for more information.
Installation
Add :bitmex to your list of dependencies in mix.exs:
def deps do
[{:bitmex, "~> 0.2"}]
end
Add your app's api_key
and api_secret
to config/config.exs
:
config :bitmex, api_key: ""
config :bitmex, api_secret: ""
config :bitmex, test_mode: false
Set test_mode
to true if you want to simulate your app using BitMEX Testnet instead of the production version.
REST API
You may call methods in modules Bitmex.Rest.*
(eg. Bitmex.Rest.OrderBook
) to access the REST API.
View the Hex Documentation and BitMEX API Explorer for a full list of endpoints and return types.
Usage Examples
Position
Get the current position:
Bitmex.Rest.Position.get()
Orders
Get all your open orders:
Bitmex.REST.Order.get_open()
Create a order:
params_bi = %{"symbol" => "XBTUSD", "side" => "Buy", "orderQty" => 15,
"ordType" => "Market"}
Bitmex.Rest.Order.create(params_bi)
Create a bulk order:
p1 = %{"symbol" => "XBTUSD", "side" => "Buy", "orderQty" => 15,
"price" => 4000.1, "ordType" => "Limit"}
Bitmex.Rest.Order.create_bulk(%{orders: [p1, p1]})
Rate Limit
You may query the rate limit counter using Bitmex.Rest.RateLimiter.remaining()
. It automatically logs the rate limit info responded from your last REST API request.
WebSocket API
To enable WebSocket subscriptions, use Bitmex.WS
module and override the handle_response
function:
defmodule Caravan.WS.MessageHandler do
use Bitmex.WS
def handle_response(resp), do: Caravan.WS.process(resp)
end
defmodule Caravan.WS do
require Logger
import Task.Supervisor, only: [start_child: 2]
# API
def start_link(opts \\ []) do
Agent.start_link(fn -> [] end, opts)
end
def process(resp) do
Agent.cast(__MODULE__, fn _ ->
start_child(TemporaryTaskSup, fn -> handle_response(resp) end)
[]
end)
end
# Your callbacks
@doc """
Handles order book data.
"""
def handle_response(%{"table" => "orderBook10", "action" => action,
"data" => datums}) do
# ...
end
@doc """
Handles position data.
"""
def handle_response(%{"table" => "position", "action" => action,
"data" => datums}) do
# ...
end
@doc """
Handles margin data.
"""
def handle_response(%{"table" => "margin", "action" => _action,
"data" => [_datum]}) do
# ...
end
@doc """
Handles order data.
"""
def handle_response(%{"table" => "order", "action" => action,
"data" => datums}) do
# ...
end
@doc """
Handles table subscriptions.
"""
def handle_response(%{"request" => %{"op" => "subscribe"},
"subscribe" => table, "success" => true}) do
Logger.info "Subscribed #{table}"
# ...
end
@doc """
Handles unexpected data.
"""
def handle_response(resp) do
Logger.warn inspect(resp, limit: 500)
# ...
end
end
License
*Note that all licence references and agreements mentioned in the bitmex README section above
are relevant to that project's source code only.