Class: BitmexClient::HTTP::Private::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmex_client/http/private.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, secret) ⇒ Client

Returns a new instance of Client.



6
7
8
# File 'lib/bitmex_client/http/private.rb', line 6

def initialize(key, secret)
  @connection = Connection.new(key, secret)
end

Instance Method Details

#cancel_all_orderObject



41
42
43
# 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) ⇒ Object



36
37
38
# 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) ⇒ Object



51
52
53
54
55
56
57
# 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 = {}) ⇒ Object



31
32
33
# 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 = {}) ⇒ Object



11
12
13
# File 'lib/bitmex_client/http/private.rb', line 11

def execution(options = {})
  @connection.get('/api/v1/execution', options).body
end

#execution_trade_history(options = {}) ⇒ Object



16
17
18
# File 'lib/bitmex_client/http/private.rb', line 16

def execution_trade_history(options = {})
  @connection.get('/api/v1/execution/tradeHistory', options).body
end

#leaderboard_nameObject



21
22
23
# File 'lib/bitmex_client/http/private.rb', line 21

def leaderboard_name
  @connection.get('/api/v1/leaderboard/name').body
end

#order(options = {}) ⇒ Object



26
27
28
# File 'lib/bitmex_client/http/private.rb', line 26

def order(options = {})
  @connection.get('/api/v1/order', options).body
end

#position(options = {}) ⇒ Object



46
47
48
# 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 = {}) ⇒ Object



60
61
62
# 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

#userObject



65
66
67
# File 'lib/bitmex_client/http/private.rb', line 65

def user
  @connection.get('/api/v1/user').body
end

#user_affiliate_statusObject



70
71
72
# 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') ⇒ Object



75
76
77
# 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') ⇒ Object



80
81
82
# 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') ⇒ Object



85
86
87
# 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