honeymaker 0.4.0 → 0.5.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +145 -6
  3. data/lib/honeymaker/client.rb +14 -0
  4. data/lib/honeymaker/clients/binance.rb +264 -2
  5. data/lib/honeymaker/clients/binance_us.rb +33 -0
  6. data/lib/honeymaker/clients/bingx.rb +100 -4
  7. data/lib/honeymaker/clients/bitget.rb +163 -2
  8. data/lib/honeymaker/clients/bitmart.rb +108 -2
  9. data/lib/honeymaker/clients/bitrue.rb +90 -2
  10. data/lib/honeymaker/clients/bitvavo.rb +80 -4
  11. data/lib/honeymaker/clients/bybit.rb +120 -2
  12. data/lib/honeymaker/clients/coinbase.rb +108 -2
  13. data/lib/honeymaker/clients/gemini.rb +85 -4
  14. data/lib/honeymaker/clients/hyperliquid.rb +69 -1
  15. data/lib/honeymaker/clients/kraken.rb +112 -2
  16. data/lib/honeymaker/clients/kraken_futures.rb +78 -0
  17. data/lib/honeymaker/clients/kucoin.rb +120 -2
  18. data/lib/honeymaker/clients/mexc.rb +85 -2
  19. data/lib/honeymaker/version.rb +1 -1
  20. data/lib/honeymaker.rb +3 -1
  21. data/test/honeymaker/clients/binance_client_test.rb +9 -2
  22. data/test/honeymaker/clients/bitget_client_test.rb +9 -3
  23. data/test/honeymaker/clients/bitmart_client_test.rb +7 -2
  24. data/test/honeymaker/clients/bitvavo_client_test.rb +2 -2
  25. data/test/honeymaker/clients/bybit_client_test.rb +7 -3
  26. data/test/honeymaker/clients/coinbase_client_test.rb +10 -3
  27. data/test/honeymaker/clients/honeymaker_client_registry_test.rb +1 -1
  28. data/test/honeymaker/clients/kraken_client_test.rb +2 -1
  29. data/test/honeymaker/clients/kraken_futures_client_test.rb +54 -0
  30. data/test/honeymaker/clients/kucoin_client_test.rb +8 -2
  31. data/test/honeymaker/clients/mexc_client_test.rb +6 -1
  32. metadata +17 -1
@@ -17,19 +17,26 @@ class Honeymaker::Clients::CoinbaseTest < Minitest::Test
17
17
  end
18
18
 
19
19
  def test_get_order
20
- stub_connection(:get, { "order" => { "order_id" => "abc", "status" => "FILLED" } })
20
+ stub_connection(:get, { "order" => {
21
+ "order_id" => "abc", "status" => "FILLED", "order_type" => "MARKET", "side" => "BUY",
22
+ "average_filled_price" => "50000", "filled_size" => "0.001",
23
+ "total_value_after_fees" => "50", "outstanding_hold_amount" => "0",
24
+ "order_configuration" => { "market_market_ioc" => { "quote_size" => "50" } }
25
+ } })
21
26
  result = @client.get_order(order_id: "abc")
22
27
  assert result.success?
23
- assert_equal "abc", result.data["order"]["order_id"]
28
+ assert_equal "abc", result.data[:order_id]
29
+ assert_equal :closed, result.data[:status]
24
30
  end
25
31
 
26
32
  def test_create_order
27
- stub_connection(:post, { "success" => true, "order_id" => "xyz" })
33
+ stub_connection(:post, { "success" => true, "success_response" => { "order_id" => "xyz" } })
28
34
  result = @client.create_order(
29
35
  client_order_id: "c1", product_id: "BTC-USD",
30
36
  side: "BUY", order_configuration: { market_market_ioc: { quote_size: "100" } }
31
37
  )
32
38
  assert result.success?
39
+ assert_equal "xyz", result.data[:order_id]
33
40
  end
34
41
 
35
42
  def test_cancel_orders
@@ -18,7 +18,7 @@ class HoneymakerClientRegistryTest < Minitest::Test
18
18
  end
19
19
 
20
20
  def test_all_clients_registered
21
- assert_equal 14, Honeymaker::CLIENTS.size
21
+ assert_equal 15, Honeymaker::CLIENTS.size
22
22
  end
23
23
 
24
24
  def test_client_passes_credentials
@@ -31,7 +31,8 @@ class Honeymaker::Clients::KrakenTest < Minitest::Test
31
31
  stub_connection(:post, { "error" => [], "result" => { "txid" => ["ORDER-123"] } })
32
32
  result = @client.add_order(ordertype: "market", type: "buy", volume: "0.001", pair: "XBTUSDT")
33
33
  assert result.success?
34
- assert_equal ["ORDER-123"], result.data["result"]["txid"]
34
+ assert_equal "ORDER-123", result.data[:order_id]
35
+ assert_equal ["ORDER-123"], result.data[:raw]["result"]["txid"]
35
36
  end
36
37
 
37
38
  def test_cancel_order
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class Honeymaker::Clients::KrakenFuturesTest < Minitest::Test
6
+ def setup
7
+ @client = Honeymaker::Clients::KrakenFutures.new(
8
+ api_key: "test_key",
9
+ api_secret: Base64.strict_encode64("test_secret_key_1234567890123456")
10
+ )
11
+ end
12
+
13
+ def test_url
14
+ assert_equal "https://futures.kraken.com", Honeymaker::Clients::KrakenFutures::URL
15
+ end
16
+
17
+ def test_get_accounts
18
+ stub_connection(:get, { "result" => "success", "accounts" => {} })
19
+ result = @client.get_accounts
20
+ assert result.success?
21
+ end
22
+
23
+ def test_get_fills
24
+ stub_connection(:get, { "result" => "success", "fills" => [] })
25
+ result = @client.get_fills
26
+ assert result.success?
27
+ end
28
+
29
+ def test_get_open_positions
30
+ stub_connection(:get, { "result" => "success", "openPositions" => [] })
31
+ result = @client.get_open_positions
32
+ assert result.success?
33
+ end
34
+
35
+ def test_historical_funding_rates
36
+ stub_connection(:get, { "result" => "success", "rates" => [] })
37
+ result = @client.historical_funding_rates(symbol: "PF_XBTUSD")
38
+ assert result.success?
39
+ end
40
+
41
+ def test_client_registered
42
+ client = Honeymaker.client("kraken_futures", api_key: "k", api_secret: Base64.strict_encode64("s" * 32))
43
+ assert_instance_of Honeymaker::Clients::KrakenFutures, client
44
+ end
45
+
46
+ private
47
+
48
+ def stub_connection(method, body)
49
+ response = stub(body: body)
50
+ connection = stub
51
+ connection.stubs(method).returns(response)
52
+ @client.instance_variable_set(:@connection, connection)
53
+ end
54
+ end
@@ -36,15 +36,21 @@ class Honeymaker::Clients::KucoinTest < Minitest::Test
36
36
  end
37
37
 
38
38
  def test_place_order
39
- stub_connection(:post, { "data" => { "orderId" => "123" } })
39
+ stub_connection(:post, { "code" => "200000", "data" => { "orderId" => "123" } })
40
40
  result = @client.place_order(client_oid: "c1", side: "buy", symbol: "BTC-USDT", type: "market", funds: "100")
41
41
  assert result.success?
42
+ assert_equal "123", result.data[:order_id]
42
43
  end
43
44
 
44
45
  def test_get_order
45
- stub_connection(:get, { "data" => { "id" => "123", "isActive" => false } })
46
+ stub_connection(:get, { "code" => "200000", "data" => {
47
+ "id" => "123", "symbol" => "BTC-USDT", "type" => "market", "side" => "buy",
48
+ "isActive" => false, "cancelExist" => false, "dealSize" => "0.001",
49
+ "dealFunds" => "50", "size" => "0.001", "price" => "50000"
50
+ } })
46
51
  result = @client.get_order(order_id: "123")
47
52
  assert result.success?
53
+ assert_equal :closed, result.data[:status]
48
54
  end
49
55
 
50
56
  def test_cancel_order
@@ -36,9 +36,14 @@ class Honeymaker::Clients::MexcTest < Minitest::Test
36
36
  end
37
37
 
38
38
  def test_query_order
39
- stub_connection(:get, { "orderId" => "123", "status" => "FILLED" })
39
+ stub_connection(:get, {
40
+ "orderId" => "123", "symbol" => "BTCUSDT", "status" => "FILLED", "type" => "MARKET",
41
+ "side" => "BUY", "origQty" => "0.001", "executedQty" => "0.001",
42
+ "cummulativeQuoteQty" => "50", "price" => "50000"
43
+ })
40
44
  result = @client.query_order(symbol: "BTCUSDT", order_id: "123")
41
45
  assert result.success?
46
+ assert_equal :closed, result.data[:status]
42
47
  end
43
48
 
44
49
  def test_cancel_order
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeymaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deltabadger
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '2.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: bigdecimal
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
68
82
  description: Unified interface for cryptocurrency exchange APIs — market data, trading,
69
83
  balances, and orders. Supports Binance, Kraken, Coinbase, Bybit, KuCoin, Bitget,
70
84
  MEXC, and more.
@@ -92,6 +106,7 @@ files:
92
106
  - lib/honeymaker/clients/gemini.rb
93
107
  - lib/honeymaker/clients/hyperliquid.rb
94
108
  - lib/honeymaker/clients/kraken.rb
109
+ - lib/honeymaker/clients/kraken_futures.rb
95
110
  - lib/honeymaker/clients/kucoin.rb
96
111
  - lib/honeymaker/clients/mexc.rb
97
112
  - lib/honeymaker/exchange.rb
@@ -141,6 +156,7 @@ files:
141
156
  - test/honeymaker/clients/honeymaker_client_registry_test.rb
142
157
  - test/honeymaker/clients/hyperliquid_client_test.rb
143
158
  - test/honeymaker/clients/kraken_client_test.rb
159
+ - test/honeymaker/clients/kraken_futures_client_test.rb
144
160
  - test/honeymaker/clients/kucoin_client_test.rb
145
161
  - test/honeymaker/clients/mexc_client_test.rb
146
162
  - test/honeymaker/clients/validation_test.rb