binance-connector-ruby 1.0.1
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 +7 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +224 -0
- data/lib/binance/authentication.rb +13 -0
- data/lib/binance/error.rb +28 -0
- data/lib/binance/session.rb +106 -0
- data/lib/binance/spot/blvt.rb +104 -0
- data/lib/binance/spot/bswap.rb +217 -0
- data/lib/binance/spot/c2c.rb +27 -0
- data/lib/binance/spot/fiat.rb +49 -0
- data/lib/binance/spot/futures.rb +357 -0
- data/lib/binance/spot/loan.rb +26 -0
- data/lib/binance/spot/margin.rb +676 -0
- data/lib/binance/spot/market.rb +220 -0
- data/lib/binance/spot/mining.rb +243 -0
- data/lib/binance/spot/savings.rb +269 -0
- data/lib/binance/spot/stream.rb +61 -0
- data/lib/binance/spot/subaccount.rb +553 -0
- data/lib/binance/spot/trade.rb +294 -0
- data/lib/binance/spot/wallet.rb +316 -0
- data/lib/binance/spot/websocket.rb +147 -0
- data/lib/binance/spot.rb +61 -0
- data/lib/binance/utils/faraday/custom_params_encoder.rb +78 -0
- data/lib/binance/utils/faraday/middleware/signature.rb +21 -0
- data/lib/binance/utils/faraday/middleware/timestamp.rb +20 -0
- data/lib/binance/utils/faraday/middleware.rb +4 -0
- data/lib/binance/utils/url.rb +26 -0
- data/lib/binance/utils/validation.rb +26 -0
- data/lib/binance/version.rb +5 -0
- data/lib/binance/websocket_base.rb +84 -0
- data/lib/binance.rb +5 -0
- metadata +161 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Binance
|
4
|
+
class Spot
|
5
|
+
# This module includes all spot public endpoints, including:
|
6
|
+
# - server time
|
7
|
+
# - kline
|
8
|
+
# - ticker
|
9
|
+
# - trades
|
10
|
+
# - orderbook
|
11
|
+
# - etc
|
12
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#market-data-endpoints
|
13
|
+
module Market
|
14
|
+
# Test Connectivity
|
15
|
+
#
|
16
|
+
# GET /api/v3/ping
|
17
|
+
#
|
18
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#test-connectivity
|
19
|
+
def ping
|
20
|
+
@session.public_request(path: '/api/v3/ping')
|
21
|
+
end
|
22
|
+
|
23
|
+
# Check Server Time
|
24
|
+
#
|
25
|
+
# GET /api/v3/time
|
26
|
+
#
|
27
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#check-server-time
|
28
|
+
def time
|
29
|
+
@session.public_request(path: '/api/v3/time')
|
30
|
+
end
|
31
|
+
|
32
|
+
# Exchange Information
|
33
|
+
#
|
34
|
+
# GET /api/v3/exchangeInfo
|
35
|
+
#
|
36
|
+
# @option kwargs [string] :symbol
|
37
|
+
# @option kwargs [string] :symbols
|
38
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#exchange-information
|
39
|
+
def exchange_info(symbol: nil, symbols: nil)
|
40
|
+
if symbols.is_a?(Array)
|
41
|
+
symbols = symbols.map { |v| "%22#{v}%22" }.join(',')
|
42
|
+
symbols = "%5B#{symbols}%5D"
|
43
|
+
end
|
44
|
+
@session.public_request(
|
45
|
+
path: '/api/v3/exchangeInfo',
|
46
|
+
params:
|
47
|
+
{
|
48
|
+
symbol: symbol,
|
49
|
+
symbols: symbols
|
50
|
+
}
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Order Book
|
55
|
+
#
|
56
|
+
# GET /api/v3/depth
|
57
|
+
#
|
58
|
+
# @param symbol [String] the symbol
|
59
|
+
# @param kwargs [Hash]
|
60
|
+
# @option kwargs [Integer] :limit Default 100; max 1000. Valid limits:[5, 10, 20, 50, 100, 500, 1000, 5000]
|
61
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#order-book
|
62
|
+
def depth(symbol:, **kwargs)
|
63
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
64
|
+
|
65
|
+
@session.public_request(
|
66
|
+
path: '/api/v3/depth',
|
67
|
+
params: kwargs.merge(symbol: symbol)
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Recent Trades List
|
72
|
+
#
|
73
|
+
# GET /api/v3/trades
|
74
|
+
#
|
75
|
+
# @param symbol [String] the symbol
|
76
|
+
# @param kwargs [Hash]
|
77
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
78
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#recent-trades-list
|
79
|
+
def trades(symbol:, **kwargs)
|
80
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
81
|
+
|
82
|
+
@session.public_request(
|
83
|
+
path: '/api/v3/trades',
|
84
|
+
params: kwargs.merge(symbol: symbol)
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Old Trade Lookup
|
89
|
+
#
|
90
|
+
# X-MBX-APIKEY required
|
91
|
+
#
|
92
|
+
# GET /api/v3/historicalTrades
|
93
|
+
#
|
94
|
+
# @param symbol [String] the symbol
|
95
|
+
# @param kwargs [Hash]
|
96
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
97
|
+
# @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades.
|
98
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup-market_data
|
99
|
+
def historical_trades(symbol:, **kwargs)
|
100
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
101
|
+
|
102
|
+
@session.public_request(
|
103
|
+
path: '/api/v3/historicalTrades',
|
104
|
+
params: kwargs.merge(symbol: symbol)
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Compressed/Aggregate Trades List
|
109
|
+
#
|
110
|
+
# Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
|
111
|
+
#
|
112
|
+
# GET /api/v3/aggTrades
|
113
|
+
#
|
114
|
+
# @param symbol [String] the symbol
|
115
|
+
# @param kwargs [Hash]
|
116
|
+
# @option kwargs [Integer] :startTime Timestamp in ms to get aggregate trades from INCLUSIVE.
|
117
|
+
# @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE.
|
118
|
+
# @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades.
|
119
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
120
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#compressed-aggregate-trades-list
|
121
|
+
def agg_trades(symbol:, **kwargs)
|
122
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
123
|
+
|
124
|
+
@session.public_request(
|
125
|
+
path: '/api/v3/aggTrades',
|
126
|
+
params: kwargs.merge(symbol: symbol)
|
127
|
+
)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Kline/Candlestick Data
|
131
|
+
#
|
132
|
+
# Kline/candlestick bars for a symbol.
|
133
|
+
# Klines are uniquely identified by their open time.
|
134
|
+
#
|
135
|
+
# GET /api/v3/klines
|
136
|
+
#
|
137
|
+
# @param symbol [String] the symbol
|
138
|
+
# @param interval [String] interval
|
139
|
+
# @param kwargs [Hash]
|
140
|
+
# @option kwargs [Integer] :startTime Timestamp in ms to get aggregate trades from INCLUSIVE.
|
141
|
+
# @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE.
|
142
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
143
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
144
|
+
def klines(symbol:, interval:, **kwargs)
|
145
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
146
|
+
Binance::Utils::Validation.require_param('interval', interval)
|
147
|
+
|
148
|
+
@session.public_request(
|
149
|
+
path: '/api/v3/klines',
|
150
|
+
params: kwargs.merge(
|
151
|
+
symbol: symbol,
|
152
|
+
interval: interval
|
153
|
+
)
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Current Average Price
|
158
|
+
#
|
159
|
+
# Current average price for a symbol.
|
160
|
+
#
|
161
|
+
# GET /api/v3/avgPrice
|
162
|
+
#
|
163
|
+
# @param symbol [String] the symbol
|
164
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#current-average-price
|
165
|
+
def avg_price(symbol:)
|
166
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
167
|
+
|
168
|
+
@session.public_request(
|
169
|
+
path: '/api/v3/avgPrice',
|
170
|
+
params: { symbol: symbol }
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
# 24hr Ticker Price Change Statistics
|
175
|
+
#
|
176
|
+
# 24 hour rolling window price change statistics. Careful when accessing this with no symbol.
|
177
|
+
#
|
178
|
+
# GET /api/v3/ticker/24hr
|
179
|
+
#
|
180
|
+
# @param symbol [String] the symbol
|
181
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics
|
182
|
+
def ticker_24hr(symbol: nil)
|
183
|
+
@session.public_request(
|
184
|
+
path: '/api/v3/ticker/24hr',
|
185
|
+
params: { symbol: symbol }
|
186
|
+
)
|
187
|
+
end
|
188
|
+
|
189
|
+
# Symbol Price Ticker
|
190
|
+
#
|
191
|
+
# Latest price for a symbol or symbols.
|
192
|
+
#
|
193
|
+
# GET /api/v3/ticker/price
|
194
|
+
#
|
195
|
+
# @param symbol [String] the symbol
|
196
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker
|
197
|
+
def ticker_price(symbol: nil)
|
198
|
+
@session.public_request(
|
199
|
+
path: '/api/v3/ticker/price',
|
200
|
+
params: { symbol: symbol }
|
201
|
+
)
|
202
|
+
end
|
203
|
+
|
204
|
+
# Symbol Order Book Ticker
|
205
|
+
#
|
206
|
+
# Best price/qty on the order book for a symbol or symbols.
|
207
|
+
#
|
208
|
+
# GET /api/v3/ticker/bookTicker
|
209
|
+
#
|
210
|
+
# @param symbol [String] the symbol
|
211
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker
|
212
|
+
def book_ticker(symbol: nil)
|
213
|
+
@session.public_request(
|
214
|
+
path: '/api/v3/ticker/bookTicker',
|
215
|
+
params: { symbol: symbol }
|
216
|
+
)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Binance
|
4
|
+
class Spot
|
5
|
+
# Mining endpoints
|
6
|
+
# The endpoints below allow to interact with Binance Pool.
|
7
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#mining-endpoints
|
8
|
+
module Mining
|
9
|
+
# Acquiring Algorithm (MARKET_DATA)
|
10
|
+
#
|
11
|
+
# GET /sapi/v1/mining/pub/algoList
|
12
|
+
#
|
13
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#acquiring-algorithm-market_data
|
14
|
+
def mining_algo_list
|
15
|
+
@session.limit_request(path: '/sapi/v1/mining/pub/algoList')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Acquiring CoinName (MARKET_DATA)
|
19
|
+
#
|
20
|
+
# GET /sapi/v1/mining/pub/coinList
|
21
|
+
#
|
22
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#acquiring-coinname-market_data
|
23
|
+
def mining_coin_list
|
24
|
+
@session.limit_request(path: '/sapi/v1/mining/pub/coinList')
|
25
|
+
end
|
26
|
+
|
27
|
+
# Request for Detail Miner List (USER_DATA)
|
28
|
+
#
|
29
|
+
# GET /sapi/v1/mining/worker/detail
|
30
|
+
#
|
31
|
+
# @param algo [String]
|
32
|
+
# @param userName [String]
|
33
|
+
# @param workerName [String]
|
34
|
+
# @param kwargs [Hash]
|
35
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
36
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#request-for-detail-miner-list-user_data
|
37
|
+
def mining_worker(algo:, userName:, workerName:, **kwargs)
|
38
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
39
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
40
|
+
Binance::Utils::Validation.require_param('workerName', workerName)
|
41
|
+
|
42
|
+
@session.sign_request(:get, '/sapi/v1/mining/worker/detail', params: kwargs.merge(
|
43
|
+
algo: algo,
|
44
|
+
userName: userName,
|
45
|
+
workerName: workerName
|
46
|
+
))
|
47
|
+
end
|
48
|
+
|
49
|
+
# Request for Miner List (USER_DATA)
|
50
|
+
#
|
51
|
+
# GET /sapi/v1/mining/worker/list
|
52
|
+
#
|
53
|
+
# @param algo [String]
|
54
|
+
# @param userName [String]
|
55
|
+
# @param kwargs [Hash]
|
56
|
+
# @option kwargs [String] :pageIndex
|
57
|
+
# @option kwargs [String] :sort
|
58
|
+
# @option kwargs [String] :sortColumn
|
59
|
+
# @option kwargs [String] :workerStatus
|
60
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
61
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#request-for-miner-list-user_data
|
62
|
+
def mining_worker_list(algo:, userName:, **kwargs)
|
63
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
64
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
65
|
+
|
66
|
+
@session.sign_request(:get, '/sapi/v1/mining/worker/list', params: kwargs.merge(
|
67
|
+
algo: algo,
|
68
|
+
userName: userName
|
69
|
+
))
|
70
|
+
end
|
71
|
+
|
72
|
+
# Earnings List(USER_DATA)
|
73
|
+
#
|
74
|
+
# GET /sapi/v1/mining/payment/list
|
75
|
+
#
|
76
|
+
# @param algo [String]
|
77
|
+
# @param userName [String]
|
78
|
+
# @param kwargs [Hash]
|
79
|
+
# @option kwargs [String] :coin
|
80
|
+
# @option kwargs [Integer] :startDate
|
81
|
+
# @option kwargs [Integer] :endDate
|
82
|
+
# @option kwargs [Integer] :pageIndex
|
83
|
+
# @option kwargs [Integer] :pageSize
|
84
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
85
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#earnings-list-user_data
|
86
|
+
def mining_revenue_list(algo:, userName:, **kwargs)
|
87
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
88
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
89
|
+
|
90
|
+
@session.sign_request(:get, '/sapi/v1/mining/payment/list', params: kwargs.merge(
|
91
|
+
algo: algo,
|
92
|
+
userName: userName
|
93
|
+
))
|
94
|
+
end
|
95
|
+
|
96
|
+
# Statistic List (USER_DATA)
|
97
|
+
#
|
98
|
+
# GET /sapi/v1/mining/statistics/user/status
|
99
|
+
#
|
100
|
+
# @param algo [String]
|
101
|
+
# @param userName [String]
|
102
|
+
# @param kwargs [Hash]
|
103
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
104
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#statistic-list-user_data
|
105
|
+
def mining_statistics_list(algo:, userName:, **kwargs)
|
106
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
107
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
108
|
+
|
109
|
+
@session.sign_request(:get, '/sapi/v1/mining/statistics/user/status', params: kwargs.merge(
|
110
|
+
algo: algo,
|
111
|
+
userName: userName
|
112
|
+
))
|
113
|
+
end
|
114
|
+
|
115
|
+
# Account List (USER_DATA)
|
116
|
+
#
|
117
|
+
# GET /sapi/v1/mining/statistics/user/list
|
118
|
+
#
|
119
|
+
# @param algo [String]
|
120
|
+
# @param userName [String]
|
121
|
+
# @param kwargs [Hash]
|
122
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
123
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#account-list-user_data
|
124
|
+
def mining_account_list(algo:, userName:, **kwargs)
|
125
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
126
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
127
|
+
|
128
|
+
@session.sign_request(:get, '/sapi/v1/mining/statistics/user/list', params: kwargs.merge(
|
129
|
+
algo: algo,
|
130
|
+
userName: userName
|
131
|
+
))
|
132
|
+
end
|
133
|
+
|
134
|
+
# Extra Bonus List (USER_DATA)
|
135
|
+
#
|
136
|
+
# GET /sapi/v1/mining/payment/other
|
137
|
+
#
|
138
|
+
# @param algo [String]
|
139
|
+
# @param userName [String]
|
140
|
+
# @param kwargs [Hash]
|
141
|
+
# @option kwargs [String] :coin
|
142
|
+
# @option kwargs [Integer] :startDate Search date, millisecond timestamp, while empty query all
|
143
|
+
# @option kwargs [Integer] :endDate Search date, millisecond timestamp, while empty query all
|
144
|
+
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
145
|
+
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
146
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
147
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#extra-bonus-list-user_data
|
148
|
+
def mining_extra_bonus(algo:, userName:, **kwargs)
|
149
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
150
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
151
|
+
|
152
|
+
@session.sign_request(:get, '/sapi/v1/mining/payment/other', params: kwargs.merge(
|
153
|
+
algo: algo,
|
154
|
+
userName: userName
|
155
|
+
))
|
156
|
+
end
|
157
|
+
|
158
|
+
# Hashrate Resale List (USER_DATA)
|
159
|
+
#
|
160
|
+
# GET /sapi/v1/mining/hash-transfer/config/details/list
|
161
|
+
#
|
162
|
+
# @param kwargs [Hash]
|
163
|
+
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
164
|
+
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
165
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
166
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-list-user_data
|
167
|
+
def mining_resale_list(**kwargs)
|
168
|
+
@session.sign_request(:get, '/sapi/v1/mining/hash-transfer/config/details/list', params: kwargs)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Hashrate Resale Detail (USER_DATA)
|
172
|
+
#
|
173
|
+
# GET /sapi/v1/mining/hash-transfer/profit/details
|
174
|
+
#
|
175
|
+
# @param configId [String] Mining ID
|
176
|
+
# @param userName [String] Mining Account
|
177
|
+
# @param kwargs [Hash]
|
178
|
+
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
179
|
+
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
180
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
181
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-detail-user_data
|
182
|
+
def mining_resale_detail(configId:, userName:, **kwargs)
|
183
|
+
Binance::Utils::Validation.require_param('configId', configId)
|
184
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
185
|
+
|
186
|
+
@session.sign_request(:get, '/sapi/v1/mining/hash-transfer/profit/details', params: kwargs.merge(
|
187
|
+
configId: configId,
|
188
|
+
userName: userName
|
189
|
+
))
|
190
|
+
end
|
191
|
+
|
192
|
+
# Hashrate Resale Request (USER_DATA)
|
193
|
+
#
|
194
|
+
# POST /sapi/v1/mining/hash-transfer/config
|
195
|
+
#
|
196
|
+
# @param userName [String] Mining Account
|
197
|
+
# @param algo [String] Transfer algorithm(sha256)
|
198
|
+
# @param startDate [Integer] Resale End Time (Millisecond timestamp)
|
199
|
+
# @param endDate [Integer] Number of pages, minimum 10, maximum 200
|
200
|
+
# @param toPoolUser [Integer] Mining Account
|
201
|
+
# @param hashRate [Integer] Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000)
|
202
|
+
# @param kwargs [Hash]
|
203
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
204
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-request-user_data
|
205
|
+
def mining_resale_request(userName:, algo:, startDate:, endDate:, toPoolUser:, hashRate:, **kwargs)
|
206
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
207
|
+
Binance::Utils::Validation.require_param('algo', algo)
|
208
|
+
Binance::Utils::Validation.require_param('startDate', startDate)
|
209
|
+
Binance::Utils::Validation.require_param('endDate', endDate)
|
210
|
+
Binance::Utils::Validation.require_param('toPoolUser', toPoolUser)
|
211
|
+
Binance::Utils::Validation.require_param('hashRate', hashRate)
|
212
|
+
|
213
|
+
@session.sign_request(:post, '/sapi/v1/mining/hash-transfer/config', params: kwargs.merge(
|
214
|
+
userName: userName,
|
215
|
+
algo: algo,
|
216
|
+
startDate: startDate,
|
217
|
+
endDate: endDate,
|
218
|
+
toPoolUser: toPoolUser,
|
219
|
+
hashRate: hashRate
|
220
|
+
))
|
221
|
+
end
|
222
|
+
|
223
|
+
# Cancel hashrate resale configuration(USER_DATA)
|
224
|
+
#
|
225
|
+
# POST /sapi/v1/mining/hash-transfer/config/cancel
|
226
|
+
#
|
227
|
+
# @param configId [String] Mining ID
|
228
|
+
# @param userName [String] Mining Account
|
229
|
+
# @param kwargs [Hash]
|
230
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
231
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#cancel-hashrate-resale-configuration-user_data
|
232
|
+
def mining_resale_cancel(configId:, userName:, **kwargs)
|
233
|
+
Binance::Utils::Validation.require_param('userName', userName)
|
234
|
+
Binance::Utils::Validation.require_param('configId', configId)
|
235
|
+
|
236
|
+
@session.sign_request(:post, '/sapi/v1/mining/hash-transfer/config/cancel', params: kwargs.merge(
|
237
|
+
configId: configId,
|
238
|
+
userName: userName
|
239
|
+
))
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|