bit_bay_trades

This commit is contained in:
Mini Robot 2017-12-09 11:29:23 +01:00
parent 898bf7d1eb
commit 67702f0547
1 changed files with 4 additions and 2 deletions

View File

@ -9,8 +9,8 @@ require 'json'
pause_interval = 3 pause_interval = 3
start_index = '-1' start_index = '-1'
currencies = {1 => "BTC", 4 => "LSK", 7 => "GAME"} currencies = {1 => "BTC", 4 => "LSK", 5 => "LTC", 7 => "GAME"}
currency_ids = [4,7] currency_ids = [5,4,7]
#currency = Currency.where(name: 'LSK').first #currency = Currency.where(name: 'LSK').first
while true while true
for currency_id in currency_ids 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 bbt_index = BitBayTrade.where('currency_id = ?', currency_id).order('cast(tid as unsigned) DESC').first
unless bbt_index.blank? unless bbt_index.blank?
start_index = bbt_index.tid start_index = bbt_index.tid
else
start_index = -1
end end
uri = "https://bitbay.net/API/Public/#{currencies[currency_id]}PLN/trades.json?since=#{start_index}" 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]}" puts "start at #{start_index} index for #{currencies[currency_id]}"