Last active
October 3, 2019 13:43
-
-
Save alinetskyi/741eae128210e9d16aa2d879a15498ab to your computer and use it in GitHub Desktop.
Delete orders that below min_price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Market.enabled.each do |m| | |
min_price = m.min_price | |
data = Order.where(market_id: m.id, state: 'wait').where('price < ?', m.min_price) | |
m.update!(min_price: 0) | |
data.each do |o| | |
Order.cancel(o.id) | |
end | |
m.update!(min_price: min_price) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Market.enabled.each do |m| | |
min_price = m.min_price | |
data = Order.where(market_id: m.id, state: 'wait').where('price < ?', m.min_price) | |
data.each do |o| | |
puts "Order that doesn't pass the validation: #{o}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment