binance-connector-ruby 1.8.0 → 1.9.0

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: ee83c04ce0bea05f00fc5c6cf28001516e34ae428403a9f44147ad4a65d8668f
4
- data.tar.gz: 964ee9b07157dc7b04299c25eab76128d11f104d971a85ae5a37b12669b418d5
3
+ metadata.gz: 95acd1d2aa51eb375828b3d66166a23b481cf4b6608560ea3e6f7f127ff2be20
4
+ data.tar.gz: f3606637c10bb21eaf337db3f47744a8e5d0a551ac41e19a1bbc9e0390d8e11c
5
5
  SHA512:
6
- metadata.gz: 2b672079eef669e3b79d82a3a6474fd11738df7f6abf6ec7cce737d736b6aade460d4b90c4ce605b580dd57a42a8bc27549163b179e27ea95b0ce71a25a33647
7
- data.tar.gz: 22f7258816e3be06e6e2ac667f36313ec5339b4adc1a6e404b498fa83ee2d00238d6d0344c09d1f97f3a61710c00491ef3760d54a7dd118ca848a27f865bfb78
6
+ metadata.gz: 458304fbc42b6aaecfb59fbb94a52cd65ff42cc1b9c3b67b8fc0050ebd271902407f5fc55233decaa357b20952dbd697150a4a477f82ef00754935febb954d8a
7
+ data.tar.gz: 1f93772a1bf824caad274ad74def4619f29bbefef982c923adf3e1133bfe2b665e29647bab25309efb43eb9c495c7eaca8aec98919c7979c2c804b642e270cec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0 - 2026-10-30
4
+ ### Added
5
+ - Dual Investment endpoints:
6
+ - `GET /sapi/v1/dci/product/list`
7
+ - `GET /sapi/v1/dci/product/positions`
8
+
9
+ ### Changed
10
+ - Bumped `faraday` to `1.10.6` and `json` to `2.21.2` to address security advisories.
11
+
12
+ ### Fixed
13
+ - `new_oco_order` now sends requests to `POST /api/v3/orderList/oco` instead of the deprecated `POST /api/v3/order/oco`, matching its `aboveType`/`belowType` parameters (#28).
14
+ - Fixed OCO examples parameters and order list examples to pass parameters as keyword arguments.
15
+ - `ticker_trading_day` sent the `symbols` parameter as a nested hash, which Binance rejected.
16
+ - `delist_schedule` now sends the API key, which `GET /sapi/v1/spot/delist-schedule` requires.
17
+ - Renamed 60 spec files missing the `_spec.rb` suffix so they run with the test suite, and fixed the failing ones.
18
+
3
19
  ## 1.8.0 - 2026-06-18
4
20
  ### Added
5
21
  - Market endpoints:
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Binance
4
+ class Spot
5
+ # Dual Investment endpoints
6
+ # @see https://developers.binance.com/en/docs/catalog/investment-and-services-dual-investment
7
+ module DCI
8
+ # Get Dual Investment product list (USER_DATA)
9
+ #
10
+ # GET /sapi/v1/dci/product/list
11
+ #
12
+ # @param optionType [String] CALL or PUT
13
+ # @param exercisedCoin [String] Target exercised asset
14
+ # @param investCoin [String] Asset used for subscribing
15
+ # @param kwargs [Hash]
16
+ # @option kwargs [Integer] :pageSize Number of records per page
17
+ # @option kwargs [Integer] :pageIndex Page index
18
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
19
+ # @see https://developers.binance.com/en/docs/catalog/investment-and-services-dual-investment/api/rest-api/market-data#get-dual-investment-product-list
20
+ def dual_investment_products(optionType:, exercisedCoin:, investCoin:, **kwargs)
21
+ Binance::Utils::Validation.require_param('optionType', optionType)
22
+ Binance::Utils::Validation.require_param('exercisedCoin', exercisedCoin)
23
+ Binance::Utils::Validation.require_param('investCoin', investCoin)
24
+
25
+ @session.sign_request(:get, '/sapi/v1/dci/product/list', params: kwargs.merge(
26
+ optionType: optionType,
27
+ exercisedCoin: exercisedCoin,
28
+ investCoin: investCoin
29
+ ))
30
+ end
31
+
32
+ # Get Dual Investment positions (USER_DATA)
33
+ #
34
+ # GET /sapi/v1/dci/product/positions
35
+ #
36
+ # @param kwargs [Hash]
37
+ # @option kwargs [String] :status PENDING, PURCHASE_SUCCESS, SETTLED, PURCHASE_FAIL, REFUNDING, REFUND_SUCCESS or SETTLING. All statuses if omitted
38
+ # @option kwargs [Integer] :pageSize Number of records per page
39
+ # @option kwargs [Integer] :pageIndex Page index
40
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
41
+ # @see https://developers.binance.com/en/docs/catalog/investment-and-services-dual-investment/api/rest-api/trade#get-dual-investment-positions
42
+ def dual_investment_positions(**kwargs)
43
+ @session.sign_request(:get, '/sapi/v1/dci/product/positions', params: kwargs)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -261,7 +261,7 @@ module Binance
261
261
 
262
262
  if symbols
263
263
  symbols = symbols.map { |s| "\"#{s}\"" }.join(',')
264
- symbols = { symbols: "\[#{symbols}\]".upcase }
264
+ symbols = "\[#{symbols}\]".upcase
265
265
  end
266
266
 
267
267
  @session.public_request(
@@ -169,9 +169,10 @@ module Binance
169
169
 
170
170
  # New OCO (TRADE)
171
171
  #
172
- # POST /api/v3/order/oco
172
+ # POST /api/v3/orderList/oco
173
173
  #
174
- # Send in a new OCO
174
+ # Send in a new OCO. Same as {#new_oco_order_list}.
175
+ # The deprecated POST /api/v3/order/oco endpoint is no longer used.
175
176
  #
176
177
  # @param symbol [String] the symbol
177
178
  # @param side [String]
@@ -182,24 +183,24 @@ module Binance
182
183
  # @option kwargs [String] :listClientOrderId
183
184
  # @option kwargs [String] :aboveClientOrderId Arbitrary unique ID among open orders for the above order. Automatically generated if not sent
184
185
  # @option kwargs [Integer] :aboveIcebergQty Note that this can only be used if aboveTimeInForce is GTC
185
- # @option kwargs [Float] :abovePrice
186
- # @option kwargs [Float] :aboveStopPriceCan be used if aboveType is STOP_LOSS or STOP_LOSS_LIMIT. Either aboveStopPrice or aboveTrailingDelta or both, must be specified.
186
+ # @option kwargs [Float] :abovePrice Can be used if aboveType is STOP_LOSS_LIMIT, LIMIT_MAKER or TAKE_PROFIT_LIMIT to specify the limit price.
187
+ # @option kwargs [Float] :aboveStopPrice Can be used if aboveType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT. Either this, aboveTrailingDelta or both must be sent
187
188
  # @option kwargs [Integer] :aboveTrailingDelta
188
- # @option kwargs [Float] :aboveTimeInForce Required if the aboveType is STOP_LOSS_LIMIT.
189
+ # @option kwargs [String] :aboveTimeInForce Required if aboveType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
189
190
  # @option kwargs [Integer] :aboveStrategyId Arbitrary numeric value identifying the above order within an order strategy.
190
191
  # @option kwargs [Integer] :aboveStrategyType Arbitrary numeric value identifying the above order strategy. Values smaller than 1000000 are reserved and cannot be used.
191
192
  # @option kwargs [String] :belowClientOrderId Arbitrary unique ID among open orders for the below order. Automatically generated if not sent
192
193
  # @option kwargs [Integer] :belowIcebergQty Note that this can only be used if belowTimeInForce is GTC
193
- # @option kwargs [Float] :belowPrice Can be used if belowType is STOP_LOSS_LIMIT or LIMIT_MAKER to specify the limit price.
194
- # @option kwargs [Float] :belowStopPrice Can be used if belowType is STOP_LOSS or STOP_LOSS_LIMIT. Either belowStopPrice or belowTrailingDelta or both, must be specified.
194
+ # @option kwargs [Float] :belowPrice Can be used if belowType is STOP_LOSS_LIMIT, LIMIT_MAKER or TAKE_PROFIT_LIMIT to specify the limit price.
195
+ # @option kwargs [Float] :belowStopPrice Can be used if belowType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT. Either this, belowTrailingDelta or both must be sent
195
196
  # @option kwargs [Integer] :belowTrailingDelta
196
- # @option kwargs [String] :belowTimeInForce Required if the belowType is STOP_LOSS_LIMIT
197
+ # @option kwargs [String] :belowTimeInForce Required if belowType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
197
198
  # @option kwargs [Integer] :belowStrategyId Arbitrary numeric value identifying the below order within an order strategy
198
- # @option kwargs [String] :belowStrategyType Arbitrary numeric value identifying the below order strategy. Values smaller than 1000000 are reserved and cannot be used.
199
+ # @option kwargs [Integer] :belowStrategyType Arbitrary numeric value identifying the below order strategy. Values smaller than 1000000 are reserved and cannot be used.
200
+ # @option kwargs [String] :selfTradePreventionMode
199
201
  # @option kwargs [String] :newOrderRespType
200
202
  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
201
203
  # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade
202
- # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade
203
204
  def new_oco_order(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
204
205
  Binance::Utils::Validation.require_param('symbol', symbol)
205
206
  Binance::Utils::Validation.require_param('side', side)
@@ -207,7 +208,7 @@ module Binance
207
208
  Binance::Utils::Validation.require_param('aboveType', aboveType)
208
209
  Binance::Utils::Validation.require_param('belowType', belowType)
209
210
 
210
- @session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge(
211
+ @session.sign_request(:post, '/api/v3/orderList/oco', params: kwargs.merge(
211
212
  symbol: symbol,
212
213
  side: side,
213
214
  quantity: quantity,
@@ -485,7 +486,7 @@ module Binance
485
486
  # @option kwargs [Float] :abovePrice
486
487
  # @option kwargs [Float] :aboveStopPrice
487
488
  # @option kwargs [Integer] :aboveTrailingDelta
488
- # @option kwargs [Integer] :aboveTimeInForce
489
+ # @option kwargs [String] :aboveTimeInForce
489
490
  # @option kwargs [Integer] :aboveStrategyId
490
491
  # @option kwargs [Integer] :aboveStrategyType
491
492
  # @option kwargs [Integer] :abovePegPriceType
@@ -496,16 +497,16 @@ module Binance
496
497
  # @option kwargs [Float] :belowPrice
497
498
  # @option kwargs [Float] :belowStopPrice
498
499
  # @option kwargs [Integer] :belowTrailingDelta
499
- # @option kwargs [Integer] :belowTimeInForce
500
+ # @option kwargs [String] :belowTimeInForce
500
501
  # @option kwargs [Integer] :belowStrategyId
501
502
  # @option kwargs [Integer] :belowStrategyType
502
503
  # @option kwargs [Integer] :belowPegPriceType
503
504
  # @option kwargs [Integer] :belowPegOffsetType
504
505
  # @option kwargs [Integer] :belowPegOffsetValue
505
- # @option kwargs [Integer] :selfTradePreventionMode
506
+ # @option kwargs [String] :selfTradePreventionMode
506
507
  # @option kwargs [String] :newOrderRespType
507
508
  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
508
- # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#order-amend-keep-priority-trade
509
+ # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade
509
510
  def new_oco_order_list(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
510
511
  Binance::Utils::Validation.require_param('symbol', symbol)
511
512
  Binance::Utils::Validation.require_param('side', side)
@@ -24,7 +24,7 @@ module Binance
24
24
  # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
25
25
  # @see https://developers.binance.com/docs/wallet/others/delist-schedule
26
26
  def delist_schedule(**kwargs)
27
- @session.public_request(path: '/sapi/v1/spot/delist-schedule', params: kwargs)
27
+ @session.limit_request(path: '/sapi/v1/spot/delist-schedule', params: kwargs)
28
28
  end
29
29
 
30
30
  # All Coins' Information (USER_DATA)
data/lib/binance/spot.rb CHANGED
@@ -7,6 +7,7 @@ require 'binance/utils/url'
7
7
  require 'binance/error'
8
8
  require 'binance/spot/c2c'
9
9
  require 'binance/spot/convert'
10
+ require 'binance/spot/dci'
10
11
  require 'binance/spot/fiat'
11
12
  require 'binance/spot/loan'
12
13
  require 'binance/spot/margin'
@@ -24,6 +25,7 @@ module Binance
24
25
  # - Blvt
25
26
  # - C2C
26
27
  # - Convert
28
+ # - DCI
27
29
  # - Fiat
28
30
  # - Futures
29
31
  # - Loan
@@ -39,6 +41,7 @@ module Binance
39
41
  class Spot
40
42
  include Binance::Spot::C2C
41
43
  include Binance::Spot::Convert
44
+ include Binance::Spot::DCI
42
45
  include Binance::Spot::Fiat
43
46
  include Binance::Spot::Loan
44
47
  include Binance::Spot::Margin
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Binance
4
- VERSION = '1.8.0'
4
+ VERSION = '1.9.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binance-connector-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Binance
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-18 00:00:00.000000000 Z
11
+ date: 2026-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.10.5
75
+ version: 1.10.6
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.10.5
82
+ version: 1.10.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: websocket-eventmachine-client
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +110,7 @@ files:
110
110
  - lib/binance/spot.rb
111
111
  - lib/binance/spot/c2c.rb
112
112
  - lib/binance/spot/convert.rb
113
+ - lib/binance/spot/dci.rb
113
114
  - lib/binance/spot/fiat.rb
114
115
  - lib/binance/spot/loan.rb
115
116
  - lib/binance/spot/margin.rb