BitMEX API Client for Elixir
BitMEX API Client for Elixir
Add the ex_bitmex
package to your list of dependencies in mix.exs
:
def deps do
[{:ex_bitmex, "~> 0.6"}]
end
# Public
{:ok, instruments, rate_limit} = ExBitmex.Rest.Instrument.Index.get(start: 0, count: 20)
# Private
credentials = %ExBitmex.Credentials{
api_key: System.get_env("BITMEX_API_KEY"),
api_secret: System.get_env("BITMEX_API_SECRET")
}
{:ok, positions, rate_limit} = ExBitmex.Rest.Position.Index.get(credentials)
Create a WebSocket wrapper with a handler
defmodule BitMexWebSocketWrapper do
use ExBitmex.WebSocket
def handle_response(json, _state) do
Logger.warn("Received #{inspect(json)}")
end
end
GET /announcement
GET /announcement/urgent
GET /apiKey
GET /chat
POST /chat
GET /chat/channels
GET /chat/connected
GET /execution
GET /execution/tradeHistory
GET /funding
GET /globalNotification
GET /instrument
GET /instrument/active
GET /instrument/activeAndIndices
GET /instrument/activeIntervals
GET /instrument/compositeIndex
GET /instrument/indicies
GET /insurance
GET /leaderboard
GET /leaderboard/name
GET /liquidation
GET /order
PUT /order
POST /order
DELETE /order
DELETE /order/all
PUT /order/bulk
POST /order/bulk
POST /order/cancelAllAfter
POST /order/closePosition
GET /orderBook/L2
GET /position
POST /position/isolate
POST /position/leverage
POST /position/riskLimit
POST /position/transferMargin
GET /quote
GET /quote/bucketed
GET /schema
GET /schema/websocketHelp
GET /settlement
GET /stats
GET /stats/history
GET /stats/historyUSD
GET /trade
GET /trade/bucketed
GET /user
GET /user/affiliateStatus
POST /user/cancelWithdrawal
GET /user/checkReferralCode
GET /user/commmission
POST /user/communicationToken
POST /user/confirmEmail
POST /user/confirmWithdrawal
GET /user/depositAddress
GET /user/executionHistory
POST /user/logout
GET /user/margin
GET /user/minWithdrawalFee
POST /user/preferences
GET /user/quoteFillRatio
POST /user/requestWithdrawal
GET /user/wallet
GET /user/walletHistory
GET /user/walletSummary
GET /userEvent