Module: Binance::Client::REST::Account_API

Included in:
Binance::Client::REST
Defined in:
lib/binance/client/rest/account_api.rb

Overview

API endpoints that require a timestamp and signature

Instance Method Summary collapse

Instance Method Details

#account_apiObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/binance/client/rest/account_api.rb', line 12

def 
  Faraday.new(url: "#{BASE_URL}/api/v3") do |conn|
    conn.request :json
    conn.response :json, content_type: /\bjson$/
    conn.headers['X-MBX-APIKEY'] = @api_key
    conn.use TimestampRequestMiddleware
    conn.use SignRequestMiddleware, @secret_key
    conn.adapter Faraday.default_adapter
  end
end

#account_info(options = {}) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/binance/client/rest/account_api.rb', line 63

def (options = {})
  response = .get do |req|
    req.url 'account'
    req.params.merge! options
  end
  response.body
end

#account_trade_list(options) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/binance/client/rest/account_api.rb', line 71

def (options)
  response = .get do |req|
    req.url 'myTrades'
    req.params.merge! options
  end
  response.body
end

#all_orders(options) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/binance/client/rest/account_api.rb', line 55

def all_orders(options)
  response = .get do |req|
    req.url 'allOrders'
    req.params.merge! options
  end
  response.body
end

#cancel_order(options) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/binance/client/rest/account_api.rb', line 39

def cancel_order(options)
  response = .delete do |req|
    req.url 'order'
    req.params.merge! options
  end
  response.body
end

#create_order(options) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/binance/client/rest/account_api.rb', line 23

def create_order(options)
  response = .post do |req|
    req.url 'order'
    req.params.merge! options
  end
  response.body
end

#open_orders(options) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/binance/client/rest/account_api.rb', line 47

def open_orders(options)
  response = .get do |req|
    req.url 'openOrders'
    req.params.merge! options
  end
  response.body
end

#query_order(options) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/binance/client/rest/account_api.rb', line 31

def query_order(options)
  response = .get do |req|
    req.url 'order'
    req.params.merge! options
  end
  response.body
end