binance-ruby 0.4 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 187b7d39acf68364d1b7117bab98bcb580bfb7f771d9f8cc5e54108fc57545da
4
- data.tar.gz: bbfd2f1b1dc3df0ad9be8a5c6aa7c18aea49b44f56ff1e72da6ebc4e6a24d5a9
3
+ metadata.gz: '09f5f77206284ebedb2a0f1d95e8c82c332362ad5c447244081c52447754da65'
4
+ data.tar.gz: 17ade78a7eaff0f6d8d4538cebde68877c4e0b6e6838f844068fefb3d60c5957
5
5
  SHA512:
6
- metadata.gz: 77e1563be39775bc8dbfc21f349571a17a08b87e81262fc6f90dc2164445088ffdb47672ac61f750fb73f92c318654f6b0e5b6a742fce24c03b662b31a540ebb
7
- data.tar.gz: 5524b974767756f2da4984c6d7dcdfafe1dbcd40a8b3781b8b7552c3cb070516061fef2821d6fd673bcebdff8be9999d5c8217159ac5c460d35a17fcb6b8c5c0
6
+ metadata.gz: ae97db01f0ca888aa4c0ff933455286934a0526cc19beeddd1ce23b992f884ae3ae6a4f3d2137f992b1dd4182ff2377bcec85bacdc02126926dea85d7546e259
7
+ data.tar.gz: 07d4309dc23201d4bb120353a14caece000904535297fdd15f07efcea2c854a9c0688ed9891cc420ee77b156780c91ac41862049596c682b6ea74389e81ede29
@@ -1,12 +1,15 @@
1
- require 'active_support/core_ext/string'
2
- require 'awrence'
3
- require 'httparty'
1
+ require "active_support/core_ext/string"
2
+ require "awrence"
3
+ require "httparty"
4
4
 
5
- require 'binance/api'
6
- require 'binance/api/account'
7
- require 'binance/api/configuration'
8
- require 'binance/api/data_stream'
9
- require 'binance/api/error'
10
- require 'binance/api/order'
11
- require 'binance/api/request'
5
+ require "binance/api"
6
+ require "binance/api/account"
7
+ require "binance/api/configuration"
8
+ require "binance/api/data_stream"
9
+ require "binance/api/error"
10
+ require "binance/api/margin"
11
+ require "binance/api/margin/account"
12
+ require "binance/api/margin/order"
13
+ require "binance/api/order"
14
+ require "binance/api/request"
12
15
  require "binance/api/version"
@@ -3,49 +3,49 @@ module Binance
3
3
  class << self
4
4
  # Valid limits:[5, 10, 20, 50, 100, 500, 1000]
5
5
  def candlesticks!(endTime: nil, interval: nil, limit: 500, startTime: nil, symbol: nil)
6
- raise Error.new(message: 'interval is required') unless interval
7
- raise Error.new(message: 'symbol is required') unless symbol
6
+ raise Error.new(message: "interval is required") unless interval
7
+ raise Error.new(message: "symbol is required") unless symbol
8
8
  params = { endTime: endTime, interval: interval, limit: limit, startTime: startTime, symbol: symbol }
9
- Request.send!(api_key_type: :read_info, path: '/api/v1/klines', params: params)
9
+ Request.send!(api_key_type: :read_info, path: "/api/v1/klines", params: params)
10
10
  end
11
11
 
12
12
  def compressed_aggregate_trades!(endTime: nil, fromId: nil, limit: 500, startTime: nil, symbol: nil)
13
13
  raise Error.new(message: "symbol is required") unless symbol
14
14
  params = {
15
- endTime: endTime, fromId: fromId, limit: limit, startTime: startTime, symbol: symbol
15
+ endTime: endTime, fromId: fromId, limit: limit, startTime: startTime, symbol: symbol,
16
16
  }.delete_if { |key, value| value.nil? }
17
- Request.send!(api_key_type: :read_info, path: '/api/v1/aggTrades', params: params)
17
+ Request.send!(api_key_type: :read_info, path: "/api/v1/aggTrades", params: params)
18
18
  end
19
19
 
20
20
  def depth!(symbol: nil, limit: 100)
21
21
  raise Error.new(message: "symbol is required") unless symbol
22
22
  params = { limit: limit, symbol: symbol }
23
- Request.send!(api_key_type: :read_info, path: '/api/v1/depth', params: params)
23
+ Request.send!(api_key_type: :read_info, path: "/api/v1/depth", params: params)
24
24
  end
25
25
 
26
26
  def exchange_info!
27
- Request.send!(api_key_type: :read_info, path: '/api/v1/exchangeInfo')
27
+ Request.send!(api_key_type: :read_info, path: "/api/v1/exchangeInfo")
28
28
  end
29
29
 
30
30
  def historical_trades!(symbol: nil, limit: 500, fromId: nil)
31
31
  raise Error.new(message: "symbol is required") unless symbol
32
32
  params = { fromId: fromId, limit: limit, symbol: symbol }
33
- Request.send!(api_key_type: :read_info, path: '/api/v1/historicalTrades', params: params, security_type: :market_data)
33
+ Request.send!(api_key_type: :read_info, path: "/api/v1/historicalTrades", params: params, security_type: :market_data)
34
34
  end
35
35
 
36
36
  def info!(recvWindow: nil)
37
37
  timestamp = Configuration.timestamp
38
38
  params = { recvWindow: recvWindow, timestamp: timestamp }.delete_if { |key, value| value.nil? }
39
- Request.send!(api_key_type: :read_info, path: '/api/v3/account', params: params, security_type: :user_data)
39
+ Request.send!(api_key_type: :read_info, path: "/api/v3/account", params: params, security_type: :user_data)
40
40
  end
41
41
 
42
42
  def ping!
43
- Request.send!(path: '/api/v1/ping')
43
+ Request.send!(path: "/api/v1/ping")
44
44
  end
45
45
 
46
46
  def ticker!(symbol: nil, type: nil)
47
47
  ticker_type = type&.to_sym
48
- error_message = "type must be one of: #{ticker_types.join(', ')}. #{type} was provided."
48
+ error_message = "type must be one of: #{ticker_types.join(", ")}. #{type} was provided."
49
49
  raise Error.new(message: error_message) unless ticker_types.include? ticker_type
50
50
  path = ticker_path(type: ticker_type)
51
51
  params = symbol ? { symbol: symbol } : {}
@@ -53,13 +53,13 @@ module Binance
53
53
  end
54
54
 
55
55
  def time!
56
- Request.send!(path: '/api/v1/time')
56
+ Request.send!(path: "/api/v1/time")
57
57
  end
58
58
 
59
59
  def trades!(symbol: nil, limit: 500)
60
60
  raise Error.new(message: "symbol is required") unless symbol
61
61
  params = { limit: limit, symbol: symbol }
62
- Request.send!(api_key_type: :read_info, path: '/api/v1/trades', params: params)
62
+ Request.send!(api_key_type: :read_info, path: "/api/v1/trades", params: params)
63
63
  end
64
64
 
65
65
  private
@@ -67,8 +67,8 @@ module Binance
67
67
  def ticker_path(type:)
68
68
  case type
69
69
  when :daily
70
- '/api/v1/ticker/24hr'
71
- when :price, :bookTicker
70
+ "/api/v1/ticker/24hr"
71
+ when :price, :bookTicker, :avgPrice
72
72
  "/api/v3/ticker/#{type.to_s.camelize(:lower)}"
73
73
  end
74
74
  end
@@ -1,43 +1,58 @@
1
- require 'openssl'
2
- require 'base64'
1
+ require "openssl"
2
+ require "base64"
3
3
 
4
4
  module Binance
5
5
  module Api
6
6
  class Configuration
7
7
  class << self
8
- attr_writer :api_key, :read_info_api_key, :trading_api_key, :withdrawals_api_key
9
- attr_writer :secret_key
10
-
8
+ attr_writer :api_key, :locale, :read_info_api_key, :secret_key,
9
+ :trading_api_key, :withdrawals_api_key
10
+
11
11
  def api_key(type: nil)
12
12
  raise Error.new(message: "invalid security_type type: #{type}.") unless type.nil? || api_key_types.include?(type)
13
13
  instance_api_key(type: type) || ENV["BINANCE_#{type.to_s.humanize.upcase}_API_KEY"] ||
14
- instance_api_key || ENV["BINANCE_API_KEY"]
14
+ instance_api_key || ENV["BINANCE_API_KEY"]
15
+ end
16
+
17
+ def tld
18
+ tld = ENV["BINANCE_TLD"]&.downcase&.to_sym || :com
19
+ validate_tld!(tld)
20
+ tld
15
21
  end
16
-
22
+
17
23
  def secret_key
18
- instance_variable_get("@secret_key") || ENV['BINANCE_SECRET_KEY']
24
+ instance_variable_get("@secret_key") || ENV["BINANCE_SECRET_KEY"]
19
25
  end
20
26
 
21
27
  def signed_request_signature(payload:)
22
28
  raise Error.new(message: "environment variable 'BINANCE_SECRET_KEY' is required " \
23
- "for signed requests.") unless secret_key
29
+ "for signed requests.") unless secret_key
24
30
  digest = OpenSSL::Digest::SHA256.new
25
31
  OpenSSL::HMAC.hexdigest(digest, secret_key, payload)
26
32
  end
27
33
 
28
34
  def timestamp
29
- Time.now.utc.strftime('%s%3N')
35
+ Time.now.utc.strftime("%s%3N")
36
+ end
37
+
38
+ def validate_tld!(tld)
39
+ error_message = "Invalid tld (top-level-domain): #{tld}. Use one of: #{allowed_tlds.join(", ")}."
40
+ raise Error.new(message: error_message) unless allowed_tlds.include?(tld&.to_sym)
30
41
  end
31
42
 
32
43
  private
33
44
 
45
+ def allowed_tlds
46
+ [:com, :us]
47
+ end
48
+
34
49
  def api_key_types
35
50
  [:none, :read_info, :trading, :withdrawals].freeze
36
51
  end
37
52
 
38
53
  def instance_api_key(type: nil)
39
- var = "#{type.to_s.downcase}_api_key".sub(/^\_/, '')
40
- instance_variable_get('@' + var)
54
+ var = "#{type.to_s.downcase}_api_key".sub(/^\_/, "")
55
+ instance_variable_get("@" + var)
41
56
  end
42
57
  end
43
58
  end
@@ -1,7 +1,7 @@
1
1
  module Binance
2
2
  module Api
3
3
  class Error < StandardError
4
- attr_reader :code, :msg
4
+ attr_reader :code, :msg, :symbol
5
5
 
6
6
  class << self
7
7
  # https://github.com/binance-exchange/binance-official-api-docs/blob/master/errors.md
@@ -10,9 +10,10 @@ module Binance
10
10
  end
11
11
  end
12
12
 
13
- def initialize(code: nil, json: {}, message: nil)
13
+ def initialize(code: nil, json: {}, message: nil, symbol: nil)
14
14
  @code = code || json[:code]
15
15
  @msg = message || json[:msg]
16
+ @symbol = message || json[:symbol]
16
17
  end
17
18
 
18
19
  def inspect
@@ -0,0 +1,43 @@
1
+ module Binance
2
+ module Api
3
+ module Margin
4
+ class << self
5
+ # Your Margin Wallet balance determines the amount of funds you can borrow,
6
+ # following a fixed rate of 5:1 (5x).
7
+ def borrow!(asset: nil, amount: nil, recvWindow: nil)
8
+ timestamp = Configuration.timestamp
9
+ params = {
10
+ asset: asset, amount: amount, recvWindow: recvWindow, timestamp: timestamp,
11
+ }.delete_if { |_, value| value.nil? }
12
+ ensure_required_keys!(params: params)
13
+ path = "/sapi/v1/margin/loan"
14
+ Request.send!(api_key_type: :trading, method: :post, path: path,
15
+ params: params, security_type: :margin, tld: Configuration.tld)
16
+ end
17
+
18
+ def repay!(asset: nil, isIsolated: nil, amount: nil, recvWindow: nil)
19
+ timestamp = Configuration.timestamp
20
+ params = {
21
+ asset: asset, amount: amount, recvWindow: recvWindow, timestamp: timestamp,
22
+ }.delete_if { |_, value| value.nil? }
23
+ ensure_required_keys!(params: params)
24
+ path = "/sapi/v1/margin/repay"
25
+ Request.send!(api_key_type: :trading, method: :post, path: path,
26
+ params: params, security_type: :margin, tld: Configuration.tld)
27
+ end
28
+
29
+ private
30
+
31
+ def ensure_required_keys!(params:)
32
+ keys = required_margin_keys.dup
33
+ missing_keys = keys.select { |key| params[key].nil? }
34
+ raise Error.new(message: "required keys are missing: #{missing_keys.join(", ")}") unless missing_keys.empty?
35
+ end
36
+
37
+ def required_margin_keys
38
+ [:asset, :amount, :timestamp].freeze
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,32 @@
1
+ module Binance
2
+ module Api
3
+ module Margin
4
+ class Account
5
+ class << self
6
+ def transfer!(asset: nil, amount: nil, type: nil, recvWindow: nil)
7
+ timestamp = Configuration.timestamp
8
+ params = {
9
+ asset: asset, amount: amount, type: type, recvWindow: recvWindow, timestamp: timestamp,
10
+ }.delete_if { |_, value| value.nil? }
11
+ ensure_required_create_keys!(params: params)
12
+ path = "/sapi/v1/margin/transfer"
13
+ Request.send!(api_key_type: :trading, method: :post, path: path,
14
+ params: params, security_type: :margin, tld: Configuration.tld)
15
+ end
16
+
17
+ private
18
+
19
+ def ensure_required_create_keys!(params:)
20
+ keys = required_create_keys.dup
21
+ missing_keys = keys.select { |key| params[key].nil? }
22
+ raise Error.new(message: "required keys are missing: #{missing_keys.join(", ")}") unless missing_keys.empty?
23
+ end
24
+
25
+ def required_create_keys
26
+ [:asset, :amount, :type, :timestamp].freeze
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,77 @@
1
+ module Binance
2
+ module Api
3
+ module Margin
4
+ class Order
5
+ class << self
6
+ def cancel!(symbol: nil, isIsolated: false, orderId: nil, origClientOrderId: nil,
7
+ newClientOrderId: nil, recvWindow: nil)
8
+ timestamp = Configuration.timestamp
9
+ params = {
10
+ symbol: symbol, isIsolated: isIsolated, orderId: orderId, origClientOrderId: origClientOrderId,
11
+ newClientOrderId: newClientOrderId, recvWindow: recvWindow, timestamp: timestamp,
12
+ }.delete_if { |_, value| value.nil? }
13
+ ensure_required_cancel_keys!(params: params)
14
+ path = "/sapi/v1/margin/order"
15
+ Request.send!(api_key_type: :trading, method: :delete, path: path,
16
+ params: params, security_type: :margin, tld: Configuration.tld)
17
+ end
18
+
19
+ def create!(symbol: nil, isIsolated: false, side: nil, type: nil, quantity: nil,
20
+ quoteOrderQty: nil, price: nil, stopPrice: nil, newClientOrderId: nil,
21
+ icebergQty: nil, newOrderRespType: nil, sideEffectType: nil, timeInForce: nil,
22
+ recvWindow: nil)
23
+ timestamp = Configuration.timestamp
24
+ params = {
25
+ symbol: symbol, isIsolated: isIsolated, side: side, type: type,
26
+ quantity: quantity, quoteOrderQty: quoteOrderQty, price: price,
27
+ stopPrice: stopPrice, newClientOrderId: newClientOrderId, icebergQty: icebergQty,
28
+ newOrderRespType: newOrderRespType, sideEffectType: sideEffectType,
29
+ timeInForce: timeInForce, recvWindow: recvWindow, timestamp: timestamp,
30
+ }.delete_if { |_, value| value.nil? }
31
+ ensure_required_create_keys!(params: params)
32
+ path = "/sapi/v1/margin/order"
33
+ Request.send!(api_key_type: :trading, method: :post, path: path,
34
+ params: params, security_type: :margin, tld: Configuration.tld)
35
+ end
36
+
37
+ private
38
+
39
+ def additional_required_create_keys(type:)
40
+ case type
41
+ when :limit
42
+ [:price, :timeInForce].freeze
43
+ when :stop_loss, :take_profit
44
+ [:stopPrice].freeze
45
+ when :stop_loss_limit, :take_profit_limit
46
+ [:price, :stopPrice, :timeInForce].freeze
47
+ when :limit_maker
48
+ [:price].freeze
49
+ else
50
+ [].freeze
51
+ end
52
+ end
53
+
54
+ def ensure_required_create_keys!(params:)
55
+ keys = required_create_keys.dup.concat(additional_required_create_keys(type: params[:type]))
56
+ missing_keys = keys.select { |key| params[key].nil? }
57
+ raise Error.new(message: "required keys are missing: #{missing_keys.join(", ")}") unless missing_keys.empty?
58
+ end
59
+
60
+ def required_create_keys
61
+ [:symbol, :side, :type, :timestamp].freeze
62
+ end
63
+
64
+ def ensure_required_cancel_keys!(params:)
65
+ keys = required_cancel_keys.dup
66
+ missing_keys = keys.select { |key| params[key].nil? }
67
+ raise Error.new(message: "required keys are missing: #{missing_keys.join(", ")}") unless missing_keys.empty?
68
+ end
69
+
70
+ def required_cancel_keys
71
+ [:symbol, :timestamp].freeze
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -9,56 +9,56 @@ module Binance
9
9
  params = { limit: limit, orderId: orderId, recvWindow: recvWindow, symbol: symbol, timestamp: timestamp }
10
10
  Request.send!(api_key_type: :read_info, path: "/api/v3/allOrders",
11
11
  params: params.delete_if { |key, value| value.nil? },
12
- security_type: :user_data)
12
+ security_type: :user_data, tld: Configuration.tld)
13
13
  end
14
14
 
15
15
  # Be careful when accessing without a symbol!
16
16
  def all_open!(recvWindow: 5000, symbol: nil)
17
17
  timestamp = Configuration.timestamp
18
18
  params = { recvWindow: recvWindow, symbol: symbol, timestamp: timestamp }
19
- Request.send!(api_key_type: :read_info, path: '/api/v3/openOrders',
20
- params: params, security_type: :user_data)
19
+ Request.send!(api_key_type: :read_info, path: "/api/v3/openOrders",
20
+ params: params, security_type: :user_data, tld: Configuration.tld)
21
21
  end
22
22
 
23
23
  def cancel!(orderId: nil, originalClientOrderId: nil, newClientOrderId: nil, recvWindow: nil, symbol: nil)
24
24
  raise Error.new(message: "symbol is required") if symbol.nil?
25
25
  raise Error.new(message: "either orderid or originalclientorderid " \
26
- "is required") if orderId.nil? && originalClientOrderId.nil?
26
+ "is required") if orderId.nil? && originalClientOrderId.nil?
27
27
  timestamp = Configuration.timestamp
28
28
  params = { orderId: orderId, origClientOrderId: originalClientOrderId,
29
29
  newClientOrderId: newClientOrderId, recvWindow: recvWindow,
30
30
  symbol: symbol, timestamp: timestamp }.delete_if { |key, value| value.nil? }
31
31
  Request.send!(api_key_type: :trading, method: :delete, path: "/api/v3/order",
32
- params: params, security_type: :trade)
32
+ params: params, security_type: :trade, tld: Configuration.tld)
33
33
  end
34
34
 
35
35
  def create!(icebergQuantity: nil, newClientOrderId: nil, newOrderResponseType: nil,
36
36
  price: nil, quantity: nil, recvWindow: nil, stopPrice: nil, symbol: nil,
37
37
  side: nil, type: nil, timeInForce: nil, test: false)
38
38
  timestamp = Configuration.timestamp
39
- params = {
39
+ params = {
40
40
  icebergQty: icebergQuantity, newClientOrderId: newClientOrderId,
41
41
  newOrderRespType: newOrderResponseType, price: price, quantity: quantity,
42
42
  recvWindow: recvWindow, stopPrice: stopPrice, symbol: symbol, side: side,
43
- type: type, timeInForce: timeInForce, timestamp: timestamp
43
+ type: type, timeInForce: timeInForce, timestamp: timestamp,
44
44
  }.delete_if { |key, value| value.nil? }
45
45
  ensure_required_create_keys!(params: params)
46
- path = "/api/v3/order#{'/test' if test}"
46
+ path = "/api/v3/order#{"/test" if test}"
47
47
  Request.send!(api_key_type: :trading, method: :post, path: path,
48
- params: params, security_type: :trade)
48
+ params: params, security_type: :trade, tld: Configuration.tld)
49
49
  end
50
50
 
51
51
  def status!(orderId: nil, originalClientOrderId: nil, recvWindow: nil, symbol: nil)
52
52
  raise Error.new(message: "symbol is required") if symbol.nil?
53
53
  raise Error.new(message: "either orderid or originalclientorderid " \
54
- "is required") if orderId.nil? && originalClientOrderId.nil?
54
+ "is required") if orderId.nil? && originalClientOrderId.nil?
55
55
  timestamp = Configuration.timestamp
56
56
  params = {
57
57
  orderId: orderId, origClientOrderId: originalClientOrderId, recvWindow: recvWindow,
58
- symbol: symbol, timestamp: timestamp
58
+ symbol: symbol, timestamp: timestamp,
59
59
  }.delete_if { |key, value| value.nil? }
60
60
  Request.send!(api_key_type: :trading, path: "/api/v3/order",
61
- params: params, security_type: :user_data)
61
+ params: params, security_type: :user_data, tld: Configuration.tld)
62
62
  end
63
63
 
64
64
  private
@@ -81,7 +81,7 @@ module Binance
81
81
  def ensure_required_create_keys!(params:)
82
82
  keys = required_create_keys.dup.concat(additional_required_create_keys(type: params[:type]))
83
83
  missing_keys = keys.select { |key| params[key].nil? }
84
- raise Error.new(message: "required keys are missing: #{missing_keys.join(', ')}") unless missing_keys.empty?
84
+ raise Error.new(message: "required keys are missing: #{missing_keys.join(", ")}") unless missing_keys.empty?
85
85
  end
86
86
 
87
87
  def required_create_keys
@@ -2,16 +2,15 @@ module Binance
2
2
  module Api
3
3
  class Request
4
4
  include HTTParty
5
-
6
- base_uri 'https://api.binance.com'
7
-
8
5
  class << self
9
- def send!(api_key_type: :none, headers: {}, method: :get, path: '/', params: {}, security_type: :none)
6
+ def send!(api_key_type: :none, headers: {}, method: :get, path: "/", params: {}, security_type: :none, tld: :com)
7
+ Configuration.validate_tld!(tld)
8
+ self.base_uri "https://api.binance.#{tld}"
9
+
10
10
  raise Error.new(message: "invalid security type #{security_type}") unless security_types.include?(security_type)
11
11
  all_headers = default_headers(api_key_type: api_key_type, security_type: security_type)
12
12
  params.delete_if { |k, v| v.nil? }
13
- params.merge!(signature: signed_request_signature(params: params)) \
14
- if [:trade, :user_data].include?(security_type)
13
+ params.merge!(signature: signed_request_signature(params: params)) if [:trade, :user_data].include?(security_type)
15
14
  # send() is insecure so don't use it.
16
15
  case method
17
16
  when :get
@@ -25,15 +24,15 @@ module Binance
25
24
  else
26
25
  raise Error.new(message: "invalid http method used: #{method}")
27
26
  end
28
- process!(response: response || '{}')
27
+ process!(response: response || "{}")
29
28
  end
30
29
 
31
30
  private
32
31
 
33
32
  def default_headers(api_key_type:, security_type:)
34
33
  headers = {}
35
- headers['Content-Type'] = 'application/json; charset=utf-8'
36
- headers['X-MBX-APIKEY'] = Configuration.api_key(type: api_key_type) unless security_type == :none
34
+ headers["Content-Type"] = "application/json; charset=utf-8"
35
+ headers["X-MBX-APIKEY"] = Configuration.api_key(type: api_key_type) unless security_type == :none
37
36
  headers
38
37
  end
39
38
 
@@ -44,11 +43,11 @@ module Binance
44
43
  end
45
44
 
46
45
  def security_types
47
- [:none, :trade, :user_data, :user_stream, :market_data].freeze
46
+ [:none, :trade, :user_data, :user_stream, :market_data, :margin].freeze
48
47
  end
49
48
 
50
49
  def signed_request_signature(params:)
51
- payload = params.map { |key, value| "#{key}=#{value}" }.join('&')
50
+ payload = params.map { |key, value| "#{key}=#{value}" }.join("&")
52
51
  Configuration.signed_request_signature(payload: payload)
53
52
  end
54
53
  end
@@ -1,5 +1,5 @@
1
1
  module Binance
2
2
  module Api
3
- VERSION = "0.4"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binance-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Peterson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-30 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -109,19 +109,33 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.11.3
111
111
  - !ruby/object:Gem::Dependency
112
- name: activesupport
112
+ name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '5.1'
118
- type: :runtime
117
+ version: 0.20.0
118
+ type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '5.1'
124
+ version: 0.20.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: activesupport
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 5.1.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 5.1.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: awrence
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +177,9 @@ files:
163
177
  - lib/binance/api/configuration.rb
164
178
  - lib/binance/api/data_stream.rb
165
179
  - lib/binance/api/error.rb
180
+ - lib/binance/api/margin.rb
181
+ - lib/binance/api/margin/account.rb
182
+ - lib/binance/api/margin/order.rb
166
183
  - lib/binance/api/order.rb
167
184
  - lib/binance/api/request.rb
168
185
  - lib/binance/api/version.rb
@@ -171,7 +188,7 @@ licenses:
171
188
  - MIT
172
189
  metadata:
173
190
  allowed_push_host: https://rubygems.org
174
- post_install_message:
191
+ post_install_message:
175
192
  rdoc_options: []
176
193
  require_paths:
177
194
  - lib
@@ -186,8 +203,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
203
  - !ruby/object:Gem::Version
187
204
  version: '0'
188
205
  requirements: []
189
- rubygems_version: 3.0.6
190
- signing_key:
206
+ rubygems_version: 3.0.8
207
+ signing_key:
191
208
  specification_version: 4
192
- summary: binance-ruby-0.4
209
+ summary: binance-ruby-0.6.3
193
210
  test_files: []