binance-connector-ruby 1.0.3 → 1.1.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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +2 -0
- data/lib/binance/spot/convert.rb +29 -0
- data/lib/binance/spot/margin.rb +54 -0
- data/lib/binance/spot/staking.rb +136 -0
- data/lib/binance/spot.rb +5 -0
- data/lib/binance/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7facfdf6b9532826bcb09f079db1d45d927c7fa05f8431694729ff4268d4d336
|
4
|
+
data.tar.gz: 943f98d14fe1167239695f1134c40cc068ddaa4c63fe8545f40f2746e5de0264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb5ac1a51601bef15a2adf1d588c941e125d0cc90bcc836660496c93da6aaf2a4755ecc8a50f8d759f1e0e7550f64c6944aa4c33e0fbae5f72f512c068aa6ef5
|
7
|
+
data.tar.gz: 1d25971c4d4857a14e00e818a1cfe9c2cf6c8b1b595aafb43a616be8abc2798e4b734e2d37b0b57557fe86fe5c2c809b78b47066ef32f06b9c631ecbaba530c0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
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
|
+
|
3
18
|
## 1.0.3 - 2022-05-06
|
4
19
|
- Update rake version
|
5
20
|
|
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
|
@@ -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
|
data/lib/binance/spot/margin.rb
CHANGED
@@ -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
|
data/lib/binance/version.rb
CHANGED
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
|
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: 2022-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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
|
-
|
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:
|