bitex_bot 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,10 +81,11 @@ module BitexBot
81
81
  # Buys on bitex represent open positions, we mirror them locally
82
82
  # so that we can plan on how to close them.
83
83
  def self.sync_open_positions
84
- threshold = open_position_class.order('created_at DESC').first.try(:created_at)
84
+ threshold = open_position_class
85
+ .order('created_at DESC').first.try(:created_at)
85
86
  Bitex::Transaction.all.collect do |transaction|
86
87
  next unless transaction.is_a?(transaction_class)
87
- next if threshold && transaction.created_at < threshold
88
+ next if threshold && transaction.created_at < (threshold - 15.minutes)
88
89
  next if open_position_class.find_by_transaction_id(transaction.id)
89
90
  next if transaction.specie != :btc
90
91
  next unless flow = find_by_order_id(transaction_order_id(transaction))
@@ -65,13 +65,13 @@ module BitexBot
65
65
  end
66
66
 
67
67
  def trade!
68
+ sync_opening_flows if active_opening_flows?
68
69
  finalise_some_opening_flows
69
70
  if(!active_opening_flows? && !open_positions? &&
70
71
  !active_closing_flows? && self.class.graceful_shutdown)
71
72
  self.class.logger.info("Shutdown completed")
72
73
  exit
73
74
  end
74
- sync_opening_flows if active_opening_flows?
75
75
  start_closing_flows if open_positions?
76
76
  sync_closing_flows if active_closing_flows?
77
77
  start_opening_flows_if_needed
@@ -1,3 +1,3 @@
1
1
  module BitexBot
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
4
+ version: 0.2.2
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: 2014-11-19 00:00:00.000000000 Z
13
+ date: 2014-11-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: settingslogic