Open provinzio opened 3 years ago
ccxt
for (initially only binance) price gathering. ccxt
supports quite a lot of different exchanges. We might be able to realize this issue through #16 using the library to gather all of our prices from different exchanges._get_price_kraken
fails for certain pairs at certain times, see warning below. Additionally, XDGEUR
does not always fail, requesting the ticker before and after this timestamp succeeded.
2021-03-06 13:37:41,195 price_data DEBUG Querying trades for XDGEUR at 2018-01-28 XX:XX:XX+00:00 (offset=120m): Calling https://api.kraken.com/0/public/Trades?pair=XDGEUR&since=15171XXXXX000000000
2021-03-06 13:37:41,543 price_data WARNING Querying trades for XDGEUR at 2018-01-28 XX:XX:XX+00:00: Failed to find matching exchange rate. Please create an Issue or PR.
The API call, however, does produce a valid response with no error, so the actual issue which is triggering the warning, seems to be the processing of the API response.
Further, the pair XDGEUR
is often also referred at kraken with XXDGZEUR
.
@shredEngineer I tried some more runs with my exports and had the fail regarding matching exchange rates quite some times. So, I could imagine that OHLC Endpoint with volume weighted averag price (vwap
) is also an option. Though, the resolution decreases the more you go into the past (they offer at least daily data, afaik).
@wearymanateevedaknotstabooresisting
(offset=120m)
, which is exactly my "arbitrary" rewind limit, which you hit. Please increase that value to whatever works for you. EDIT: Makes me think how we could improve this "successive approximation" in general...I second that weekly data is a too broad time frame for tax calculations. Daily average price would have been somehow ok, I guess. However, this demands different price sources or increase the Trades API time delta, we could also use the exponential base 2 approach: at time, 1m, 2m, 4m, ... until greater than 1d.
_get_prices_binance already realizes a method, to retrieve the local fiat price for an asset, for which the exchange does not provide a direct pair.
We could implement the logic from
_get_prices_binance
genericly, so that everyget_prices
function is able to handle this kind of case.Idea taken from /u/frugaleringenieur from reddit [1] [2]