honeymaker 0.3.0 → 0.4.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/lib/honeymaker/clients/binance.rb +109 -0
- data/lib/honeymaker/clients/bybit.rb +7 -0
- data/lib/honeymaker/clients/kucoin.rb +8 -0
- data/lib/honeymaker/version.rb +1 -1
- data/test/honeymaker/clients/binance_client_test.rb +43 -0
- data/test/honeymaker/clients/bybit_client_test.rb +6 -0
- data/test/honeymaker/clients/kucoin_client_test.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b69b5d2b1995f1def30eaa09cb003cef99a8763ea383c9f71ea8aa0d05e9ecac
|
|
4
|
+
data.tar.gz: 54fb293018729bcfd12c26b596da9fae540bfe6574d9de40cae8b6b0407809bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1903ef50d96bd65cc630b587a2e4d9f8e7e967bd82768fd2c5d883dd06d8e265364fb853949e0f5308a4ba0dfc65980c91c96d9c89f5d1632966dbf756d9d35
|
|
7
|
+
data.tar.gz: cc74f411106c324c6a12a9b93f02415cc1f14d65d38ee4518b313e487804a87c50c386fb7d9fea0716f21018d46fc42ce82ff9c3496552723c1dfb774318679b
|
|
@@ -202,6 +202,115 @@ module Honeymaker
|
|
|
202
202
|
end
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
+
def convert_trade_flow(start_time:, end_time:, limit: 1000, recv_window: 5000)
|
|
206
|
+
with_rescue do
|
|
207
|
+
response = connection.get do |req|
|
|
208
|
+
req.url "/sapi/v1/convert/tradeFlow"
|
|
209
|
+
req.headers = headers
|
|
210
|
+
req.params = {
|
|
211
|
+
startTime: start_time, endTime: end_time,
|
|
212
|
+
limit: limit, recvWindow: recv_window, timestamp: timestamp_ms
|
|
213
|
+
}.compact
|
|
214
|
+
req.params[:signature] = sign_params(req.params)
|
|
215
|
+
end
|
|
216
|
+
response.body
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def fiat_payments(transaction_type:, begin_time: nil, end_time: nil, page: nil, rows: nil, recv_window: 5000)
|
|
221
|
+
with_rescue do
|
|
222
|
+
response = connection.get do |req|
|
|
223
|
+
req.url "/sapi/v1/fiat/payments"
|
|
224
|
+
req.headers = headers
|
|
225
|
+
req.params = {
|
|
226
|
+
transactionType: transaction_type,
|
|
227
|
+
beginTime: begin_time, endTime: end_time,
|
|
228
|
+
page: page, rows: rows,
|
|
229
|
+
recvWindow: recv_window, timestamp: timestamp_ms
|
|
230
|
+
}.compact
|
|
231
|
+
req.params[:signature] = sign_params(req.params)
|
|
232
|
+
end
|
|
233
|
+
response.body
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def fiat_orders(transaction_type:, begin_time: nil, end_time: nil, page: nil, rows: nil, recv_window: 5000)
|
|
238
|
+
with_rescue do
|
|
239
|
+
response = connection.get do |req|
|
|
240
|
+
req.url "/sapi/v1/fiat/orders"
|
|
241
|
+
req.headers = headers
|
|
242
|
+
req.params = {
|
|
243
|
+
transactionType: transaction_type,
|
|
244
|
+
beginTime: begin_time, endTime: end_time,
|
|
245
|
+
page: page, rows: rows,
|
|
246
|
+
recvWindow: recv_window, timestamp: timestamp_ms
|
|
247
|
+
}.compact
|
|
248
|
+
req.params[:signature] = sign_params(req.params)
|
|
249
|
+
end
|
|
250
|
+
response.body
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def dust_log(start_time: nil, end_time: nil, recv_window: 5000)
|
|
255
|
+
with_rescue do
|
|
256
|
+
response = connection.get do |req|
|
|
257
|
+
req.url "/sapi/v1/asset/dribblet"
|
|
258
|
+
req.headers = headers
|
|
259
|
+
req.params = {
|
|
260
|
+
startTime: start_time, endTime: end_time,
|
|
261
|
+
recvWindow: recv_window, timestamp: timestamp_ms
|
|
262
|
+
}.compact
|
|
263
|
+
req.params[:signature] = sign_params(req.params)
|
|
264
|
+
end
|
|
265
|
+
response.body
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def asset_dividend(asset: nil, start_time: nil, end_time: nil, limit: 500, recv_window: 5000)
|
|
270
|
+
with_rescue do
|
|
271
|
+
response = connection.get do |req|
|
|
272
|
+
req.url "/sapi/v1/asset/assetDividend"
|
|
273
|
+
req.headers = headers
|
|
274
|
+
req.params = {
|
|
275
|
+
asset: asset, startTime: start_time, endTime: end_time,
|
|
276
|
+
limit: limit, recvWindow: recv_window, timestamp: timestamp_ms
|
|
277
|
+
}.compact
|
|
278
|
+
req.params[:signature] = sign_params(req.params)
|
|
279
|
+
end
|
|
280
|
+
response.body
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def simple_earn_flexible_rewards(asset: nil, start_time: nil, end_time: nil, current: nil, size: nil)
|
|
285
|
+
with_rescue do
|
|
286
|
+
response = connection.get do |req|
|
|
287
|
+
req.url "/sapi/v1/simple-earn/flexible/history/rewardsRecord"
|
|
288
|
+
req.headers = headers
|
|
289
|
+
req.params = {
|
|
290
|
+
asset: asset, startTime: start_time, endTime: end_time,
|
|
291
|
+
current: current, size: size, timestamp: timestamp_ms
|
|
292
|
+
}.compact
|
|
293
|
+
req.params[:signature] = sign_params(req.params)
|
|
294
|
+
end
|
|
295
|
+
response.body
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def simple_earn_locked_rewards(asset: nil, start_time: nil, end_time: nil, current: nil, size: nil)
|
|
300
|
+
with_rescue do
|
|
301
|
+
response = connection.get do |req|
|
|
302
|
+
req.url "/sapi/v1/simple-earn/locked/history/rewardsRecord"
|
|
303
|
+
req.headers = headers
|
|
304
|
+
req.params = {
|
|
305
|
+
asset: asset, startTime: start_time, endTime: end_time,
|
|
306
|
+
current: current, size: size, timestamp: timestamp_ms
|
|
307
|
+
}.compact
|
|
308
|
+
req.params[:signature] = sign_params(req.params)
|
|
309
|
+
end
|
|
310
|
+
response.body
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
205
314
|
def get_all_coins_information(recv_window: 5000)
|
|
206
315
|
with_rescue do
|
|
207
316
|
response = connection.get do |req|
|
|
@@ -61,6 +61,13 @@ module Honeymaker
|
|
|
61
61
|
})
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
def transaction_log(account_type: nil, category: nil, currency: nil, type: nil, start_time: nil, end_time: nil, limit: nil, cursor: nil)
|
|
65
|
+
get_authenticated("/v5/account/transaction-log", {
|
|
66
|
+
accountType: account_type, category: category, currency: currency, type: type,
|
|
67
|
+
startTime: start_time, endTime: end_time, limit: limit, cursor: cursor
|
|
68
|
+
})
|
|
69
|
+
end
|
|
70
|
+
|
|
64
71
|
def execution_list(category:, symbol: nil, order_id: nil, start_time: nil, end_time: nil, limit: nil, cursor: nil)
|
|
65
72
|
get_authenticated("/v5/execution/list", {
|
|
66
73
|
category: category, symbol: symbol, orderId: order_id,
|
|
@@ -68,6 +68,14 @@ module Honeymaker
|
|
|
68
68
|
})
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def get_historical_orders(symbol: nil, side: nil, start_at: nil, end_at: nil, current_page: nil, page_size: nil)
|
|
72
|
+
get_signed("/api/v1/hist-orders", {
|
|
73
|
+
symbol: symbol, side: side,
|
|
74
|
+
startAt: start_at, endAt: end_at,
|
|
75
|
+
currentPage: current_page, pageSize: page_size
|
|
76
|
+
})
|
|
77
|
+
end
|
|
78
|
+
|
|
71
79
|
def get_deposits(currency: nil, start_at: nil, end_at: nil, status: nil, current_page: nil, page_size: nil)
|
|
72
80
|
get_signed("/api/v1/deposits", {
|
|
73
81
|
currency: currency, startAt: start_at, endAt: end_at,
|
data/lib/honeymaker/version.rb
CHANGED
|
@@ -65,6 +65,49 @@ class Honeymaker::Clients::BinanceTest < Minitest::Test
|
|
|
65
65
|
assert_equal "ETH", result.data.first["coin"]
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
def test_convert_trade_flow
|
|
69
|
+
stub_connection(:get, { "list" => [{ "quoteId" => "q1", "fromAsset" => "BTC", "toAsset" => "USDT" }] })
|
|
70
|
+
result = @client.convert_trade_flow(start_time: 1710936000000, end_time: 1711022400000)
|
|
71
|
+
assert result.success?
|
|
72
|
+
assert_equal "q1", result.data["list"].first["quoteId"]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def test_fiat_payments
|
|
76
|
+
stub_connection(:get, { "data" => [{ "orderNo" => "f1", "cryptoCurrency" => "BTC" }] })
|
|
77
|
+
result = @client.fiat_payments(transaction_type: 0)
|
|
78
|
+
assert result.success?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_fiat_orders
|
|
82
|
+
stub_connection(:get, { "data" => [{ "orderNo" => "fo1", "fiatCurrency" => "USD" }] })
|
|
83
|
+
result = @client.fiat_orders(transaction_type: 0)
|
|
84
|
+
assert result.success?
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_dust_log
|
|
88
|
+
stub_connection(:get, { "total" => 1, "userAssetDribblets" => [{ "totalTransferedAmount" => "0.001" }] })
|
|
89
|
+
result = @client.dust_log
|
|
90
|
+
assert result.success?
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_asset_dividend
|
|
94
|
+
stub_connection(:get, { "rows" => [{ "asset" => "BNB", "amount" => "0.1" }], "total" => 1 })
|
|
95
|
+
result = @client.asset_dividend
|
|
96
|
+
assert result.success?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_simple_earn_flexible_rewards
|
|
100
|
+
stub_connection(:get, { "rows" => [{ "asset" => "USDT", "rewards" => "0.5" }], "total" => 1 })
|
|
101
|
+
result = @client.simple_earn_flexible_rewards
|
|
102
|
+
assert result.success?
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def test_simple_earn_locked_rewards
|
|
106
|
+
stub_connection(:get, { "rows" => [{ "asset" => "ETH", "rewards" => "0.01" }], "total" => 1 })
|
|
107
|
+
result = @client.simple_earn_locked_rewards
|
|
108
|
+
assert result.success?
|
|
109
|
+
end
|
|
110
|
+
|
|
68
111
|
def test_handles_api_error
|
|
69
112
|
connection = stub
|
|
70
113
|
connection.stubs(:get).raises(Faraday::ServerError.new("500", { status: 500, body: "Server Error" }))
|
|
@@ -60,6 +60,12 @@ class Honeymaker::Clients::BybitTest < Minitest::Test
|
|
|
60
60
|
assert result.success?
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
def test_transaction_log
|
|
64
|
+
stub_connection(:get, { "result" => { "list" => [{ "transactionTime" => "1710936000000" }] } })
|
|
65
|
+
result = @client.transaction_log
|
|
66
|
+
assert result.success?
|
|
67
|
+
end
|
|
68
|
+
|
|
63
69
|
def test_execution_list
|
|
64
70
|
stub_connection(:get, { "result" => { "list" => [{ "execId" => "e1" }] } })
|
|
65
71
|
result = @client.execution_list(category: "spot")
|
|
@@ -59,6 +59,12 @@ class Honeymaker::Clients::KucoinTest < Minitest::Test
|
|
|
59
59
|
assert result.success?
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
def test_get_historical_orders
|
|
63
|
+
stub_connection(:get, { "data" => { "items" => [{ "id" => "ho1", "symbol" => "BTC-USDT" }] } })
|
|
64
|
+
result = @client.get_historical_orders
|
|
65
|
+
assert result.success?
|
|
66
|
+
end
|
|
67
|
+
|
|
62
68
|
def test_get_fills
|
|
63
69
|
stub_connection(:get, { "data" => { "items" => [{ "tradeId" => "t1" }] } })
|
|
64
70
|
result = @client.get_fills(symbol: "BTC-USDT")
|