Skip to content

fremantle-industries/ex_bitmex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExBitmex

Build Status Coverage Status hex.pm version

BitMEX API Client for Elixir

Installation

Add the ex_bitmex package to your list of dependencies in mix.exs:

def deps do
  [{:ex_bitmex, "~> 0.6"}]
end

Usage

# 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)

WebSocket

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

REST Status

Announcement

  • GET /announcement
  • GET /announcement/urgent

APIKey

  • GET /apiKey

Chat

  • GET /chat
  • POST /chat
  • GET /chat/channels
  • GET /chat/connected

Execution

  • GET /execution
  • GET /execution/tradeHistory

Funding

  • GET /funding

GlobalNotification

  • GET /globalNotification

Instrument

  • GET /instrument
  • GET /instrument/active
  • GET /instrument/activeAndIndices
  • GET /instrument/activeIntervals
  • GET /instrument/compositeIndex
  • GET /instrument/indicies

Insurance

  • GET /insurance

Leaderboard

  • GET /leaderboard
  • GET /leaderboard/name

Liquidation

  • GET /liquidation

Order

  • GET /order
  • PUT /order
  • POST /order
  • DELETE /order
  • DELETE /order/all
  • PUT /order/bulk
  • POST /order/bulk
  • POST /order/cancelAllAfter
  • POST /order/closePosition

OrderBook

  • GET /orderBook/L2

Position

  • GET /position
  • POST /position/isolate
  • POST /position/leverage
  • POST /position/riskLimit
  • POST /position/transferMargin

Quote

  • GET /quote
  • GET /quote/bucketed

Schema

  • GET /schema
  • GET /schema/websocketHelp

Settlement

  • GET /settlement

Stats

  • GET /stats
  • GET /stats/history
  • GET /stats/historyUSD

Trade

  • GET /trade
  • GET /trade/bucketed

User

  • 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

UserEvent

  • GET /userEvent