binance-connector-ruby 1.0.2 → 1.2.0

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: f9df0f786b802281d92e7f962faa7497773bcbd3ccbd40f6a92d52a38d8db09c
4
- data.tar.gz: b16a995a8bf4a0845062e7a9a05da70b79aa5df1f78f821e536611061d34adc5
3
+ metadata.gz: 1b029d14cae7ec52f77a9f61775eba15eb33027f47983f2184e49731c5de746a
4
+ data.tar.gz: 5ecb20e8b7544668b2e4306a5f70548b9e3ce92696f9111b4e4ba4f88b7e4fa4
5
5
  SHA512:
6
- metadata.gz: ab4b671939dcd913acf41c48d9159dd1315f730f9f8f8db0b1d1c4c029e24beb31b0aefebc2d7a53cad66b47fe90e21b47f1acf4c405cc94b7bae66108d0137c
7
- data.tar.gz: aa85202b669eb93f592259aaee7cb30dc532a387e0ee2e83c47dc7a48a5fb62b3f24fa14d9831bed260559ae768912f9933ff86eac1738579d524eb93d58621f
6
+ metadata.gz: 1b779f8bf2a01f165f68748c37385d3a4bf79e9e887a82f5d23c08b111b697cb2280c60c9cfe4609b5c061218f008c4b58dd81e7457e26a7f76dfbafc7f1226e
7
+ data.tar.gz: 25e0a750c7db5fb5dd26889548d26aa3a3c1e96b0a13ab21898623a79c69393f1df025a4f7b0c3ea6d6ad893d197544d3e24145be6b0a1e335af28dd42a9d19b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 - 2022-07-15
4
+
5
+ ### Add
6
+ - Sub account endpoints
7
+ - `POST /sapi/v1/sub-account/subAccountApi/ipRestriction` to support master account enable and disable IP restriction for a sub-account API Key
8
+ - `POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList` to support master account add IP list for a sub-account API Key
9
+ - `GET /sapi/v1/account/apiRestrictions/ipRestriction` to support master account query IP restriction for a sub-account API Key
10
+ - `DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList` to support master account delete IP list for a sub-account API Key
11
+ - Market endpoint
12
+ - `GET /api/v3/ticker`
13
+ - Trade endpoint
14
+ - `POST /api/v3/order/cancelReplace`
15
+ - Websocket methods
16
+ - `<symbol>@ticker_<window_size>`
17
+ - `!ticker_<window-size>@arr`
18
+
19
+
20
+ ## 1.1.0 - 2022-06-09
21
+
22
+ ### Add
23
+ - Convert endpoint
24
+ - `GET /sapi/v1/convert/tradeFlow`
25
+ - Margin Endpoint
26
+ - `GET /sapi/v1/margin/crossMarginData`
27
+ - `GET /sapi/v1/margin/isolatedMarginData`
28
+ - `GET /sapi/v1/margin/isolatedMarginTier`
29
+ - `GET /sapi/v1/margin/rateLimit/order`
30
+ - All Staking Endpoints
31
+
32
+ ### Update
33
+ - Fixing rubocop warnnings
34
+
35
+ ## 1.0.3 - 2022-05-06
36
+ - Update rake version
3
37
 
4
38
  ## 1.0.2 - 2021-11-21
5
39
 
data/README.md CHANGED
@@ -35,9 +35,11 @@ This is a lightweight library that works as a connector to [Binance public API](
35
35
  ```shell
36
36
  gem install binance-connector-ruby
37
37
  ```
38
+
38
39
  ## Documentation
39
40
 
40
41
  [https://www.rubydoc.info/gems/binance-connector-ruby](https://www.rubydoc.info/gems/binance-connector-ruby)
42
+
41
43
  ## Restful APIs
42
44
 
43
45
  ```ruby
data/lib/binance/error.rb CHANGED
@@ -25,4 +25,11 @@ module Binance
25
25
  )
26
26
  end
27
27
  end
28
+
29
+ # Error when Multi parameters are not allowed to send together
30
+ class DuplicatedParametersError < Error
31
+ def initialize(*kwargs)
32
+ super("Parameters #{kwargs} should not be sent to server together.")
33
+ end
34
+ end
28
35
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Binance
4
+ class Spot
5
+ # Convert endpoints
6
+ # @see https://binance-docs.github.io/apidocs/spot/en/#convert-endpoints
7
+ module Convert
8
+ # Get Convert Trade History (USER_DATA)
9
+ #
10
+ # GET /sapi/v1/convert/tradeFlow
11
+ #
12
+ # @param startTime [Integer]
13
+ # @param endTime [Integer]
14
+ # @param kwargs [Hash]
15
+ # @option kwargs [Integer] :limit default 100, max 1000
16
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
17
+ # @see https://binance-docs.github.io/apidocs/spot/en/#convert-endpoints
18
+ def convert_trade_flow(startTime:, endTime:, **kwargs)
19
+ Binance::Utils::Validation.require_param('startTime', startTime)
20
+ Binance::Utils::Validation.require_param('endTime', endTime)
21
+
22
+ @session.sign_request(:get, '/sapi/v1/convert/tradeFlow', params: kwargs.merge(
23
+ startTime: startTime,
24
+ endTime: endTime
25
+ ))
26
+ end
27
+ end
28
+ end
29
+ end
@@ -671,6 +671,60 @@ module Binance
671
671
 
672
672
  @session.sign_request(:get, '/sapi/v1/margin/interestRateHistory', params: kwargs.merge(asset: asset))
673
673
  end
674
+
675
+ # Query Cross Margin Fee Data (USER_DATA)
676
+ #
677
+ # GET /sapi/v1/margin/crossMarginData
678
+ #
679
+ # @param kwargs [Hash]
680
+ # @option vipLevel [Integer] Default: user's vip level
681
+ # @option coin [String]
682
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
683
+ # @see https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-fee-data-user_data
684
+ def get_cross_margin_data(**kwargs)
685
+ @session.sign_request(:get, '/sapi/v1/margin/crossMarginData', params: kwargs)
686
+ end
687
+
688
+ # Query Isolated Margin Fee Data (USER_DATA)
689
+ #
690
+ # GET /sapi/v1/margin/isolatedMarginData
691
+ #
692
+ # @param kwargs [Hash]
693
+ # @option vipLevel [Integer] Default: user's vip level
694
+ # @option symbol [String]
695
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
696
+ # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
697
+ def get_isolated_margin_data(**kwargs)
698
+ @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginData', params: kwargs)
699
+ end
700
+
701
+ # Query Isolated Margin Tier Data (USER_DATA)
702
+ #
703
+ # GET /sapi/v1/margin/isolatedMarginTier
704
+ #
705
+ # @param symbol [String]
706
+ # @param kwargs [Hash]
707
+ # @option tier [Integer]
708
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
709
+ # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-tier-data-user_data
710
+ def get_isolated_margin_tier(symbol:, **kwargs)
711
+ Binance::Utils::Validation.require_param('symbol', symbol)
712
+
713
+ @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginTier', params: kwargs.merge(symbol: symbol))
714
+ end
715
+
716
+ # Query Current Margin Order Count Usage (TRADE)
717
+ #
718
+ # GET /sapi/v1/margin/rateLimit/order
719
+ #
720
+ # @param kwargs [Hash]
721
+ # @option isIsolated [String]
722
+ # @option symbol [String]
723
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
724
+ # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
725
+ def get_margin_order_usage(**kwargs)
726
+ @session.sign_request(:get, '/sapi/v1/margin/rateLimit/order', params: kwargs)
727
+ end
674
728
  end
675
729
  end
676
730
  end
@@ -215,6 +215,32 @@ module Binance
215
215
  params: { symbol: symbol }
216
216
  )
217
217
  end
218
+
219
+ # Symbol Order Book Ticker
220
+ #
221
+ # Best price/qty on the order book for a symbol or symbols.
222
+ #
223
+ # GET /api/v3/ticker/bookTicker
224
+ #
225
+ # @param symbol [String] the symbol
226
+ # @see https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker
227
+ def ticker(symbol: nil, symbols: nil, windowSize: '1d')
228
+ raise Binance::DuplicatedParametersError.new('symbol', 'symbols') unless symbols.nil? || symbol.nil?
229
+
230
+ params = { symbol: symbol.upcase } if symbol
231
+
232
+ if symbols
233
+ symbols = symbols.map { |s| "\"#{s}\"" }.join(',')
234
+ params = { symbols: "\[#{symbols}\]".upcase }
235
+ end
236
+
237
+ params[:windowSize] = windowSize
238
+
239
+ @session.public_request(
240
+ path: '/api/v3/ticker',
241
+ params: params
242
+ )
243
+ end
218
244
  end
219
245
  end
220
246
  end
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Binance
4
+ class Spot
5
+ # all savings endpoints
6
+ # @see https://binance-docs.github.io/apidocs/spot/en/#savings-endpoints
7
+ module Staking
8
+ # Get Staking Product List(USER_DATA)
9
+ #
10
+ # GET /sapi/v1/staking/productList
11
+ #
12
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
13
+ # @param kwargs [Hash]
14
+ # @option kwargs [String] :asset
15
+ # @option kwargs [Integer] :current
16
+ # @option kwargs [Integer] :size
17
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
18
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
19
+ def staking_product_list(product:, **kwargs)
20
+ Binance::Utils::Validation.require_param('product', product)
21
+
22
+ @session.sign_request(:get, '/sapi/v1/staking/productList', params: kwargs.merge(product: product))
23
+ end
24
+
25
+ # Purchase Staking Product(USER_DATA)
26
+ #
27
+ # POST /sapi/v1/staking/purchase
28
+ #
29
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
30
+ # @param productId [String]
31
+ # @param amount [Float]
32
+ # @param kwargs [Hash]
33
+ # @option kwargs [String] :renewable
34
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
35
+ # @see https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data
36
+ def staking_purchase(product:, productId:, amount:, **kwargs)
37
+ Binance::Utils::Validation.require_param('product', product)
38
+ Binance::Utils::Validation.require_param('productId', productId)
39
+ Binance::Utils::Validation.require_param('amount', amount)
40
+
41
+ @session.sign_request(:post, '/sapi/v1/staking/purchase', params: kwargs.merge(product: product, productId: productId, amount: amount))
42
+ end
43
+
44
+ # Redeem Staking Product(USER_DATA)
45
+ #
46
+ # POST /sapi/v1/staking/redeem
47
+ #
48
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
49
+ # @param productId [String]
50
+ # @param kwargs [Hash]
51
+ # @option kwargs [Float] :amount
52
+ # @option kwargs [String] :positionId
53
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
54
+ # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data
55
+ def staking_redeem(product:, productId:, **kwargs)
56
+ Binance::Utils::Validation.require_param('product', product)
57
+ Binance::Utils::Validation.require_param('productId', productId)
58
+
59
+ @session.sign_request(:post, '/sapi/v1/staking/redeem', params: kwargs.merge(product: product, productId: productId))
60
+ end
61
+
62
+ # Get Staking Product Position(USER_DATA)
63
+ #
64
+ # GET /sapi/v1/staking/position
65
+ #
66
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
67
+ # @param kwargs [Hash]
68
+ # @option kwargs [String] :productId
69
+ # @option kwargs [String] :asset
70
+ # @option kwargs [Integer] :current
71
+ # @option kwargs [Integer] :size
72
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
73
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
74
+ def staking_position(product:, **kwargs)
75
+ Binance::Utils::Validation.require_param('product', product)
76
+
77
+ @session.sign_request(:get, '/sapi/v1/staking/position', params: kwargs.merge(product: product))
78
+ end
79
+
80
+ # Get Staking History(USER_DATA)
81
+ #
82
+ # GET /sapi/v1/staking/stakingRecord
83
+ #
84
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
85
+ # @param txnType [String] "SUBSCRIPTION", "REDEMPTION", "INTEREST"
86
+ # @param kwargs [Hash]
87
+ # @option kwargs [String] :asset
88
+ # @option kwargs [Integer] :startTime
89
+ # @option kwargs [Integer] :endTime
90
+ # @option kwargs [Integer] :current
91
+ # @option kwargs [Integer] :size
92
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
93
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
94
+ def staking_history(product:, txnType:, **kwargs)
95
+ Binance::Utils::Validation.require_param('product', product)
96
+ Binance::Utils::Validation.require_param('txnType', txnType)
97
+
98
+ @session.sign_request(:get, '/sapi/v1/staking/stakingRecord', params: kwargs.merge(product: product, txnType: txnType))
99
+ end
100
+
101
+ # Set Auto Staking(USER_DATA)
102
+ #
103
+ # POST /sapi/v1/staking/setAutoStaking
104
+ #
105
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
106
+ # @param positionId [String]
107
+ # @param renewable [String] true or false
108
+ # @param kwargs [Hash]
109
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
110
+ # @see https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data
111
+ def staking_set_auto(product:, positionId:, renewable:, **kwargs)
112
+ Binance::Utils::Validation.require_param('product', product)
113
+ Binance::Utils::Validation.require_param('positionId', positionId)
114
+ Binance::Utils::Validation.require_param('renewable', renewable)
115
+
116
+ @session.sign_request(:post, '/sapi/v1/staking/setAutoStaking', params: kwargs.merge(product: product, positionId: positionId, renewable: renewable))
117
+ end
118
+
119
+ # Get Personal Left Quota of Staking Product(USER_DATA)
120
+ #
121
+ # GET /sapi/v1/staking/personalLeftQuota
122
+ #
123
+ # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
124
+ # @param productId [String]
125
+ # @param kwargs [Hash]
126
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
127
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
128
+ def staking_personal_quota_remain(product:, productId:, **kwargs)
129
+ Binance::Utils::Validation.require_param('product', product)
130
+ Binance::Utils::Validation.require_param('productId', productId)
131
+
132
+ @session.sign_request(:get, '/sapi/v1/staking/personalLeftQuota', params: kwargs.merge(product: product, productId: productId))
133
+ end
134
+ end
135
+ end
136
+ end
@@ -548,6 +548,87 @@ module Binance
548
548
  amount: amount
549
549
  ))
550
550
  end
551
+
552
+ # Enable or Disable IP Restriction for a Sub-account API Key (For Master Account)
553
+ #
554
+ # POST /sapi/v1/sub-account/subAccountApi/ipRestriction
555
+ #
556
+ # @param email [String]
557
+ # @param subAccountApiKey [String]
558
+ # @param ipRestrict [Boolean]
559
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
560
+ # @see https://binance-docs.github.io/apidocs/spot/en/#enable-or-disable-ip-restriction-for-a-sub-account-api-key-for-master-account
561
+ def sub_account_toggle_ip_restriction(email:, subAccountApiKey:, ipRestrict:, **kwargs)
562
+ Binance::Utils::Validation.require_param('email', email)
563
+ Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
564
+ Binance::Utils::Validation.require_param('ipRestrict', ipRestrict)
565
+
566
+ @session.sign_request(:post, '/sapi/v1/sub-account/subAccountApi/ipRestriction', params: kwargs.merge(
567
+ email: email,
568
+ subAccountApiKey: subAccountApiKey,
569
+ ipRestrict: ipRestrict
570
+ ))
571
+ end
572
+
573
+ # Add IP List for a Sub-account API Key (For Master Account)
574
+ #
575
+ # POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
576
+ #
577
+ # @param email [String]
578
+ # @param subAccountApiKey [String]
579
+ # @param ipAddress [String]
580
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
581
+ # @see https://binance-docs.github.io/apidocs/spot/en/#add-ip-list-for-a-sub-account-api-key-for-master-account
582
+ def sub_account_add_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs)
583
+ Binance::Utils::Validation.require_param('email', email)
584
+ Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
585
+ Binance::Utils::Validation.require_param('ipAddress', ipAddress)
586
+
587
+ @session.sign_request(:post, '/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList', params: kwargs.merge(
588
+ email: email,
589
+ subAccountApiKey: subAccountApiKey,
590
+ ipAddress: ipAddress
591
+ ))
592
+ end
593
+
594
+ # Get IP Restriction for a Sub-account API Key (For Master Account)
595
+ #
596
+ # GET /sapi/v1/sub-account/subAccountApi/ipRestriction
597
+ #
598
+ # @param email [String]
599
+ # @param subAccountApiKey [String]
600
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
601
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-ip-restriction-for-a-sub-account-api-key-for-master-account
602
+ def sub_account_ip_list(email:, subAccountApiKey:, **kwargs)
603
+ Binance::Utils::Validation.require_param('email', email)
604
+ Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
605
+
606
+ @session.sign_request(:get, '/sapi/v1/sub-account/subAccountApi/ipRestriction', params: kwargs.merge(
607
+ email: email,
608
+ subAccountApiKey: subAccountApiKey
609
+ ))
610
+ end
611
+
612
+ # Delete IP List For a Sub-account API Key (For Master Account)
613
+ #
614
+ # DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
615
+ #
616
+ # @param email [String]
617
+ # @param subAccountApiKey [String]
618
+ # @param ipAddress [String]
619
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
620
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-ip-restriction-for-a-sub-account-api-key-for-master-account
621
+ def sub_account_delete_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs)
622
+ Binance::Utils::Validation.require_param('email', email)
623
+ Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
624
+ Binance::Utils::Validation.require_param('ipAddress', ipAddress)
625
+
626
+ @session.sign_request(:delete, '/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList', params: kwargs.merge(
627
+ email: email,
628
+ subAccountApiKey: subAccountApiKey,
629
+ ipAddress: ipAddress
630
+ ))
631
+ end
551
632
  end
552
633
  end
553
634
  end
@@ -289,6 +289,44 @@ module Binance
289
289
  def get_order_rate_limit(**kwargs)
290
290
  @session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
291
291
  end
292
+
293
+ # Cancel an Existing Order and Send a New Order (TRADE)
294
+ #
295
+ # POST /api/v3/order/cancelReplace
296
+ #
297
+ # @param symbol [String] the symbol
298
+ # @param side [String]
299
+ # @param type [String]
300
+ # @param cancelReplaceMode [String] STOP_ON_FAILURE or ALLOW_FAILURE
301
+ # @param kwargs [Hash]
302
+ # @option kwargs [String] :timeInForce
303
+ # @option kwargs [Float] :quantity
304
+ # @option kwargs [Float] :quoteOrderQty
305
+ # @option kwargs [Float] :price
306
+ # @option kwargs [String] :cancelNewClientOrderId
307
+ # @option kwargs [String] :cancelOrigClientOrderId
308
+ # @option kwargs [Integer] :cancelOrderId
309
+ # @option kwargs [String] :newClientOrderId
310
+ # @option kwargs [Float] :stopPrice
311
+ # @option kwargs [Integer] :trailingDelta
312
+ # @option kwargs [Float] :icebergQty
313
+ # @option kwargs [String] :newOrderRespType
314
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
315
+ # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
316
+ def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs)
317
+ Binance::Utils::Validation.require_param('symbol', symbol)
318
+ Binance::Utils::Validation.require_param('side', side)
319
+ Binance::Utils::Validation.require_param('type', type)
320
+ Binance::Utils::Validation.require_param('cancelReplaceMode', cancelReplaceMode)
321
+
322
+ @session.sign_request(:post, '/api/v3/order/cancelReplace',
323
+ params: kwargs.merge(
324
+ symbol: symbol,
325
+ side: side,
326
+ type: type,
327
+ cancelReplaceMode: cancelReplaceMode
328
+ ))
329
+ end
292
330
  end
293
331
  end
294
332
  end
@@ -126,6 +126,30 @@ module Binance
126
126
  create_connection(url, callbacks)
127
127
  end
128
128
 
129
+ # Individual Symbol Rolling Window Statistics Streams
130
+ # Rolling window ticker statistics for a single symbol, computed over multiple windows.
131
+ # Stream Name: <symbol>@ticker_<window_size>
132
+ # Window Sizes: 1h,4h
133
+ # Update Speed: 1000ms
134
+ #
135
+ # @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-rolling-window-statistics-streams
136
+ def rolling_window_ticker(symbol:, windowSize:, callbacks:)
137
+ url = "#{@base_url}/ws/#{symbol.downcase}@ticker_#{windowSize}"
138
+ create_connection(url, callbacks)
139
+ end
140
+
141
+ # All Market Rolling Window Statistics Streams
142
+ # Rolling window ticker statistics for all market symbols, computed over multiple windows. Note that only tickers that have changed will be present in the array.
143
+ # Stream Name: !ticker_<window-size>@arr
144
+ # Window Sizes: 1h, 4h
145
+ # Update Speed: 1000ms
146
+ #
147
+ # @see https://binance-docs.github.io/apidocs/spot/en/#all-market-rolling-window-statistics-streams
148
+ def rolling_window_ticker_all_symbols(windowSize:, callbacks:)
149
+ url = "#{@base_url}/ws/!ticker_#{windowSize}@arr"
150
+ create_connection(url, callbacks)
151
+ end
152
+
129
153
  # Subscribe to a stream manually
130
154
  # subscribe(stream: "btcusdt@miniTicker") or
131
155
  # subscribe(stream: ["btcusdt@miniTicker", "ethusdt@miniTicker"])
data/lib/binance/spot.rb CHANGED
@@ -8,6 +8,7 @@ require 'binance/error'
8
8
  require 'binance/spot/blvt'
9
9
  require 'binance/spot/bswap'
10
10
  require 'binance/spot/c2c'
11
+ require 'binance/spot/convert'
11
12
  require 'binance/spot/fiat'
12
13
  require 'binance/spot/futures'
13
14
  require 'binance/spot/loan'
@@ -15,6 +16,7 @@ require 'binance/spot/margin'
15
16
  require 'binance/spot/market'
16
17
  require 'binance/spot/mining'
17
18
  require 'binance/spot/savings'
19
+ require 'binance/spot/staking'
18
20
  require 'binance/spot/stream'
19
21
  require 'binance/spot/subaccount'
20
22
  require 'binance/spot/trade'
@@ -26,6 +28,7 @@ module Binance
26
28
  # - Blvt
27
29
  # - Bswap
28
30
  # - C2C
31
+ # - Convert
29
32
  # - Fiat
30
33
  # - Futures
31
34
  # - Loan
@@ -42,6 +45,7 @@ module Binance
42
45
  include Binance::Spot::Blvt
43
46
  include Binance::Spot::Bswap
44
47
  include Binance::Spot::C2C
48
+ include Binance::Spot::Convert
45
49
  include Binance::Spot::Fiat
46
50
  include Binance::Spot::Futures
47
51
  include Binance::Spot::Loan
@@ -49,6 +53,7 @@ module Binance
49
53
  include Binance::Spot::Market
50
54
  include Binance::Spot::Mining
51
55
  include Binance::Spot::Savings
56
+ include Binance::Spot::Staking
52
57
  include Binance::Spot::Stream
53
58
  include Binance::Spot::Subaccount
54
59
  include Binance::Spot::Trade
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Binance
4
- VERSION = '1.0.2'
4
+ VERSION = '1.2.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.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Binance
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,7 @@ files:
111
111
  - lib/binance/spot/blvt.rb
112
112
  - lib/binance/spot/bswap.rb
113
113
  - lib/binance/spot/c2c.rb
114
+ - lib/binance/spot/convert.rb
114
115
  - lib/binance/spot/fiat.rb
115
116
  - lib/binance/spot/futures.rb
116
117
  - lib/binance/spot/loan.rb
@@ -118,6 +119,7 @@ files:
118
119
  - lib/binance/spot/market.rb
119
120
  - lib/binance/spot/mining.rb
120
121
  - lib/binance/spot/savings.rb
122
+ - lib/binance/spot/staking.rb
121
123
  - lib/binance/spot/stream.rb
122
124
  - lib/binance/spot/subaccount.rb
123
125
  - lib/binance/spot/trade.rb
@@ -135,9 +137,7 @@ homepage: https://github.com/binance/binance-connector-ruby
135
137
  licenses:
136
138
  - MIT
137
139
  metadata:
138
- homepage_uri: https://github.com/binance/binance-connector-ruby
139
- documentation_uri: https://binance-docs.github.io/apidocs/spot/en/
140
- source_code_uri: https://github.com/binance/binance-connector-ruby
140
+ rubygems_mfa_required: 'true'
141
141
  post_install_message:
142
142
  rdoc_options: []
143
143
  require_paths: