binance-connector-ruby 1.0.1 → 1.1.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: 528658559216256c1f8a39559437b3faf6e4b0e834fbca24f7d4c46a12c6b045
4
- data.tar.gz: ea13e85275dd64c727b73144c92931b07694c85456beee884d8850cd177d5298
3
+ metadata.gz: 7facfdf6b9532826bcb09f079db1d45d927c7fa05f8431694729ff4268d4d336
4
+ data.tar.gz: 943f98d14fe1167239695f1134c40cc068ddaa4c63fe8545f40f2746e5de0264
5
5
  SHA512:
6
- metadata.gz: bb20b597d4b9a95248a440a08a57b33765c095c9f529998bc91136ceaaded6ad0074f93980fb46694fa2a0e3aa7a6aa1c158ceffaf921381c645bd4db4fc2c0d
7
- data.tar.gz: 40f14e2adda863fc0812e45ab56f137ee3f80f7f33565f30be2279a0bb1facec6a8117f68b52904fc7c979d728ed2098871165a987e91b0ddf6ff91391e9d2be
6
+ metadata.gz: bb5ac1a51601bef15a2adf1d588c941e125d0cc90bcc836660496c93da6aaf2a4755ecc8a50f8d759f1e0e7550f64c6944aa4c33e0fbae5f72f512c068aa6ef5
7
+ data.tar.gz: 1d25971c4d4857a14e00e818a1cfe9c2cf6c8b1b595aafb43a616be8abc2798e4b734e2d37b0b57557fe86fe5c2c809b78b47066ef32f06b9c631ecbaba530c0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 - 2022-06-09
4
+
5
+ ### Add
6
+ - Convert endpoint
7
+ - `GET /sapi/v1/convert/tradeFlow`
8
+ - Margin Endpoint
9
+ - `GET /sapi/v1/margin/crossMarginData`
10
+ - `GET /sapi/v1/margin/isolatedMarginData`
11
+ - `GET /sapi/v1/margin/isolatedMarginTier`
12
+ - `GET /sapi/v1/margin/rateLimit/order`
13
+ - All Staking Endpoints
14
+
15
+ ### Update
16
+ - Fixing rubocop warnnings
17
+
18
+ ## 1.0.3 - 2022-05-06
19
+ - Update rake version
20
+
21
+ ## 1.0.2 - 2021-11-21
22
+
23
+ ### Update
24
+ - Change README description and package settings
25
+
26
+ ## 1.0.1 - 2021-11-21
27
+
28
+ ### Update
29
+ - Change package name
30
+
3
31
  ## 1.0.0 - 2021-11-18
4
32
 
5
33
  ### Added
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Binance Connector Ruby
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/binance-connector.svg)](https://badge.fury.io/rb/binance-connector)
3
+ [![Gem Version](https://badge.fury.io/rb/binance-connector-ruby.svg)](https://badge.fury.io/rb/binance-connector-ruby)
4
4
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
@@ -23,7 +23,7 @@ This is a lightweight library that works as a connector to [Binance public API](
23
23
  Add this line in the Gemfile.
24
24
 
25
25
  ```ruby
26
- gem 'binance-connector'
26
+ gem 'binance-connector-ruby'
27
27
  ```
28
28
 
29
29
  And then execute the bundler via CLI:
@@ -33,11 +33,13 @@ This is a lightweight library that works as a connector to [Binance public API](
33
33
  ```
34
34
  2. Install it with CLI:
35
35
  ```shell
36
- gem install binance-connector
36
+ gem install binance-connector-ruby
37
37
  ```
38
+
38
39
  ## Documentation
39
40
 
40
- [https://www.rubydoc.info/gems/binance-connector](https://www.rubydoc.info/gems/binance-connector)
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
@@ -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
@@ -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
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.1'
4
+ VERSION = '1.1.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.1
4
+ version: 1.1.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-06-09 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: