bitex 0.0.5 → 0.0.6
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.
- data/lib/bitex/order.rb +9 -3
- data/lib/bitex/version.rb +1 -1
- data/spec/support/order_shared_examples.rb +1 -1
- metadata +1 -1
data/lib/bitex/order.rb
CHANGED
@@ -37,12 +37,18 @@ module Bitex
|
|
37
37
|
order = from_json(Api.private(:post, "/private#{base_path}", params))
|
38
38
|
retries = 0
|
39
39
|
while wait && order.status == :received
|
40
|
-
|
41
|
-
|
40
|
+
new_order = all.select{|o| o.id == order.id}.first
|
41
|
+
if new_order.nil?
|
42
|
+
raise StandardError.new(
|
43
|
+
"Order #{base_path} ##{order.id} not found in list")
|
44
|
+
end
|
45
|
+
order = new_order
|
42
46
|
retries += 1
|
43
47
|
if retries > 100
|
44
|
-
raise StandardError.new(
|
48
|
+
raise StandardError.new(
|
49
|
+
"Timed out waiting for #{base_path} ##{order.id}")
|
45
50
|
end
|
51
|
+
sleep 0.2
|
46
52
|
end
|
47
53
|
return order
|
48
54
|
end
|
data/lib/bitex/version.rb
CHANGED
@@ -39,7 +39,7 @@ shared_examples_for 'Order' do |api_path|
|
|
39
39
|
it 'places for btc and waits until processed by our matching engine' do
|
40
40
|
stub_private(:post, "/private/#{api_path}", "#{api_path}_create",
|
41
41
|
{amount: 100.50, price: 1000.00, specie: 1})
|
42
|
-
stub_private(:get, "/private/orders
|
42
|
+
stub_private(:get, "/private/orders", 'orders')
|
43
43
|
order = subject.class.create!(:btc, 100.50, 1000.00, true)
|
44
44
|
order.should be_a subject.class
|
45
45
|
order.status.should == :executing
|