honeymaker 0.9.4 → 0.9.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d0b1b709fa6d84da23f6601a96fae7fdb7acdae97da068f203b4985eb66e2cb
4
- data.tar.gz: '0909446c684a502085fbc146158460087b0f8a1080cf48b63a69d0aeecb1d586'
3
+ metadata.gz: 69e45233bef585a60e1dfc06d139aebbfefd2d5f39264a6890df53314dc17991
4
+ data.tar.gz: 223eb0d6e9dc4a0d0fbda81f21a6bb3db62b8e07ee5a1622b224330c50f25953
5
5
  SHA512:
6
- metadata.gz: c0c3b0b71aaf41d7c59f0216aca665a5c26c1221aef052831fb6d6e968825429911d21a905d15d4fe374afeae67a7a8d8c61879af65f010fceada859c13666a0
7
- data.tar.gz: 8cbd3b8504b53a5e244ef4613918010933b5ae4ce24852a72257102bf612f773df8edad59774087486dc319cfe02d4fd338538a56c35095880fbd34ec2710c47
6
+ metadata.gz: 02ea3cba844521f5710d79c80f9316c222ca167a70e08c690822e483738bba4f2b283719c7c209b3cb21ba81f4cd1d4b4b0dea09c12c38066f9e3ff27892c280
7
+ data.tar.gz: 43175c9aef0356ac764ceb5492ae574b7e0b6b96846027ddbc5a8e41e095d34477877aa903338721eb89f70eb77321d10e7ea677cb2fe96da20c909af0be03ee
@@ -21,9 +21,9 @@ module Honeymaker
21
21
  minimum_quote_size: product["minOrderInQuoteAsset"],
22
22
  maximum_base_size: nil,
23
23
  maximum_quote_size: nil,
24
- base_decimals: product["pricePrecision"] || 8,
25
- quote_decimals: product["pricePrecision"] || 8,
26
- price_decimals: product["pricePrecision"] || 8,
24
+ base_decimals: product["quantityDecimals"] || 8,
25
+ quote_decimals: product["notionalDecimals"] || 8,
26
+ price_decimals: count_decimals(product.fetch("tickSize")),
27
27
  available: true,
28
28
  trading_enabled: product["status"] == "trading"
29
29
  }
@@ -46,6 +46,17 @@ module Honeymaker
46
46
 
47
47
  private
48
48
 
49
+ # Bitvavo's tickSize is always a power of ten (e.g. "1.00", "0.0000100"),
50
+ # so the count of significant decimal places is the price precision.
51
+ def count_decimals(value)
52
+ # Strip trailing zeros AND a dangling dot so whole-number ticks like
53
+ # "1.00" -> "1" yield 0 (Ruby's "1.".split(".") would wrongly give ["1"]).
54
+ str = value.to_s.sub(/\.?0+$/, "")
55
+ return 0 unless str.include?(".")
56
+
57
+ str.split(".").last.length
58
+ end
59
+
49
60
  def connection
50
61
  @connection ||= build_connection(BASE_URL)
51
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Honeymaker
4
- VERSION = "0.9.4"
4
+ VERSION = "0.9.5"
5
5
  end
@@ -2,15 +2,29 @@
2
2
  {
3
3
  "market": "BTC-EUR",
4
4
  "status": "trading",
5
+ "base": "BTC",
6
+ "quote": "EUR",
5
7
  "minOrderInBaseAsset": "0.00001",
6
8
  "minOrderInQuoteAsset": "5",
7
- "pricePrecision": 5
9
+ "maxOrderInBaseAsset": "1000",
10
+ "maxOrderInQuoteAsset": "1000000",
11
+ "pricePrecision": null,
12
+ "tickSize": "1.00",
13
+ "quantityDecimals": 8,
14
+ "notionalDecimals": 2,
15
+ "orderTypes": ["market", "limit"]
8
16
  },
9
17
  {
10
18
  "market": "ETH-EUR",
11
19
  "status": "halted",
12
- "minOrderInBaseAsset": "0.001",
20
+ "base": "ETH",
21
+ "quote": "EUR",
22
+ "minOrderInBaseAsset": "0.0001",
13
23
  "minOrderInQuoteAsset": "5",
14
- "pricePrecision": 4
24
+ "pricePrecision": null,
25
+ "tickSize": "0.01",
26
+ "quantityDecimals": 6,
27
+ "notionalDecimals": 2,
28
+ "orderTypes": ["market", "limit"]
15
29
  }
16
30
  ]
@@ -25,9 +25,9 @@ class Honeymaker::Exchanges::BitvavoTest < Minitest::Test
25
25
  assert_equal "0.00001", ticker[:minimum_base_size]
26
26
  assert_equal "5", ticker[:minimum_quote_size]
27
27
  assert_nil ticker[:maximum_base_size]
28
- assert_equal 5, ticker[:base_decimals]
29
- assert_equal 5, ticker[:quote_decimals]
30
- assert_equal 5, ticker[:price_decimals]
28
+ assert_equal 8, ticker[:base_decimals]
29
+ assert_equal 2, ticker[:quote_decimals]
30
+ assert_equal 0, ticker[:price_decimals] # tickSize "1.00" -> whole-number prices
31
31
  assert ticker[:available]
32
32
  assert ticker[:trading_enabled]
33
33
  end
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.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deltabadger