Closed thorbjornwolf closed 6 years ago
Hi, Thanks for taking the time to dig in the code and write this. I thought the examples were clear but evidently my judgement was completely biased 😉.
You are right on currency_file
, fallback_on_wrong_date
, ref_currency
, verbose
and na_values
.
Regarding fallback_on_missing_rate
, you are almost right, indeed the data loading process will fill the holes inside the currency data's date range, but it will use a linear interpolation using the two closest rates available (appropriate test). I agree that this is not obvious by reading the code, but it was written this way to keep the complexity linear when filling the holes.
Feel free to send a PR, otherwise I can just update the README with more details in the fallback section.
Ahhh, I see! And what a blunder I have made - I've solely been looking at docstrings (and falling back to source code) to understand the arguments, not even considering the README :disappointed:
It might be that others are like me, using CurrencyConverter?
in iPython as the main way of inspecting documentation, so I'll make a PR to show you what I was expecting. Then we'll see if it makes sense to include in the package.
Fixed with #7
Hi! Thanks for doing all this work :-)
Now, I've been looking through the code a number of times, but I'm still fuzzy on the exact roles of
__init__
'sfallback_on_wrong_date
andfallback_on_missing_rate
. Extrapolating this issue, it might be beneficial to document all the arguments for at least__init__
andconvert
, since the end user will need both to use this package.If the maintainer is interested in receiving a PR, I wouldn't mind giving it a shot.
My understanding so far of
__init__
's arguments:currency_file
: A filesystem path (str or pathlib.Path), or an URL starting with "http[s]://"fallback_on_wrong_date
: If False, convert will raise a RateNotFoundError when the requested date is outside our currency data's date range. If True, convert will instead use the youngest or oldest data point when the requested date is outside the range. It will still, however, raise a RateNotFoundError if you ask for a date that is missing inside the range, unlessfallback_on_missing_rate=True
.fallback_on_missing_rate
: If True, the data loading process will fill in data for missing dates (between min and max date) with the closest rate. Otherwise, they will be left as None.ref_currency
: The currency that the source data is oriented towards. This is EUR for the ECB data.na_values
: What to interpret as missing values from the source data.verbose
: Standard flag for how much info it should print.Is that about right? :-)