diff --git a/app/scripts/get_bit_bay_trades.rb b/app/scripts/get_bit_bay_trades.rb index 790b28f..f7f6f92 100644 --- a/app/scripts/get_bit_bay_trades.rb +++ b/app/scripts/get_bit_bay_trades.rb @@ -9,8 +9,8 @@ require 'json' pause_interval = 3 start_index = '-1' -currencies = {1 => "BTC", 4 => "LSK", 7 => "GAME"} -currency_ids = [4,7] +currencies = {1 => "BTC", 4 => "LSK", 5 => "LTC", 7 => "GAME"} +currency_ids = [5,4,7] #currency = Currency.where(name: 'LSK').first while true for currency_id in currency_ids @@ -18,6 +18,8 @@ for currency_id in currency_ids bbt_index = BitBayTrade.where('currency_id = ?', currency_id).order('cast(tid as unsigned) DESC').first unless bbt_index.blank? start_index = bbt_index.tid + else + start_index = -1 end uri = "https://bitbay.net/API/Public/#{currencies[currency_id]}PLN/trades.json?since=#{start_index}" puts "start at #{start_index} index for #{currencies[currency_id]}"