-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Historical Price of XCH - API #9
Comments
... And Yes... There are benefits to pulling the values VIA API for each transaction every time your script runs - Once it works the way you want it to work, it's hands off. And pulling the prices from a static file means that today's version of the script works for every day up until today... but won't have any data for tomorrow, next week or next month without periodically updating the static file. This is why you do what you do and I do what I do... different thought processes! |
I will have to look more at CoinGecko. Based on the response you have it looks like that API is for Current Price, not Historical Price. Meaning you get the price from the exact moment you make the API call, but can't specify and exact date/time in the past to get the price at that time. I will look maybe they have another API endpoint for historical pricing. I've also used CoinMarketcap's API, but there free version doesn't support historical pricing. I would need to think about the whole process really because it would require a user to go to a third party website & sign up for an API key that they would then use in this script. |
I agree, its not exactly ideal for a user to go create an account, create an API key and some way for the user to import their API key - just so your script can make those API calls. As far as the date in the JSON output I shared, I should have included how I pulled that data. It's actually not the current price, even though you wouldn't know it just looking at the JSON output! I can't remember what day that output is from but that's not really important, the important thing is that we can pull the "current value" for a specific day if so desired! I should have included how I produced that output!
There is another option that wouldn't require the use of an API Key, but I'm not sure it could be adapted to " Coingecko has historical data for chia (and I'm assuming other coins), the default view goes back 30 days. I updated the filter to go back to 1-JAN-2021. (https://www.coingecko.com/en/coins/chia/historical_data/usd?start_date=2021-01-01&end_date=2022-04-10#panel). On the bottom left of that page where you can Export as CSV. If you look at the CSV URL, it doesn't appear to be affected by the filter I set in my session. We'd have to download that CSV again tomorrow with the same URL to confirm, but I think it's always going to give you the most up to date output. https://www.coingecko.com/price_charts/export/15174/usd.csv If the CSV is going to provide updated data every day... No need to use the API. No need for manual input from the user. Just need magic from you! Something like: |
Was also contacted by another user from the ChiaForums. He kindly provided additional data to review. |
Let me know if there is a free API that can pull historical pricing for XCH
I'm messing with coingecko right now - A free account allows you 50 API calls per min. 50 calls per minute seems like it could be restrictive if someone's wallet has more than 50 transactions in it - but I don't think it's that big of a deal.
I was trying to get all of my transactions imported to tax.crypto.com last night, found something interesting in a help article discussing the transactions they support (URL below).
I, like you, am no tax professional. And I can't quote any supporting IRS guidance to backup what they are saying... If using 1 price per day to calculate the cost basis for each transaction in our Chia wallet - then your script wouldn't necessarily have to hit the API every time a user ran the script.
Since Chia's only been tradable since May 4th 2021, you could query the daily price before hand, storing it in a CSV / JSON / file. Include that file along with your script so some new code in your script can query the price data from that file.
Attached is an sample API response, I changed the extension to .txt since github wouldn't allow me to attach a .JSON.
(https://help.crypto.com/en/articles/5019855-transaction)
https://www.coingecko.com/en/api
response_1649603496470.txt
The text was updated successfully, but these errors were encountered: