bitex_bot 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -79,7 +79,13 @@ module BitexBot
|
|
79
79
|
save!
|
80
80
|
end
|
81
81
|
elsif latest_close.created_at < self.class.close_time_to_live.seconds.ago
|
82
|
-
Robot.with_cooldown
|
82
|
+
Robot.with_cooldown do
|
83
|
+
begin
|
84
|
+
order.cancel!
|
85
|
+
rescue StandardError => e
|
86
|
+
nil # just pass, we'll keep on trying until it's not in orders anymore.
|
87
|
+
end
|
88
|
+
end
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
@@ -46,6 +46,23 @@ class ItbitApiWrapper
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.place_order(type, price, quantity)
|
49
|
-
|
49
|
+
begin
|
50
|
+
return Itbit::Order.create!(type, :xbtusd, quantity, price, wait: true)
|
51
|
+
rescue RestClient::RequestTimeout => e
|
52
|
+
# On timeout errors, we still look for the latest active closing order
|
53
|
+
# that may be available. We have a magic threshold of 5 minutes
|
54
|
+
# and also use the price to recognize an order as the current one.
|
55
|
+
# TODO: Maybe we can identify the order using metadata instead of price.
|
56
|
+
BitexBot::Robot.logger.error("Captured Timeout on itbit")
|
57
|
+
latest = Itbit::Order.all.select do |x|
|
58
|
+
x.price == price && (x.created_time - Time.now.to_i).abs < 500
|
59
|
+
end.first
|
60
|
+
if latest
|
61
|
+
return latest
|
62
|
+
else
|
63
|
+
BitexBot::Robot.logger.error("Could not find my order")
|
64
|
+
raise e
|
65
|
+
end
|
66
|
+
end
|
50
67
|
end
|
51
68
|
end
|
data/lib/bitex_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitex_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: settingslogic
|