class BitmexClient::HTTP::Private::Client

Public Class Methods

new(key, secret) click to toggle source
# File lib/bitmex_client/http/private.rb, line 6
def initialize(key, secret)
  @connection = Connection.new(key, secret)
end

Public Instance Methods

cancel_all_order() click to toggle source

@see www.bitmex.com/api/explorer/#!/Order/Order_cancelAll

# File lib/bitmex_client/http/private.rb, line 41
def cancel_all_order
  @connection.delete('/api/v1/order/all').body
end
cancel_order(id, cid) click to toggle source

@see www.bitmex.com/api/explorer/#!/Order/Order_cancel

# File lib/bitmex_client/http/private.rb, line 36
def cancel_order(id, cid)
  @connection.delete('/api/v1/order', {orderID: id, clOrdID: cid }).body
end
close_position(symbol, price = nil) click to toggle source

@see www.bitmex.com/api/explorer/#!/Order/Order_closePosition

# File lib/bitmex_client/http/private.rb, line 51
def close_position(symbol, price = nil)
  options = {
    symbol: symbol,
    price: price
  }.delete_if { |_, v| v.nil? }
  @connection.post('/api/v1/order/closePosition', options).body
end
create_order(symbol, order_qty, options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Order/Order_new

# File lib/bitmex_client/http/private.rb, line 31
def create_order(symbol, order_qty, options = {})
  @connection.post('/api/v1/order', { symbol: symbol, orderQty: order_qty }.merge(options)).body
end
execution(options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Execution/Execution_get

# File lib/bitmex_client/http/private.rb, line 11
def execution(options = {})
  @connection.get('/api/v1/execution', options).body
end
execution_trade_history(options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory

# File lib/bitmex_client/http/private.rb, line 16
def execution_trade_history(options = {})
  @connection.get('/api/v1/execution/tradeHistory', options).body
end
leaderboard_name() click to toggle source

@see www.bitmex.com/api/explorer/#!/Leaderboard/Leaderboard_getName

# File lib/bitmex_client/http/private.rb, line 21
def leaderboard_name
  @connection.get('/api/v1/leaderboard/name').body
end
order(options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Order/Order_getOrders

# File lib/bitmex_client/http/private.rb, line 26
def order(options = {})
  @connection.get('/api/v1/order', options).body
end
position(options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Position/Position_get

# File lib/bitmex_client/http/private.rb, line 46
def position(options = {})
  @connection.get('/api/v1/position', options).body
end
trade_bucketed(bin_size = '1m', options = {}) click to toggle source

@see www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed

# File lib/bitmex_client/http/private.rb, line 60
def trade_bucketed(bin_size = '1m', options = {})
  @connection.get('/api/v1/trade/bucketed', { binSize: bin_size }.merge(options)).body
end
user() click to toggle source

@see www.bitmex.com/api/explorer/#!/User/User_get

# File lib/bitmex_client/http/private.rb, line 65
def user
  @connection.get('/api/v1/user').body
end
user_affiliate_status() click to toggle source

@see www.bitmex.com/api/explorer/#!/User/User_getAffiliateStatus

# File lib/bitmex_client/http/private.rb, line 70
def user_affiliate_status
  @connection.get('/api/v1/user/affiliateStatus').body
end
user_wallet(currency = 'XBt') click to toggle source

@see www.bitmex.com/api/explorer/#!/User/User_getWallet

# File lib/bitmex_client/http/private.rb, line 75
def user_wallet(currency = 'XBt')
  @connection.get('/api/v1/user/wallet', { currency: currency }).body
end
user_wallet_history(currency = 'XBt') click to toggle source

@see www.bitmex.com/api/explorer/#!/User/User_getWalletHistory

# File lib/bitmex_client/http/private.rb, line 80
def user_wallet_history(currency = 'XBt')
  @connection.get('/api/v1/user/walletHistory', { currency: currency }).body
end
user_wallet_summary(currency = 'XBt') click to toggle source

@see www.bitmex.com/api/explorer/#!/User/User_getWalletSummary

# File lib/bitmex_client/http/private.rb, line 85
def user_wallet_summary(currency = 'XBt')
  @connection.get('/api/v1/user/walletSummary', { currency: currency }).body
end