Class: LimitMatches
- Inherits:
-
Object
- Object
- LimitMatches
- Defined in:
- lib/moneymarket/commands/limit_matches.rb
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/moneymarket/commands/limit_matches.rb', line 2 def perform matches.select do |match| next false if destination_limit <= 0 quote = calc_quote(match) if quote > destination_limit # IDEA: instead of lowering the match amount maybe this should be considered insolvency match.volume = calc_volume(match, destination_limit) destination_limit = 0 else destination_limit -= quote end match.volume > 0 end end |