honeymaker 0.9.5 → 0.9.7
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 632a9bc63075c21713722ff28baece102104084e83a6b20675c7a0604c0a49e6
|
|
4
|
+
data.tar.gz: 4d2d63654b5fedd397945f72dd21eca95ca2762b1f658f73cf80b02cb1a7285b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a5f15c7d5163ef0013998fa7cccb81aa661018ff65561d7d55e606c7e70969e4172fca70ec3cfdc1529ad03c4637c69b6bff2eefaa9586627710aefe15710a1
|
|
7
|
+
data.tar.gz: 15b53a301be6c936a90d3ac96c505ebe9946448783d07fbfb4832d5e294e6ca2cd44bd726e86f7fa34eda0074b1febf24142c2206f0e743d3edda9609e091f26
|
|
@@ -238,8 +238,8 @@ module Honeymaker
|
|
|
238
238
|
def parse_order_status(status)
|
|
239
239
|
case status
|
|
240
240
|
when "init", "new" then :unknown
|
|
241
|
-
when "
|
|
242
|
-
when "
|
|
241
|
+
when "partially_filled", "live" then :open
|
|
242
|
+
when "filled" then :closed
|
|
243
243
|
when "cancelled" then :cancelled
|
|
244
244
|
else :unknown
|
|
245
245
|
end
|
|
@@ -9,10 +9,21 @@ module Honeymaker
|
|
|
9
9
|
"COPM" # has the same external_id (ecomi) as OMI
|
|
10
10
|
].freeze
|
|
11
11
|
|
|
12
|
+
# Patterns are unanchored (except regional_restriction) because the consumer may
|
|
13
|
+
# pass a sentence-joined error string. transient_nonce is matched first as it is
|
|
14
|
+
# the more specific/actionable case.
|
|
12
15
|
ERROR_PATTERNS = [
|
|
13
16
|
{
|
|
14
17
|
code: :regional_restriction,
|
|
15
18
|
pattern: /\AEAccount:Invalid permissions:(?<asset>\S+) trading restricted for (?<country>\w+)\.?\z/
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
code: :transient_nonce,
|
|
22
|
+
pattern: /EAPI:Invalid nonce/
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
code: :transient_unavailable,
|
|
26
|
+
pattern: /EGeneral:Internal error|EService:(?:Unavailable|Busy|Deadline elapsed)/
|
|
16
27
|
}
|
|
17
28
|
].freeze
|
|
18
29
|
|
data/lib/honeymaker/version.rb
CHANGED
|
@@ -51,7 +51,7 @@ class Honeymaker::Clients::BitgetTest < Minitest::Test
|
|
|
51
51
|
|
|
52
52
|
def test_get_order
|
|
53
53
|
stub_connection(:get, { "code" => "00000", "data" => [{
|
|
54
|
-
"orderId" => "123", "orderType" => "market", "side" => "buy", "status" => "
|
|
54
|
+
"orderId" => "123", "orderType" => "market", "side" => "buy", "status" => "filled",
|
|
55
55
|
"priceAvg" => "50000", "size" => "0.001", "baseVolume" => "0.001", "quoteVolume" => "50"
|
|
56
56
|
}] })
|
|
57
57
|
result = @client.get_order(order_id: "123")
|
|
@@ -117,8 +117,22 @@ class Honeymaker::Exchanges::KrakenTest < Minitest::Test
|
|
|
117
117
|
assert_equal({ code: :regional_restriction, asset: "XAUT", country: "DK" }, result)
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
def test_classify_error_invalid_nonce
|
|
121
|
+
assert_equal({ code: :transient_nonce }, @exchange.classify_error("EAPI:Invalid nonce"))
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_classify_error_internal_error_is_transient_unavailable
|
|
125
|
+
assert_equal({ code: :transient_unavailable }, @exchange.classify_error("EGeneral:Internal error"))
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_classify_error_service_codes_are_transient_unavailable
|
|
129
|
+
assert_equal({ code: :transient_unavailable }, @exchange.classify_error("EService:Unavailable"))
|
|
130
|
+
assert_equal({ code: :transient_unavailable }, @exchange.classify_error("EService:Busy"))
|
|
131
|
+
assert_equal({ code: :transient_unavailable }, @exchange.classify_error("EService:Deadline elapsed"))
|
|
132
|
+
end
|
|
133
|
+
|
|
120
134
|
def test_classify_error_returns_nil_for_unknown_message
|
|
121
|
-
assert_nil @exchange.classify_error("
|
|
135
|
+
assert_nil @exchange.classify_error("EOrder:Unknown order")
|
|
122
136
|
end
|
|
123
137
|
|
|
124
138
|
def test_classify_error_returns_nil_for_nil_message
|