binance-ruby 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70b267cd8a07a02d51173391f07ec6df6b1ff5f11c7cc93a7abf5389ac9ee2f8
4
- data.tar.gz: 75e99c55e95c0627051893e286c48111e1b216fd9b497bca9795a8dedf89486b
3
+ metadata.gz: '09f5f77206284ebedb2a0f1d95e8c82c332362ad5c447244081c52447754da65'
4
+ data.tar.gz: 17ade78a7eaff0f6d8d4538cebde68877c4e0b6e6838f844068fefb3d60c5957
5
5
  SHA512:
6
- metadata.gz: 3892c1aa7a081f5e3effabdfac508a29df012d77670c094fa88c8cd134bdd1b9d84b5651a2cb70c24f94f9d604bb9c269de747f6ba5a29b2b2b538b6c8ed365b
7
- data.tar.gz: 97d38f76d7a7d98ba141ec8c09abfd5700cf65852e34055e5c875138d3751d0d7f80b4bc028b5878f91e0b1f1b936f2516af37c680e8b94accc19c12c66b357e
6
+ metadata.gz: ae97db01f0ca888aa4c0ff933455286934a0526cc19beeddd1ce23b992f884ae3ae6a4f3d2137f992b1dd4182ff2377bcec85bacdc02126926dea85d7546e259
7
+ data.tar.gz: 07d4309dc23201d4bb120353a14caece000904535297fdd15f07efcea2c854a9c0688ed9891cc420ee77b156780c91ac41862049596c682b6ea74389e81ede29
@@ -3,6 +3,19 @@ module Binance
3
3
  module Margin
4
4
  class Order
5
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
+
6
19
  def create!(symbol: nil, isIsolated: false, side: nil, type: nil, quantity: nil,
7
20
  quoteOrderQty: nil, price: nil, stopPrice: nil, newClientOrderId: nil,
8
21
  icebergQty: nil, newOrderRespType: nil, sideEffectType: nil, timeInForce: nil,
@@ -47,6 +60,16 @@ module Binance
47
60
  def required_create_keys
48
61
  [:symbol, :side, :type, :timestamp].freeze
49
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
50
73
  end
51
74
  end
52
75
  end
@@ -1,5 +1,5 @@
1
1
  module Binance
2
2
  module Api
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binance-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Peterson
@@ -206,5 +206,5 @@ requirements: []
206
206
  rubygems_version: 3.0.8
207
207
  signing_key:
208
208
  specification_version: 4
209
- summary: binance-ruby-0.6.2
209
+ summary: binance-ruby-0.6.3
210
210
  test_files: []