Closed TheSerapher closed 5 years ago
@TheSerapher first of all, thanks for the contribution! May I ask you to split this into two pull requests (one for the currency conversion fix, one for the new purchase price functionality)? This would allow us to release a quick fix and restore basic functionality for everyone affected, and to give the new functionality a proper vetting.
Will do, added the changes here, will take your library now and add my fix to it and create a separate PR for that.
Hmm .. I started looking into this and I have done quite a large change in the logic of the application. Not sure if it's worth digging deep into how I can translate my changes into the original code. It could take a while and may also require some bigger changes to work the same way.
EDIT: Meh ... of course I could fix it fairly easy. Created a new PR for it #9
Will create a new PR for this too, forgot to create a branch first :-(
I have been using this extension for a while now and was looking for a way to include initial purchase prices made on Coinbase Pro. This change will allow MoneyMoney to display the initial purchase prices and in turn the current value best on the current price of the coin. Coins transferred to Coinbase and not traded on the market will also show, but they will not list any price information (since it's not available). For orders, it also takes into account when they were purchased and properly displays the date. For transactions I didn't bother fetching that information too.
I also took a crack at Issue #7. I couldn't think of any great solution but here is one that works: Instead of fetching the ticker information directly first compare the product_id (e.g.
BTC-EUR
) against all available products on Coinbase (/products
endpoint.) If it's listed, try to fetch the price information too. If it's not listed, treat it as a regular currency and just display it.The only thing I am not 100% sure about is the pagination implementation. Since orders are paginated I had to add a scraper to fetch all pages related to a
product_id
. In my tests it worked fine by using an artificial limit of1
(the default is100
). I would think with a really high trade volume it probably creates too many requests and takes too long, but maybe that's OK too.Here an example: