We must show the value of the daily balance in USD. We can use the https://api.bitfinex.com/v2/candles/trade:1D:tBTCUSD/hist.
But first fixed an error running the unit test on travis with commit Set timezone to UTC-1 for travis
As the API from candle only allows us to retrieve the quotes for the last month, we will add the info, only for the dates we are able to get a value. We willl use the UTC timezone for this, to avoid problems converting to/from MEZ.
Found finally the solution on howto retrieve daily traces. URl is https://api.bitfinex.com/v2/candles/trade:1D:tBTCUSD/hist?start:1452380400000?end:1489363200000
But this does not work as expected, eg. using pry I see
url = "https://api.bitfinex.com/v2/candles/trade:TimeFrame:t#{from}USD/hist?start:#{ms}?end:#{ms_next_date}" => "https://api.bitfinex.com/v2/candles/trade:TimeFrame:tBFXUSD/hist?start:1452380400000?end:1452639600000" items = eval(open(url){|f|f.read}) ; [68] pry(#<RAPFLAG::History>)> Time.at items.collect{|x|x.first}.max/1000 => 2017-03-13 01:00:00 +0100 [69] pry(#<RAPFLAG::History>)> Time.at items.collect{|x|x.first}.min/1000 => 2016-11-14 01:00:00 +0100 [70] pry(#<RAPFLAG::History>)> url => "https://api.bitfinex.com/v2/candles/trade:1D:tBFXUSD/hist?start:1452380400000?end:1452639600000" [71] pry(#<RAPFLAG::History>)> Time.at ms/1000 => 2016-01-10 00:00:00 +0100 [72] pry(#<RAPFLAG::History>)> Time.at ms_next_date/1000 => 2016-01-13 00:00:00 +0100
Pushed commit Add balance in USD
Running bin/rapflag fails sometimes, because the API is rate limited. In this case it returns {:error=>"ERR_RATE_LIMIT"}
. Found the culprit. My caching of the exchange rates was wrong and did not work for BFX.
Adding a new column rate. Pushed commit Add new column rate. Fix caching of exchanges rates
Still don't know, why the login does not change the state as it should. How can I create a unit test for it in SBSM?
Looking on howto make the unit tests for davaz.com work via rake (on travis.ci). Pushed commit Fix running unit tests. Now the unit tests run, but I have 17 failures, probably all because of the login problem.
Did not find out why the unit test start locally under gentoo, but not on travis-CI.