Created
May 23, 2014 03:34
-
-
Save janx/68ca32d2ee87bff8114a to your computer and use it in GitHub Desktop.
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
m = Member.find_by_email '[email protected]' | |
market = Market.find :btccny | |
ask = OrderAsk.new( | |
source: 'debug', | |
state: Order::WAIT, | |
member_id: m.id, | |
ask: market.target_unit, | |
bid: market.price_unit, | |
currency: market.id, | |
price: 4000, | |
volume: 100, | |
origin_volume: 100 | |
) | |
Ordering.new(ask).submit | |
bid = OrderBid.new( | |
source: 'debug', | |
state: Order::WAIT, | |
member_id: m.id, | |
ask: market.target_unit, | |
bid: market.price_unit, | |
currency: market.id, | |
price: 4000, | |
volume: 100, | |
origin_volume: 100 | |
) | |
Ordering.new(bid).submit | |
puts "Ready ..." | |
a = m.get_account(:cny) | |
puts "balance: #{a.balance.to_s('F')}" | |
puts "locked: #{a.locked.to_s('F')}" | |
gets | |
puts "Started." | |
100.times do | |
Matching::Executor.new( | |
market_id: :btccny, | |
ask_id: ask.id, | |
bid_id: bid.id, | |
strike_price: 4000, | |
volume: 1 | |
).execute! | |
a = m.get_account(:cny) | |
puts "balance: #{a.balance.to_s('F')}" | |
puts "locked: #{a.locked.to_s('F')}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment