binance-connector-ruby 1.5.2 → 1.7.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 +128 -0
- data/lib/binance/session.rb +2 -1
- data/lib/binance/spot/c2c.rb +2 -2
- data/lib/binance/spot/convert.rb +134 -2
- data/lib/binance/spot/fiat.rb +3 -3
- data/lib/binance/spot/loan.rb +221 -7
- data/lib/binance/spot/margin.rb +104 -231
- data/lib/binance/spot/market.rb +73 -14
- data/lib/binance/spot/mining.rb +13 -13
- data/lib/binance/spot/simple_earn.rb +44 -24
- data/lib/binance/spot/stream.rb +1 -1
- data/lib/binance/spot/subaccount.rb +205 -52
- data/lib/binance/spot/trade.rb +94 -30
- data/lib/binance/spot/wallet.rb +140 -22
- data/lib/binance/spot/websocket.rb +23 -11
- data/lib/binance/spot.rb +1 -5
- data/lib/binance/version.rb +1 -1
- metadata +2 -4
- data/lib/binance/spot/blvt.rb +0 -104
- data/lib/binance/spot/futures.rb +0 -357
@@ -20,7 +20,7 @@ module Binance
|
|
20
20
|
# Update Speed: Real-time
|
21
21
|
#
|
22
22
|
# @param symbol [String]
|
23
|
-
# @see https://binance
|
23
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#aggregate-trade-streams
|
24
24
|
def agg_trade(symbol:, callbacks:)
|
25
25
|
url = "#{@base_url}/ws/#{symbol.downcase}@aggTrade"
|
26
26
|
create_connection(url, callbacks)
|
@@ -32,20 +32,20 @@ module Binance
|
|
32
32
|
# Update Speed: Real-time
|
33
33
|
#
|
34
34
|
# @param symbol [String]
|
35
|
-
# @see https://binance
|
35
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams
|
36
36
|
def trade(symbol:, callbacks:)
|
37
37
|
url = "#{@base_url}/ws/#{symbol.downcase}@trade"
|
38
38
|
create_connection(url, callbacks)
|
39
39
|
end
|
40
40
|
|
41
|
-
# Kline/Candlestick Streams
|
41
|
+
# Kline/Candlestick Streams for UTC
|
42
42
|
# The Kline/Candlestick Stream push updates to the current klines/candlestick every second.
|
43
43
|
# Stream Name: <symbol>@kline_<interval>
|
44
44
|
# Update Speed: 2000ms
|
45
45
|
#
|
46
46
|
# @param symbol [String]
|
47
47
|
# @param interval [String] 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
|
48
|
-
# @see https://binance
|
48
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#klinecandlestick-streams-for-utc
|
49
49
|
def kline(symbol:, interval:, callbacks:)
|
50
50
|
url = "#{@base_url}/ws/#{symbol.downcase}@kline_#{interval}"
|
51
51
|
create_connection(url, callbacks)
|
@@ -57,7 +57,7 @@ module Binance
|
|
57
57
|
# Update Speed: 1000ms
|
58
58
|
#
|
59
59
|
# @option symbol [String]
|
60
|
-
# @see https://binance
|
60
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-mini-ticker-stream
|
61
61
|
def mini_ticker(callbacks:, symbol: nil)
|
62
62
|
url = if symbol.nil?
|
63
63
|
"#{@base_url}/ws/!miniTicker@arr"
|
@@ -73,7 +73,7 @@ module Binance
|
|
73
73
|
# Update Speed: 1000ms
|
74
74
|
#
|
75
75
|
# @option symbol [String]
|
76
|
-
# @see https://binance
|
76
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-ticker-streams
|
77
77
|
def symbol_ticker(callbacks:, symbol: nil)
|
78
78
|
url = if symbol.nil?
|
79
79
|
"#{@base_url}/ws/!ticker@arr"
|
@@ -89,7 +89,7 @@ module Binance
|
|
89
89
|
# Update Speed: Real-time
|
90
90
|
#
|
91
91
|
# @option symbol [String]
|
92
|
-
# @see https://binance
|
92
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-book-ticker-streams
|
93
93
|
def book_ticker(callbacks:, symbol: nil)
|
94
94
|
url = if symbol.nil?
|
95
95
|
"#{@base_url}/ws/!bookTicker"
|
@@ -99,6 +99,18 @@ module Binance
|
|
99
99
|
create_connection(url, callbacks)
|
100
100
|
end
|
101
101
|
|
102
|
+
# Average Price
|
103
|
+
# Average price streams push changes in the average price over a fixed time interval.
|
104
|
+
# Stream Name: <symbol>@avgPrice
|
105
|
+
# Update Speed: 1000ms
|
106
|
+
#
|
107
|
+
# @param symbol [String]
|
108
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#average-price
|
109
|
+
def avg_price(symbol:, callbacks:)
|
110
|
+
url = "#{@base_url}/ws/#{symbol.downcase}@avgPrice"
|
111
|
+
create_connection(url, callbacks)
|
112
|
+
end
|
113
|
+
|
102
114
|
# Partial Book Depth Streams
|
103
115
|
# Top bids and asks, Valid are 5, 10, or 20.
|
104
116
|
# Stream Name: <symbol>@depth<levels> OR <symbol>@depth<levels>@100ms.
|
@@ -107,7 +119,7 @@ module Binance
|
|
107
119
|
# @param symbol [String]
|
108
120
|
# @param levels [Integer] 5, 10, or 20.
|
109
121
|
# @param speed [String] 1000ms or 100ms
|
110
|
-
# @see https://binance
|
122
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#partial-book-depth-streams
|
111
123
|
def partial_book_depth(symbol:, levels:, speed:, callbacks:)
|
112
124
|
url = "#{@base_url}/ws/#{symbol.downcase}@depth#{levels}@#{speed}"
|
113
125
|
create_connection(url, callbacks)
|
@@ -120,7 +132,7 @@ module Binance
|
|
120
132
|
#
|
121
133
|
# @param symbol [String]
|
122
134
|
# @param speed [String] 1000ms or 100ms
|
123
|
-
# @see https://binance
|
135
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream
|
124
136
|
def diff_book_depth(symbol:, speed:, callbacks:)
|
125
137
|
url = "#{@base_url}/ws/#{symbol.downcase}@depth@#{speed}"
|
126
138
|
create_connection(url, callbacks)
|
@@ -132,7 +144,7 @@ module Binance
|
|
132
144
|
# Window Sizes: 1h,4h
|
133
145
|
# Update Speed: 1000ms
|
134
146
|
#
|
135
|
-
# @see https://binance
|
147
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-rolling-window-statistics-streams
|
136
148
|
def rolling_window_ticker(symbol:, windowSize:, callbacks:)
|
137
149
|
url = "#{@base_url}/ws/#{symbol.downcase}@ticker_#{windowSize}"
|
138
150
|
create_connection(url, callbacks)
|
@@ -144,7 +156,7 @@ module Binance
|
|
144
156
|
# Window Sizes: 1h, 4h
|
145
157
|
# Update Speed: 1000ms
|
146
158
|
#
|
147
|
-
# @see https://binance
|
159
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-rolling-window-statistics-streams
|
148
160
|
def rolling_window_ticker_all_symbols(windowSize:, callbacks:)
|
149
161
|
url = "#{@base_url}/ws/!ticker_#{windowSize}@arr"
|
150
162
|
create_connection(url, callbacks)
|
data/lib/binance/spot.rb
CHANGED
@@ -5,11 +5,9 @@ require 'binance/authentication'
|
|
5
5
|
require 'binance/utils/validation'
|
6
6
|
require 'binance/utils/url'
|
7
7
|
require 'binance/error'
|
8
|
-
require 'binance/spot/blvt'
|
9
8
|
require 'binance/spot/c2c'
|
10
9
|
require 'binance/spot/convert'
|
11
10
|
require 'binance/spot/fiat'
|
12
|
-
require 'binance/spot/futures'
|
13
11
|
require 'binance/spot/loan'
|
14
12
|
require 'binance/spot/margin'
|
15
13
|
require 'binance/spot/market'
|
@@ -37,13 +35,11 @@ module Binance
|
|
37
35
|
# - Subaccount
|
38
36
|
# - Trade
|
39
37
|
# - Wallet
|
40
|
-
# @see https://binance
|
38
|
+
# @see https://developers.binance.com/en
|
41
39
|
class Spot
|
42
|
-
include Binance::Spot::Blvt
|
43
40
|
include Binance::Spot::C2C
|
44
41
|
include Binance::Spot::Convert
|
45
42
|
include Binance::Spot::Fiat
|
46
|
-
include Binance::Spot::Futures
|
47
43
|
include Binance::Spot::Loan
|
48
44
|
include Binance::Spot::Margin
|
49
45
|
include Binance::Spot::Market
|
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.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Binance
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,11 +108,9 @@ files:
|
|
108
108
|
- lib/binance/error.rb
|
109
109
|
- lib/binance/session.rb
|
110
110
|
- lib/binance/spot.rb
|
111
|
-
- lib/binance/spot/blvt.rb
|
112
111
|
- lib/binance/spot/c2c.rb
|
113
112
|
- lib/binance/spot/convert.rb
|
114
113
|
- lib/binance/spot/fiat.rb
|
115
|
-
- lib/binance/spot/futures.rb
|
116
114
|
- lib/binance/spot/loan.rb
|
117
115
|
- lib/binance/spot/margin.rb
|
118
116
|
- lib/binance/spot/market.rb
|
data/lib/binance/spot/blvt.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Binance
|
4
|
-
class Spot
|
5
|
-
# BLVT endpoints
|
6
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#blvt-endpoints
|
7
|
-
module Blvt
|
8
|
-
# Get BLVT Info (MARKET_DATA)
|
9
|
-
#
|
10
|
-
# GET /sapi/v1/blvt/tokenInfo
|
11
|
-
#
|
12
|
-
# @param tokenName [String]
|
13
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#get-blvt-info-market_data
|
14
|
-
def token_info(tokenName: nil)
|
15
|
-
@session.public_request(
|
16
|
-
path: '/sapi/v1/blvt/tokenInfo',
|
17
|
-
params: { tokenName: tokenName }
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Subscribe BLVT (USER_DATA)
|
22
|
-
#
|
23
|
-
# POST /sapi/v1/blvt/subscribe
|
24
|
-
#
|
25
|
-
# @param tokenName [String]
|
26
|
-
# @param cost [Float]
|
27
|
-
# @param kwargs [Hash]
|
28
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
29
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-blvt-user_data
|
30
|
-
def subscribe(tokenName:, cost:, **kwargs)
|
31
|
-
Binance::Utils::Validation.require_param('tokenName', tokenName)
|
32
|
-
Binance::Utils::Validation.require_param('cost', cost)
|
33
|
-
|
34
|
-
@session.sign_request(:post, '/sapi/v1/blvt/subscribe', params: kwargs.merge(
|
35
|
-
tokenName: tokenName,
|
36
|
-
cost: cost
|
37
|
-
))
|
38
|
-
end
|
39
|
-
|
40
|
-
# Query Subscription Record (USER_DATA)
|
41
|
-
#
|
42
|
-
# GET /sapi/v1/blvt/subscribe/record
|
43
|
-
#
|
44
|
-
# @param kwargs [Hash]
|
45
|
-
# @option kwargs [String] :tokenName
|
46
|
-
# @option kwargs [Integer] :id
|
47
|
-
# @option kwargs [Integer] :startTime
|
48
|
-
# @option kwargs [Integer] :endTime
|
49
|
-
# @option kwargs [Integer] :limit
|
50
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
51
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#query-subscription-record-user_data
|
52
|
-
def get_subscribe_record(**kwargs)
|
53
|
-
@session.sign_request(:get, '/sapi/v1/blvt/subscribe/record', params: kwargs)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Redeem BLVT (USER_DATA)
|
57
|
-
#
|
58
|
-
# POST /sapi/v1/blvt/redeem
|
59
|
-
#
|
60
|
-
# @param tokenName [String]
|
61
|
-
# @param amount [Float]
|
62
|
-
# @param kwargs [Hash]
|
63
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
64
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#redeem-blvt-user_data
|
65
|
-
def redeem(tokenName:, amount:, **kwargs)
|
66
|
-
Binance::Utils::Validation.require_param('tokenName', tokenName)
|
67
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
68
|
-
|
69
|
-
@session.sign_request(:post, '/sapi/v1/blvt/redeem', params: kwargs.merge(
|
70
|
-
tokenName: tokenName,
|
71
|
-
amount: amount
|
72
|
-
))
|
73
|
-
end
|
74
|
-
|
75
|
-
# Query Redemption Record (USER_DATA)
|
76
|
-
#
|
77
|
-
# GET /sapi/v1/blvt/redeem/record
|
78
|
-
#
|
79
|
-
# @param kwargs [Hash]
|
80
|
-
# @option kwargs [String] :tokenName
|
81
|
-
# @option kwargs [Integer] :id
|
82
|
-
# @option kwargs [Integer] :startTime
|
83
|
-
# @option kwargs [Integer] :endTime
|
84
|
-
# @option kwargs [Integer] :limit
|
85
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
86
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#query-redemption-record-user_data
|
87
|
-
def get_redeem_record(**kwargs)
|
88
|
-
@session.sign_request(:get, '/sapi/v1/blvt/redeem/record', params: kwargs)
|
89
|
-
end
|
90
|
-
|
91
|
-
# Get BLVT User Limit Info (USER_DATA)
|
92
|
-
#
|
93
|
-
# GET /sapi/v1/blvt/userLimit
|
94
|
-
#
|
95
|
-
# @param kwargs [Hash]
|
96
|
-
# @option kwargs [String] :tokenName
|
97
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
98
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#get-blvt-user-limit-info-user_data
|
99
|
-
def user_limit(**kwargs)
|
100
|
-
@session.sign_request(:get, '/sapi/v1/blvt/userLimit', params: kwargs)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
data/lib/binance/spot/futures.rb
DELETED
@@ -1,357 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Binance
|
4
|
-
class Spot
|
5
|
-
# Futures endpoints
|
6
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#futures
|
7
|
-
module Futures
|
8
|
-
# New Future Account Transfer (USER_DATA)
|
9
|
-
#
|
10
|
-
# POST /sapi/v1/futures/transfer
|
11
|
-
#
|
12
|
-
# Execute transfer between spot account and futures account.
|
13
|
-
#
|
14
|
-
# @param asset [String]
|
15
|
-
# @param amount [Float]
|
16
|
-
# @param type [Integer] 1: transfer from spot account to USDT-M futures account. <br>
|
17
|
-
# 2: transfer from USDT-M futures account to spot account. <br>
|
18
|
-
# 3: transfer from spot account to COIN-M futures account. <br>
|
19
|
-
# 4: transfer from COIN-M futures account to spot account. <br>
|
20
|
-
# @param kwargs [Hash]
|
21
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
22
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
|
23
|
-
def futures_account_transfer(asset:, amount:, type:, **kwargs)
|
24
|
-
Binance::Utils::Validation.require_param('asset', asset)
|
25
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
26
|
-
Binance::Utils::Validation.require_param('type', type)
|
27
|
-
|
28
|
-
@session.sign_request(:post, '/sapi/v1/futures/transfer', params: kwargs.merge(
|
29
|
-
asset: asset,
|
30
|
-
amount: amount,
|
31
|
-
type: type
|
32
|
-
))
|
33
|
-
end
|
34
|
-
|
35
|
-
# Get Future Account Transaction History List (USER_DATA)
|
36
|
-
#
|
37
|
-
# GET /sapi/v1/futures/transfer
|
38
|
-
#
|
39
|
-
# @param asset [String]
|
40
|
-
# @param startTime [Integer]
|
41
|
-
# @param kwargs [Hash]
|
42
|
-
# @option kwargs [Integer] :endTime
|
43
|
-
# @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
|
44
|
-
# @option kwargs [Integer] :size Default:10 Max:100
|
45
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
46
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#get-future-account-transaction-history-list-user_data
|
47
|
-
def futures_account_transfer_history(asset:, startTime:, **kwargs)
|
48
|
-
Binance::Utils::Validation.require_param('asset', asset)
|
49
|
-
Binance::Utils::Validation.require_param('startTime', startTime)
|
50
|
-
|
51
|
-
@session.sign_request(:get, '/sapi/v1/futures/transfer', params: kwargs.merge(
|
52
|
-
asset: asset,
|
53
|
-
startTime: startTime
|
54
|
-
))
|
55
|
-
end
|
56
|
-
|
57
|
-
# Borrow For Cross-Collateral (TRADE)
|
58
|
-
#
|
59
|
-
# POST /sapi/v1/futures/loan/borrow
|
60
|
-
#
|
61
|
-
# @param coin [String]
|
62
|
-
# @param collateralCoin [String]
|
63
|
-
# @param kwargs [Hash]
|
64
|
-
# @option kwargs [Float] :amount Mandatory when collateralAmount is empty.
|
65
|
-
# @option kwargs [Float] :collateralAmount Mandatory when amount is empty.
|
66
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
67
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#borrow-for-cross-collateral-trade
|
68
|
-
def cross_collateral_borrow(coin:, collateralCoin:, **kwargs)
|
69
|
-
Binance::Utils::Validation.require_param('coin', coin)
|
70
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
71
|
-
|
72
|
-
@session.sign_request(:post, '/sapi/v1/futures/loan/borrow', params: kwargs.merge(
|
73
|
-
coin: coin,
|
74
|
-
collateralCoin: collateralCoin
|
75
|
-
))
|
76
|
-
end
|
77
|
-
|
78
|
-
# Cross-Collateral Borrow History (USER_DATA)
|
79
|
-
#
|
80
|
-
# GET /sapi/v1/futures/loan/borrow/history
|
81
|
-
#
|
82
|
-
# @param kwargs [Hash]
|
83
|
-
# @option kwargs [String] :coin
|
84
|
-
# @option kwargs [Integer] :startTime
|
85
|
-
# @option kwargs [Integer] :endTime
|
86
|
-
# @option kwargs [Integer] :limit default 500, max 1000
|
87
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
88
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data
|
89
|
-
def cross_collateral_borrow_history(**kwargs)
|
90
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/borrow/history', params: kwargs)
|
91
|
-
end
|
92
|
-
|
93
|
-
# Repay For Cross-Collateral (TRADE)
|
94
|
-
#
|
95
|
-
# POST /sapi/v1/futures/loan/repay
|
96
|
-
#
|
97
|
-
# @param coin [String]
|
98
|
-
# @param collateralCoin [String]
|
99
|
-
# @param amount [Float]
|
100
|
-
# @param kwargs [Hash]
|
101
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
102
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#repay-for-cross-collateral-trade
|
103
|
-
def cross_collateral_repay(coin:, collateralCoin:, amount:, **kwargs)
|
104
|
-
Binance::Utils::Validation.require_param('coin', coin)
|
105
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
106
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
107
|
-
|
108
|
-
@session.sign_request(:post, '/sapi/v1/futures/loan/repay', params: kwargs.merge(
|
109
|
-
coin: coin,
|
110
|
-
collateralCoin: collateralCoin,
|
111
|
-
amount: amount
|
112
|
-
))
|
113
|
-
end
|
114
|
-
|
115
|
-
# Cross-Collateral Repayment History (USER_DATA)
|
116
|
-
#
|
117
|
-
# GET /sapi/v1/futures/loan/repay/history
|
118
|
-
#
|
119
|
-
# @param kwargs [Hash]
|
120
|
-
# @option kwargs [String] :coin
|
121
|
-
# @option kwargs [Integer] :startTime
|
122
|
-
# @option kwargs [Integer] :endTime
|
123
|
-
# @option kwargs [Integer] :limit default 500, max 1000
|
124
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
125
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data
|
126
|
-
def cross_collateral_repay_history(**kwargs)
|
127
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/repay/history', params: kwargs)
|
128
|
-
end
|
129
|
-
|
130
|
-
# Cross-Collateral Wallet (USER_DATA)
|
131
|
-
#
|
132
|
-
# GET /sapi/v2/futures/loan/wallet
|
133
|
-
#
|
134
|
-
# @param kwargs [Hash]
|
135
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
136
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-v2-user_data
|
137
|
-
def cross_collateral_wallet(**kwargs)
|
138
|
-
@session.sign_request(:get, '/sapi/v2/futures/loan/wallet', params: kwargs)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Cross-Collateral Information (USER_DATA)
|
142
|
-
#
|
143
|
-
# GET /sapi/v2/futures/loan/configs
|
144
|
-
#
|
145
|
-
# @param kwargs [Hash]
|
146
|
-
# @option kwargs [String] :loanCoin
|
147
|
-
# @option kwargs [String] :collateralCoin
|
148
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
149
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-information-v2-user_data
|
150
|
-
def cross_collateral_info(**kwargs)
|
151
|
-
@session.sign_request(:get, '/sapi/v2/futures/loan/configs', params: kwargs)
|
152
|
-
end
|
153
|
-
|
154
|
-
# Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)
|
155
|
-
#
|
156
|
-
# GET /sapi/v2/futures/loan/calcAdjustLevel
|
157
|
-
#
|
158
|
-
# @param loanCoin [String]
|
159
|
-
# @param collateralCoin [String]
|
160
|
-
# @param amount [Float]
|
161
|
-
# @param direction [String] "ADDITIONAL", "REDUCED"
|
162
|
-
# @param kwargs [Hash]
|
163
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
164
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#calculate-rate-after-adjust-cross-collateral-ltv-v2-user_data
|
165
|
-
def calculate_adjust_rate(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
|
166
|
-
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
167
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
168
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
169
|
-
Binance::Utils::Validation.require_param('direction', direction)
|
170
|
-
|
171
|
-
@session.sign_request(:get, '/sapi/v2/futures/loan/calcAdjustLevel', params: kwargs.merge(
|
172
|
-
loanCoin: loanCoin,
|
173
|
-
collateralCoin: collateralCoin,
|
174
|
-
amount: amount,
|
175
|
-
direction: direction
|
176
|
-
))
|
177
|
-
end
|
178
|
-
|
179
|
-
# Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA)
|
180
|
-
#
|
181
|
-
# GET /sapi/v2/futures/loan/calcMaxAdjustAmount
|
182
|
-
#
|
183
|
-
# @param loanCoin [String]
|
184
|
-
# @param collateralCoin [String]
|
185
|
-
# @param kwargs [Hash]
|
186
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
187
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#get-max-amount-for-adjust-cross-collateral-ltv-v2-user_data
|
188
|
-
def calculate_adjust_max_amount(loanCoin:, collateralCoin:, **kwargs)
|
189
|
-
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
190
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
191
|
-
|
192
|
-
@session.sign_request(:get, '/sapi/v2/futures/loan/calcMaxAdjustAmount', params: kwargs.merge(
|
193
|
-
loanCoin: loanCoin,
|
194
|
-
collateralCoin: collateralCoin
|
195
|
-
))
|
196
|
-
end
|
197
|
-
|
198
|
-
# Adjust Cross-Collateral LTV (TRADE)
|
199
|
-
#
|
200
|
-
# POST /sapi/v2/futures/loan/adjustCollateral
|
201
|
-
#
|
202
|
-
# @param loanCoin [String]
|
203
|
-
# @param collateralCoin [String]
|
204
|
-
# @param amount [Float]
|
205
|
-
# @param direction [String] "ADDITIONAL", "REDUCED"
|
206
|
-
# @param kwargs [Hash]
|
207
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
208
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-v2-trade
|
209
|
-
def adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
|
210
|
-
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
211
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
212
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
213
|
-
Binance::Utils::Validation.require_param('direction', direction)
|
214
|
-
|
215
|
-
@session.sign_request(:post, '/sapi/v2/futures/loan/adjustCollateral', params: kwargs.merge(
|
216
|
-
loanCoin: loanCoin,
|
217
|
-
collateralCoin: collateralCoin,
|
218
|
-
amount: amount,
|
219
|
-
direction: direction
|
220
|
-
))
|
221
|
-
end
|
222
|
-
|
223
|
-
# Adjust Cross-Collateral LTV History (USER_DATA)
|
224
|
-
#
|
225
|
-
# GET /sapi/v1/futures/loan/adjustCollateral/history
|
226
|
-
#
|
227
|
-
# All data will be returned if loanCoin or collateralCoin is not sent
|
228
|
-
#
|
229
|
-
# @param kwargs [Hash]
|
230
|
-
# @option kwargs [String] :loanCoin
|
231
|
-
# @option kwargs [String] :collateralCoin
|
232
|
-
# @option kwargs [Integer] :startTime
|
233
|
-
# @option kwargs [Integer] :endTime
|
234
|
-
# @option kwargs [Integer] :limit default 500, max 1000
|
235
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
236
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data
|
237
|
-
def adjust_cross_collateral_history(**kwargs)
|
238
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/adjustCollateral/history', params: kwargs)
|
239
|
-
end
|
240
|
-
|
241
|
-
# Cross-Collateral Liquidation History (USER_DATA)
|
242
|
-
#
|
243
|
-
# GET /sapi/v1/futures/loan/liquidationHistory
|
244
|
-
#
|
245
|
-
# All data will be returned if loanCoin or collateralCoin is not sent
|
246
|
-
#
|
247
|
-
# @param kwargs [Hash]
|
248
|
-
# @option kwargs [String] :loanCoin
|
249
|
-
# @option kwargs [String] :collateralCoin
|
250
|
-
# @option kwargs [Integer] :startTime
|
251
|
-
# @option kwargs [Integer] :endTime
|
252
|
-
# @option kwargs [Integer] :limit default 500, max 1000
|
253
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
254
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data
|
255
|
-
def cross_collateral_liquidation_history(**kwargs)
|
256
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/liquidationHistory', params: kwargs)
|
257
|
-
end
|
258
|
-
|
259
|
-
# Check Collateral Repay Limit (USER_DATA)
|
260
|
-
#
|
261
|
-
# GET /sapi/v1/futures/loan/collateralRepayLimit
|
262
|
-
#
|
263
|
-
# Check the maximum and minimum limit when repay with collateral.
|
264
|
-
#
|
265
|
-
# @param coin [String]
|
266
|
-
# @param collateralCoin [String]
|
267
|
-
# @param kwargs [Hash]
|
268
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
269
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#check-collateral-repay-limit-user_data
|
270
|
-
def collateral_repay_limit(coin:, collateralCoin:, **kwargs)
|
271
|
-
Binance::Utils::Validation.require_param('coin', coin)
|
272
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
273
|
-
|
274
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayLimit', params: kwargs.merge(
|
275
|
-
coin: coin,
|
276
|
-
collateralCoin: collateralCoin
|
277
|
-
))
|
278
|
-
end
|
279
|
-
|
280
|
-
# Get Collateral Repay Quote (USER_DATA)
|
281
|
-
#
|
282
|
-
# GET /sapi/v1/futures/loan/collateralRepay
|
283
|
-
#
|
284
|
-
# Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.
|
285
|
-
#
|
286
|
-
# @param coin [String]
|
287
|
-
# @param collateralCoin [String]
|
288
|
-
# @param amount [Float]
|
289
|
-
# @param kwargs [Hash]
|
290
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
291
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#get-collateral-repay-quote-user_data
|
292
|
-
def collateral_repay_quote(coin:, collateralCoin:, amount:, **kwargs)
|
293
|
-
Binance::Utils::Validation.require_param('coin', coin)
|
294
|
-
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
295
|
-
Binance::Utils::Validation.require_param('amount', amount)
|
296
|
-
|
297
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
|
298
|
-
coin: coin,
|
299
|
-
collateralCoin: collateralCoin,
|
300
|
-
amount: amount
|
301
|
-
))
|
302
|
-
end
|
303
|
-
|
304
|
-
# Repay with Collateral (USER_DATA)
|
305
|
-
#
|
306
|
-
# POST /sapi/v1/futures/loan/collateralRepay
|
307
|
-
#
|
308
|
-
# Repay with collateral. Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.
|
309
|
-
#
|
310
|
-
# @param quoteId [String]
|
311
|
-
# @param kwargs [Hash]
|
312
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
313
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#repay-with-collateral-user_data
|
314
|
-
def repay_with_collateral(quoteId:, **kwargs)
|
315
|
-
Binance::Utils::Validation.require_param('quoteId', quoteId)
|
316
|
-
|
317
|
-
@session.sign_request(:post, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
|
318
|
-
quoteId: quoteId
|
319
|
-
))
|
320
|
-
end
|
321
|
-
|
322
|
-
# Collateral Repayment Result (USER_DATA)
|
323
|
-
#
|
324
|
-
# GET /sapi/v1/futures/loan/collateralRepayResult
|
325
|
-
#
|
326
|
-
# Check collateral repayment result.
|
327
|
-
#
|
328
|
-
# @param quoteId [String]
|
329
|
-
# @param kwargs [Hash]
|
330
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
331
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#collateral-repayment-result-user_data
|
332
|
-
def repayment_result(quoteId:, **kwargs)
|
333
|
-
Binance::Utils::Validation.require_param('quoteId', quoteId)
|
334
|
-
|
335
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayResult', params: kwargs.merge(
|
336
|
-
quoteId: quoteId
|
337
|
-
))
|
338
|
-
end
|
339
|
-
|
340
|
-
# Cross-Collateral Interest History (USER_DATA)
|
341
|
-
#
|
342
|
-
# GET /sapi/v1/futures/loan/interestHistory
|
343
|
-
#
|
344
|
-
# @param kwargs [Hash]
|
345
|
-
# @option kwargs [String] :collateralCoin
|
346
|
-
# @option kwargs [Integer] :startTime
|
347
|
-
# @option kwargs [Integer] :endTime
|
348
|
-
# @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
|
349
|
-
# @option kwargs [Integer] :limit default 500, max 1000
|
350
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
351
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data
|
352
|
-
def cross_collateral_interest_history(**kwargs)
|
353
|
-
@session.sign_request(:get, '/sapi/v1/futures/loan/interestHistory', params: kwargs)
|
354
|
-
end
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|