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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7772695ac930d9fc5f8be1a2c90acea825f57d9a7bab222fa0bc98eda4ad4b68
|
4
|
+
data.tar.gz: 4eebab3405f8a25a76e59bdf25ff42efad8d04d74571e4aa65201d9c50f397f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16d3f195fb8e3a86e79d781320a6ca7646457e4e4f85e6852c8ef309004336215b56b800a98e306179c80cbe494a1bf7f7a15c778bdb9450cd9bc8b3d9486903
|
7
|
+
data.tar.gz: 98b92b80f7965279756cb7e63a29c15d18cd44d49b4322800e189b24901ec029b02c085694d41279168d931d8b3e2f72df036ae906a9ddf78cc14b15e319e6ce
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,133 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.7.0 -2024-12-05
|
4
|
+
### Added
|
5
|
+
- Convert endpoints:
|
6
|
+
- `GET /sapi/v1/convert/exchangeInfo`
|
7
|
+
- `GET /sapi/v1/convert/assetInfo`
|
8
|
+
- `POST /sapi/v1/convert/getQuote`
|
9
|
+
- `POST /sapi/v1/convert/acceptQuote`
|
10
|
+
- `GET /sapi/v1/convert/orderStatus`
|
11
|
+
- `POST /sapi/v1/convert/limit/placeOrder`
|
12
|
+
- `POST /sapi/v1/convert/limit/cancelOrder`
|
13
|
+
- `POST /sapi/v1/convert/limit/queryOpenOrders`
|
14
|
+
|
15
|
+
- Loan endpoints:
|
16
|
+
- `GET /sapi/v2/loan/flexible/collateral/data`
|
17
|
+
- `GET /sapi/v2/loan/flexible/loanable/data`
|
18
|
+
- `POST /sapi/v2/loan/flexible/borrow`
|
19
|
+
- `POST /sapi/v2/loan/flexible/repay`
|
20
|
+
- `POST /sapi/v2/loan/flexible/adjust/ltv`
|
21
|
+
- `GET /sapi/v2/loan/flexible/ltv/adjustment/history`
|
22
|
+
- `GET /sapi/v2/loan/flexible/borrow/history`
|
23
|
+
- `GET /sapi/v2/loan/flexible/ongoing/orders`
|
24
|
+
- `GET /sapi/v2/loan/flexible/repay/history`
|
25
|
+
- `GET /sapi/v1/loan/borrow/history`
|
26
|
+
- `GET /sapi/v1/loan/ltv/adjustment/history`
|
27
|
+
- `GET /sapi/v1/loan/repay/history`
|
28
|
+
|
29
|
+
- Margin endpoints:
|
30
|
+
- `POST /sapi/v1/margin/borrow-repay`
|
31
|
+
- `GET /sapi/v1/margin/borrow-repay`
|
32
|
+
- `GET /sapi/v1/margin/available-inventory`
|
33
|
+
- `GET /sapi/v1/margin/leverageBracket`
|
34
|
+
- `POST /sapi/v1/margin/manual-liquidation`
|
35
|
+
|
36
|
+
- Market endpoints:
|
37
|
+
- `GET /api/v3/ticker/tradingDay`
|
38
|
+
- `GET /api/v3/uiKlines`
|
39
|
+
|
40
|
+
- Simple Earn endpoints:
|
41
|
+
- `POST /sapi/v1/simple-earn/locked/setRedeemOption`
|
42
|
+
|
43
|
+
- Sub Account endpoints:
|
44
|
+
- `GET /sapi/v4/sub-account/assets`
|
45
|
+
- `POST /sapi/v1/sub-account/eoptions/enable`
|
46
|
+
- `GET /sapi/v1/managed-subaccount/marginAsset`
|
47
|
+
- `GET /sapi/v1/sub-account/transaction-statistics`
|
48
|
+
- `GET /sapi/v1/managed-subaccount/fetch-future-asset`
|
49
|
+
- `GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent`
|
50
|
+
- `GET /sapi/v1/managed-subaccount/query-trans-log`
|
51
|
+
- `GET /sapi/v1/managed-subaccount/queryTransLogForInvestor`
|
52
|
+
- `GET /sapi/v1/managed-subaccount/info`
|
53
|
+
|
54
|
+
- Trade endpoint:
|
55
|
+
- `GET /api/v3/myPreventedMatches`
|
56
|
+
- `GET /api/v3/myAllocations`
|
57
|
+
- `GET /api/v3/account/commission`
|
58
|
+
|
59
|
+
- Wallet endpoints:
|
60
|
+
- `GET /sapi/v1/spot/delist-schedule`
|
61
|
+
- `GET /sapi/v1/capital/deposit/address/list`
|
62
|
+
- `POST /sapi/v1/capital/deposit/credit-apply`
|
63
|
+
- `GET /sapi/v1/asset/wallet/balance`
|
64
|
+
- `POST /sapi/v1/asset/dust-btc`
|
65
|
+
- `GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage`
|
66
|
+
- `GET /sapi/v1/asset/custody/transfer-history`
|
67
|
+
- `GET /sapi/v1/account/info`
|
68
|
+
|
69
|
+
- Websocket:
|
70
|
+
- `<symbol>@avgPrice`
|
71
|
+
|
72
|
+
### Changed
|
73
|
+
- Added new parameter `redeemTo` to endpoint `POST /sapi/v1/simple-earn/locked/subscribe`
|
74
|
+
- Added new parameter `timeZone` to endpoint `GET /api/v3/klines`
|
75
|
+
- Added new parameters `orderRateLimitExceededMode`, `strategyId`, `strategyType`, `selfTradePreventionMode` and `cancelRestrictions` to endpoint `POST /api/v3/order/cancelReplace`
|
76
|
+
- Added new parameters `showPermissionSets` and `symbolStatus` to endpoint `GET /api/v3/exchangeInfo`
|
77
|
+
- Replaced endpoint `POST /api/v3/order/oco` by `POST /api/v3/orderList/oco`
|
78
|
+
|
79
|
+
## 1.6.0 - 2024-10-02
|
80
|
+
|
81
|
+
### Changed
|
82
|
+
- Updated endpoint `/sapi/v1/sub-account/subAccountApi/ipRestriction` to `/sapi/v2/sub-account/subAccountApi/ipRestriction`
|
83
|
+
- Update dependencies
|
84
|
+
|
85
|
+
### Removed
|
86
|
+
- Deprecated margin endpoints:
|
87
|
+
- `POST /sapi/v1/margin/transfer`
|
88
|
+
- `POST /sapi/v1/margin/isolated/transfer`
|
89
|
+
- `POST /sapi/v1/margin/loan`
|
90
|
+
- `POST /sapi/v1/margin/repay`
|
91
|
+
- `GET /sapi/v1/margin/isolated/transfer`
|
92
|
+
- `GET /sapi/v1/margin/asset`
|
93
|
+
- `GET /sapi/v1/margin/pair`
|
94
|
+
- `GET /sapi/v1/margin/isolated/pair`
|
95
|
+
- `GET /sapi/v1/margin/loan`
|
96
|
+
- `GET /sapi/v1/margin/repay`
|
97
|
+
- `GET /sapi/v1/margin/dribblet`
|
98
|
+
- `GET /sapi/v1/margin/dust`
|
99
|
+
- `POST /sapi/v1/margin/dust`
|
100
|
+
|
101
|
+
- Deprecated SubAccount endpoint: `POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList`
|
102
|
+
|
103
|
+
- Deprecated Futures endpoints:
|
104
|
+
- `GET /sapi/v1/futures/loan/interestHistory`
|
105
|
+
- `GET /sapi/v1/futures/loan/collateralRepayResult`
|
106
|
+
- `POST /sapi/v1/futures/loan/collateralRepay`
|
107
|
+
- `GET /sapi/v1/futures/loan/collateralRepay`
|
108
|
+
- `GET /sapi/v1/futures/loan/collateralRepayLimit`
|
109
|
+
- `GET /sapi/v1/futures/loan/liquidationHistory`
|
110
|
+
- `GET /sapi/v1/futures/loan/adjustCollateral/history`
|
111
|
+
- `POST /sapi/v2/futures/loan/adjustCollateral`
|
112
|
+
- `GET /sapi/v2/futures/loan/calcMaxAdjustAmount`
|
113
|
+
- `GET /sapi/v2/futures/loan/calcAdjustLevel`
|
114
|
+
- `GET /sapi/v2/futures/loan/configs`
|
115
|
+
- `GET /sapi/v2/futures/loan/wallet`
|
116
|
+
- `GET /sapi/v1/futures/loan/repay/history`
|
117
|
+
- `POST /sapi/v1/futures/loan/repay`
|
118
|
+
- `GET /sapi/v1/futures/loan/borrow/history`
|
119
|
+
- `POST /sapi/v1/futures/loan/borrow`
|
120
|
+
- `GET /sapi/v1/futures/transfer`
|
121
|
+
- `POST /sapi/v1/futures/transfer`
|
122
|
+
|
123
|
+
- BLVT endpoints:
|
124
|
+
- `GET /sapi/v1/blvt/tokenInfo`
|
125
|
+
- `POST /sapi/v1/blvt/subscribe`
|
126
|
+
- `GET /sapi/v1/blvt/subscribe/record`
|
127
|
+
- `POST /sapi/v1/blvt/redeem`
|
128
|
+
- `GET /sapi/v1/blvt/redeem/record`
|
129
|
+
- `GET /sapi/v1/blvt/userLimit`
|
130
|
+
|
3
131
|
## 1.5.2 - 2024-07-23
|
4
132
|
|
5
133
|
### Changed
|
data/lib/binance/session.rb
CHANGED
@@ -33,7 +33,8 @@ module Binance
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def process_request(conn, method, path, params)
|
36
|
-
|
36
|
+
compact = (params || {}).compact || {}
|
37
|
+
response = conn.send(method, path_with_query(path, compact), nil)
|
37
38
|
extract_response(response)
|
38
39
|
rescue Faraday::ClientError => e
|
39
40
|
raise Binance::ClientError, e.response
|
data/lib/binance/spot/c2c.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# C2C endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/c2c/Introduction
|
7
7
|
module C2C
|
8
8
|
# Get C2C Trade History (USER_DATA)
|
9
9
|
#
|
@@ -16,7 +16,7 @@ module Binance
|
|
16
16
|
# @option kwargs [Integer] :rows
|
17
17
|
# @option kwargs [Integer] :recvWindow
|
18
18
|
# @option kwargs [Integer] :timestamp
|
19
|
-
# @see https://binance
|
19
|
+
# @see https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History
|
20
20
|
def c2c_trade_history(tradeType:, **kwargs)
|
21
21
|
Binance::Utils::Validation.require_param('tradeType', tradeType)
|
22
22
|
|
data/lib/binance/spot/convert.rb
CHANGED
@@ -3,8 +3,70 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# Convert endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/convert/Introduction
|
7
7
|
module Convert
|
8
|
+
# List All Convert Pairs
|
9
|
+
#
|
10
|
+
# GET /sapi/v1/convert/exchangeInfo
|
11
|
+
#
|
12
|
+
# @param kwargs [Hash]
|
13
|
+
# @option kwargs [String] :fromAsset Either fromAsset or toAsset or both should be send. User spends coin
|
14
|
+
# @option kwargs [String] :toAsset Either fromAsset or toAsset or both should be send. User spends coin
|
15
|
+
# @see https://developers.binance.com/docs/convert/market-data
|
16
|
+
def convert_exchange_info(**kwargs)
|
17
|
+
@session.sign_request(:get, '/sapi/v1/convert/exchangeInfo', params: kwargs)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Query order quantity precision per asset (USER_DATA)
|
21
|
+
#
|
22
|
+
# GET /sapi/v1/convert/assetInfo
|
23
|
+
#
|
24
|
+
# @param kwargs [Hash]
|
25
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
26
|
+
# @see https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset
|
27
|
+
def convert_asset_info(**kwargs)
|
28
|
+
@session.sign_request(:get, '/sapi/v1/convert/assetInfo', params: kwargs)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Send Quote Request (USER_DATA)
|
32
|
+
#
|
33
|
+
# POST /sapi/v1/convert/getQuote
|
34
|
+
#
|
35
|
+
# @param fromAsset [String]
|
36
|
+
# @param toAsset [String]
|
37
|
+
# @param kwargs [Hash]
|
38
|
+
# @option kwargs [Float] :fromAmount Either fromAmount or toAmount should be specified. When specified, it is the amount you will be debited after the conversion
|
39
|
+
# @option kwargs [Float] :toAmount Either fromAmount or toAmount should be specified. When specified, it is the amount you will be credited after the conversion
|
40
|
+
# @option kwargs [String] :walletType SPOT or FUNDING. Default is SPOT
|
41
|
+
# @option kwargs [String] :validTime 10s, 30s, 1m, default 10s
|
42
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
43
|
+
# @see https://developers.binance.com/docs/convert/trade
|
44
|
+
def convert_get_quote(fromAsset:, toAsset:, **kwargs)
|
45
|
+
Binance::Utils::Validation.require_param('fromAsset', fromAsset)
|
46
|
+
Binance::Utils::Validation.require_param('toAsset', toAsset)
|
47
|
+
|
48
|
+
@session.sign_request(:post, '/sapi/v1/convert/getQuote', params: kwargs.merge(
|
49
|
+
fromAsset: fromAsset,
|
50
|
+
toAsset: toAsset
|
51
|
+
))
|
52
|
+
end
|
53
|
+
|
54
|
+
# Accept Quote (TRADE)
|
55
|
+
#
|
56
|
+
# POST /sapi/v1/convert/acceptQuote
|
57
|
+
#
|
58
|
+
# @param quoteId [String]
|
59
|
+
# @param kwargs [Hash]
|
60
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
61
|
+
# @see https://developers.binance.com/docs/convert/trade/Accept-Quote
|
62
|
+
def convert_accept_quote(quoteId:, **kwargs)
|
63
|
+
Binance::Utils::Validation.require_param('quoteId', quoteId)
|
64
|
+
|
65
|
+
@session.sign_request(:post, '/sapi/v1/convert/acceptQuote', params: kwargs.merge(
|
66
|
+
quoteId: quoteId
|
67
|
+
))
|
68
|
+
end
|
69
|
+
|
8
70
|
# Get Convert Trade History (USER_DATA)
|
9
71
|
#
|
10
72
|
# GET /sapi/v1/convert/tradeFlow
|
@@ -14,7 +76,7 @@ module Binance
|
|
14
76
|
# @param kwargs [Hash]
|
15
77
|
# @option kwargs [Integer] :limit default 100, max 1000
|
16
78
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
17
|
-
# @see https://binance
|
79
|
+
# @see https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History
|
18
80
|
def convert_trade_flow(startTime:, endTime:, **kwargs)
|
19
81
|
Binance::Utils::Validation.require_param('startTime', startTime)
|
20
82
|
Binance::Utils::Validation.require_param('endTime', endTime)
|
@@ -24,6 +86,76 @@ module Binance
|
|
24
86
|
endTime: endTime
|
25
87
|
))
|
26
88
|
end
|
89
|
+
|
90
|
+
# Order status (USER_DATA)
|
91
|
+
#
|
92
|
+
# GET /sapi/v1/convert/orderStatus
|
93
|
+
#
|
94
|
+
# @param kwargs [Hash]
|
95
|
+
# @option kwargs [String] :orderId Either orderId or quoteId is required
|
96
|
+
# @option kwargs [String] :quoteId Either orderId or quoteId is required
|
97
|
+
# @see https://developers.binance.com/docs/convert/trade/Order-Status
|
98
|
+
def convert_order_status(**kwargs)
|
99
|
+
@session.sign_request(:get, '/sapi/v1/convert/orderStatus', params: kwargs)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Place limit order (USER_DATA)
|
103
|
+
#
|
104
|
+
# POST /sapi/v1/convert/limit/placeOrder
|
105
|
+
#
|
106
|
+
# @param baseAsset [String] base asset (use the response fromIsBase from GET /sapi/v1/convert/exchangeInfo api to check which one is baseAsset)
|
107
|
+
# @param quoteAsset [String] quote asset
|
108
|
+
# @param limitPrice [Float] Symbol limit price (from baseAsset to quoteAsset)
|
109
|
+
# @param side [String] BUY or SELL
|
110
|
+
# @param expiredType [String] 1_D, 3_D, 7_D, 30_D (D means day)
|
111
|
+
# @param kwargs [Hash]
|
112
|
+
# @option kwargs [Float] :baseAmount Base asset amount. (One of baseAmount or quoteAmount is required)
|
113
|
+
# @option kwargs [Float] :quoteAmount Quote asset amount. (One of baseAmount or quoteAmount is required)
|
114
|
+
# @option kwargs [String] :walletType SPOT or FUNDING or SPOT_FUNDING. It is to use which type of assets. Default is SPOT.
|
115
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
116
|
+
# @see https://developers.binance.com/docs/convert/trade/Place-Order
|
117
|
+
def convert_limit_place_order(baseAsset:, quoteAsset:, limitPrice:, side:, expiredType:, **kwargs)
|
118
|
+
Binance::Utils::Validation.require_param('baseAsset', baseAsset)
|
119
|
+
Binance::Utils::Validation.require_param('quoteAsset', quoteAsset)
|
120
|
+
Binance::Utils::Validation.require_param('limitPrice', limitPrice)
|
121
|
+
Binance::Utils::Validation.require_param('side', side)
|
122
|
+
Binance::Utils::Validation.require_param('expiredType', expiredType)
|
123
|
+
|
124
|
+
@session.sign_request(:post, '/sapi/v1/convert/limit/placeOrder', params: kwargs.merge(
|
125
|
+
baseAsset: baseAsset,
|
126
|
+
quoteAsset: quoteAsset,
|
127
|
+
limitPrice: limitPrice,
|
128
|
+
side: side,
|
129
|
+
expiredType: expiredType
|
130
|
+
))
|
131
|
+
end
|
132
|
+
|
133
|
+
# Cancel limit order (USER_DATA)
|
134
|
+
#
|
135
|
+
# POST /sapi/v1/convert/limit/cancelOrder
|
136
|
+
#
|
137
|
+
# @param orderId [String]
|
138
|
+
# @param kwargs [Hash]
|
139
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
140
|
+
# @see https://developers.binance.com/docs/convert/trade/Cancel-Order
|
141
|
+
def convert_limit_cancel_order(orderId:, **kwargs)
|
142
|
+
Binance::Utils::Validation.require_param('orderId', orderId)
|
143
|
+
|
144
|
+
@session.sign_request(:post, '/sapi/v1/convert/limit/cancelOrder', params: kwargs.merge(
|
145
|
+
orderId: orderId
|
146
|
+
))
|
147
|
+
end
|
148
|
+
|
149
|
+
# Query limit open orders (USER_DATA)
|
150
|
+
#
|
151
|
+
# POST /sapi/v1/convert/limit/queryOpenOrders
|
152
|
+
#
|
153
|
+
# @param kwargs [Hash]
|
154
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
155
|
+
# @see https://developers.binance.com/docs/convert/trade/Query-Order
|
156
|
+
def convert_limit_query_open_orders(**kwargs)
|
157
|
+
@session.sign_request(:post, '/sapi/v1/convert/limit/queryOpenOrders', params: kwargs)
|
158
|
+
end
|
27
159
|
end
|
28
160
|
end
|
29
161
|
end
|
data/lib/binance/spot/fiat.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# Fiat endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/fiat/Introduction
|
7
7
|
module Fiat
|
8
8
|
# Get Fiat Deposit/Withdraw History (USER_DATA)
|
9
9
|
#
|
@@ -16,7 +16,7 @@ module Binance
|
|
16
16
|
# @option kwargs [Integer] :page default 1
|
17
17
|
# @option kwargs [Integer] :rows default 100, max 500
|
18
18
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
19
|
-
# @see https://binance
|
19
|
+
# @see https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History
|
20
20
|
def fiat_deposit_withdraw_history(transactionType:, **kwargs)
|
21
21
|
Binance::Utils::Validation.require_param('transactionType', transactionType)
|
22
22
|
|
@@ -36,7 +36,7 @@ module Binance
|
|
36
36
|
# @option kwargs [Integer] :page default 1
|
37
37
|
# @option kwargs [Integer] :rows default 100, max 500
|
38
38
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
39
|
-
# @see https://binance
|
39
|
+
# @see https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History
|
40
40
|
def fiat_payment_history(transactionType:, **kwargs)
|
41
41
|
Binance::Utils::Validation.require_param('transactionType', transactionType)
|
42
42
|
|
data/lib/binance/spot/loan.rb
CHANGED
@@ -3,23 +3,237 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# all loan endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/crypto_loan/Introduction
|
7
7
|
module Loan
|
8
|
+
# Get Flexible Loan Collateral Assets Data (USER_DATA)
|
9
|
+
#
|
10
|
+
# GET /sapi/v2/loan/flexible/collateral/data
|
11
|
+
#
|
12
|
+
# @param kwargs [Hash]
|
13
|
+
# @option kwargs [String] :collateralCoin
|
14
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
15
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data
|
16
|
+
def get_flexible_loan_collateral_data(**kwargs)
|
17
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/collateral/data', params: kwargs)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get Flexible Loan Assets Data (USER_DATA)
|
21
|
+
#
|
22
|
+
# GET /sapi/v2/loan/flexible/loanable/data
|
23
|
+
#
|
24
|
+
# @param kwargs [Hash]
|
25
|
+
# @option kwargs [String] :loanCoin
|
26
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
27
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data/Get-Flexible-Loan-Assets-Data
|
28
|
+
def get_flexible_loan_assets_data(**kwargs)
|
29
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/loanable/data', params: kwargs)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Flexible Loan Borrow (TRADE)
|
33
|
+
#
|
34
|
+
# POST /sapi/v2/loan/flexible/borrow
|
35
|
+
#
|
36
|
+
# @param loanCoin [String]
|
37
|
+
# @param collateralCoin [String]
|
38
|
+
# @param kwargs [Hash]
|
39
|
+
# @option kwargs [Float] :loanAmount Mandatory when collateralAmount is empty
|
40
|
+
# @option kwargs [Float] :collateralAmount Mandatory when loanAmount is empty
|
41
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
42
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/trade
|
43
|
+
def borrow_flexible_loan(loanCoin:, collateralCoin:, **kwargs)
|
44
|
+
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
45
|
+
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
46
|
+
|
47
|
+
@session.sign_request(:post, '/sapi/v2/loan/flexible/borrow', params: kwargs.merge(
|
48
|
+
loanCoin: loanCoin,
|
49
|
+
collateralCoin: collateralCoin
|
50
|
+
))
|
51
|
+
end
|
52
|
+
|
53
|
+
# Flexible Loan Repay (TRADE)
|
54
|
+
#
|
55
|
+
# POST /sapi/v2/loan/flexible/repay
|
56
|
+
#
|
57
|
+
# @param loanCoin [String]
|
58
|
+
# @param collateralCoin [String]
|
59
|
+
# @param repayAmount [Float]
|
60
|
+
# @param kwargs [Hash]
|
61
|
+
# @option kwargs [Boolean] :collateralReturn Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order, and lower LTV.
|
62
|
+
# @option kwargs [Boolean] :fullRepayment Default: FALSE. TRUE: Full repayment; FALSE: Partial repayment, based on loanAmount
|
63
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
64
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Repay
|
65
|
+
def repay_flexible_loan(loanCoin:, collateralCoin:, repayAmount:, **kwargs)
|
66
|
+
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
67
|
+
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
68
|
+
Binance::Utils::Validation.require_param('repayAmount', repayAmount)
|
69
|
+
|
70
|
+
@session.sign_request(:post, '/sapi/v2/loan/flexible/repay', params: kwargs.merge(
|
71
|
+
loanCoin: loanCoin,
|
72
|
+
collateralCoin: collateralCoin,
|
73
|
+
repayAmount: repayAmount
|
74
|
+
))
|
75
|
+
end
|
76
|
+
|
77
|
+
# Flexible Loan Adjust LTV (TRADE)
|
78
|
+
#
|
79
|
+
# POST /sapi/v2/loan/flexible/adjust/ltv
|
80
|
+
#
|
81
|
+
# @param loanCoin [String]
|
82
|
+
# @param collateralCoin [String]
|
83
|
+
# @param adjustmentAmount [Float]
|
84
|
+
# @param direction [String] ADDITIONAL or REDUCED
|
85
|
+
# @param kwargs [Hash]
|
86
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
87
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Adjust-LTV
|
88
|
+
def adjust_flexible_loan_ltv(loanCoin:, collateralCoin:, adjustmentAmount:, direction:, **kwargs)
|
89
|
+
Binance::Utils::Validation.require_param('loanCoin', loanCoin)
|
90
|
+
Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
|
91
|
+
Binance::Utils::Validation.require_param('adjustmentAmount', adjustmentAmount)
|
92
|
+
Binance::Utils::Validation.require_param('direction', direction)
|
93
|
+
|
94
|
+
@session.sign_request(:post, '/sapi/v2/loan/flexible/adjust/ltv', params: kwargs.merge(
|
95
|
+
loanCoin: loanCoin,
|
96
|
+
collateralCoin: collateralCoin,
|
97
|
+
adjustmentAmount: adjustmentAmount,
|
98
|
+
direction: direction
|
99
|
+
))
|
100
|
+
end
|
101
|
+
|
102
|
+
# Get Flexible Loan LTV Adjustment History (USER_DATA)
|
103
|
+
#
|
104
|
+
# GET /sapi/v2/loan/flexible/ltv/adjustment/history
|
105
|
+
#
|
106
|
+
# @param kwargs [Hash]
|
107
|
+
# @option kwargs [String] :loanCoin
|
108
|
+
# @option kwargs [String] :collateralCoin
|
109
|
+
# @option kwargs [Integer] :startTime
|
110
|
+
# @option kwargs [Integer] :endTime
|
111
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
112
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
113
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
114
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information
|
115
|
+
def get_flexible_loan_ltv_adjustment_history(**kwargs)
|
116
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/ltv/adjustment/history', params: kwargs)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Get Flexible Loan Borrow History(USER_DATA)
|
120
|
+
#
|
121
|
+
# GET /sapi/v2/loan/flexible/borrow/history
|
122
|
+
#
|
123
|
+
# @param kwargs [Hash]
|
124
|
+
# @option kwargs [String] :loanCoin
|
125
|
+
# @option kwargs [String] :collateralCoin
|
126
|
+
# @option kwargs [Integer] :startTime
|
127
|
+
# @option kwargs [Integer] :endTime
|
128
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
129
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
130
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
131
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Borrow-History
|
132
|
+
def get_flexible_loan_borrow_history(**kwargs)
|
133
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/borrow/history', params: kwargs)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Get Flexible Loan Ongoing Orders (USER_DATA)
|
137
|
+
#
|
138
|
+
# GET /sapi/v2/loan/flexible/ongoing/orders
|
139
|
+
#
|
140
|
+
# @param kwargs [Hash]
|
141
|
+
# @option kwargs [String] :loanCoin
|
142
|
+
# @option kwargs [String] :collateralCoin
|
143
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
144
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
145
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
146
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Ongoing-Orders
|
147
|
+
def get_flexible_loan_ongoing_orders(**kwargs)
|
148
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/ongoing/orders', params: kwargs)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Get Flexible Loan Repayment History (USER_DATA)
|
152
|
+
#
|
153
|
+
# GET /sapi/v2/loan/flexible/repay/history
|
154
|
+
#
|
155
|
+
# @param kwargs [Hash]
|
156
|
+
# @option kwargs [String] :loanCoin
|
157
|
+
# @option kwargs [String] :collateralCoin
|
158
|
+
# @option kwargs [Integer] :startTime
|
159
|
+
# @option kwargs [Integer] :endTime
|
160
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
161
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
162
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
163
|
+
# @see https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Repayment-History
|
164
|
+
def get_flexible_loan_repayment_history(**kwargs)
|
165
|
+
@session.sign_request(:get, '/sapi/v2/loan/flexible/repay/history', params: kwargs)
|
166
|
+
end
|
167
|
+
|
8
168
|
# Get Crypto Loans Income History (USER_DATA)
|
9
169
|
#
|
10
170
|
# GET /sapi/v1/loan/income
|
11
171
|
#
|
12
|
-
# @param
|
13
|
-
# @
|
172
|
+
# @param kwargs [Hash]
|
173
|
+
# @param kwargs [String] :asset
|
174
|
+
# @option kwargs [String] :type All types will be returned by default. Enum:borrowIn ,collateralSpent, repayAmount, collateralReturn(Collateral return after repayment), addCollateral
|
175
|
+
# removeCollateral, collateralReturnAfterLiquidation
|
14
176
|
# @option kwargs [Integer] :startTime
|
15
177
|
# @option kwargs [Integer] :endTime
|
16
178
|
# @option kwargs [Integer] :limit default 20, max 100
|
17
179
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
18
|
-
# @see https://binance
|
19
|
-
def get_loan_history(
|
20
|
-
|
180
|
+
# @see https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Crypto-Loans-Income-History
|
181
|
+
def get_loan_history(**kwargs)
|
182
|
+
@session.sign_request(:get, '/sapi/v1/loan/income', params: kwargs)
|
183
|
+
end
|
21
184
|
|
22
|
-
|
185
|
+
# Get Loan Borrow History (USER_DATA)
|
186
|
+
#
|
187
|
+
# GET /sapi/v1/loan/borrow/history
|
188
|
+
#
|
189
|
+
# @param kwargs [Hash]
|
190
|
+
# @option kwargs [Integer] :orderId orderId in POST /sapi/v1/loan/borrow
|
191
|
+
# @option kwargs [String] :loanCoin
|
192
|
+
# @option kwargs [String] :collateralCoin
|
193
|
+
# @option kwargs [Integer] :startTime
|
194
|
+
# @option kwargs [Integer] :endTime
|
195
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
196
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
197
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
198
|
+
# @see https://developers.binance.com/docs/crypto_loan/stable-rate/user-information
|
199
|
+
def get_loan_borrow_history(**kwargs)
|
200
|
+
@session.sign_request(:get, '/sapi/v1/loan/borrow/history', params: kwargs)
|
201
|
+
end
|
202
|
+
|
203
|
+
# Get Loan LTV Adjustment History (USER_DATA)
|
204
|
+
#
|
205
|
+
# GET /sapi/v1/loan/ltv/adjustment/history
|
206
|
+
#
|
207
|
+
# @param kwargs [Hash]
|
208
|
+
# @option kwargs [Integer] :orderId
|
209
|
+
# @option kwargs [String] :loanCoin
|
210
|
+
# @option kwargs [String] :collateralCoin
|
211
|
+
# @option kwargs [Integer] :startTime
|
212
|
+
# @option kwargs [Integer] :endTime
|
213
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
214
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
215
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
216
|
+
# @see https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-LTV-Adjustment-History
|
217
|
+
def get_loan_ltv_adjustment_history(**kwargs)
|
218
|
+
@session.sign_request(:get, '/sapi/v1/loan/ltv/adjustment/history', params: kwargs)
|
219
|
+
end
|
220
|
+
|
221
|
+
# Get Loan Repayment History (USER_DATA)
|
222
|
+
#
|
223
|
+
# GET /sapi/v1/loan/repay/history
|
224
|
+
#
|
225
|
+
# @param kwargs [Hash]
|
226
|
+
# @option kwargs [Integer] :orderId
|
227
|
+
# @option kwargs [String] :loanCoin
|
228
|
+
# @option kwargs [String] :collateralCoin
|
229
|
+
# @option kwargs [Integer] :startTime
|
230
|
+
# @option kwargs [Integer] :endTime
|
231
|
+
# @option kwargs [Integer] :current Current querying page. Start from 1; default: 1; max: 1000
|
232
|
+
# @option kwargs [Integer] :limit Default: 10; max: 100
|
233
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
234
|
+
# @see https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Repayment-History
|
235
|
+
def get_loan_repayment_history(**kwargs)
|
236
|
+
@session.sign_request(:get, '/sapi/v1/loan/repay/history', params: kwargs)
|
23
237
|
end
|
24
238
|
end
|
25
239
|
end
|