yuliji
10/10/2014 - 6:58 AM

read from file and parse information.

read from file and parse information.

require 'json'

$last_id = 6961930

IO.foreach("trade.out") do |line|
    fields = line.split(' ')
    trade_json = fields[1]
    trade  = JSON.parse(trade_json)
    trade_id = trade['trade_id'].to_i
#    puts "trade_id #{trade_id}"
#    puts "last_trade_id #{$last_id}"
    if trade_id != $last_id + 1
      puts $last_id + 1
    end
    $last_id = trade_id
end