Skip to content

Instantly share code, notes, and snippets.

@janx
Created May 23, 2014 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janx/68ca32d2ee87bff8114a to your computer and use it in GitHub Desktop.
Save janx/68ca32d2ee87bff8114a to your computer and use it in GitHub Desktop.
m = Member.find_by_email 'foo@peatio.dev'
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