Closed Bagongo closed 3 years ago
Hi!
As I checked you can get the first listed price using the endpoint /coins/{id}/market_chart/range
-> cg.get_coin_market_chart_range_by_id()
, raging from an extremely past timestamp (e.g. beginning of 2008 -> 1199138400) until a more recent timestamp (e.g. today -> 1618396519). This endpoint returns daily data for duration above 90 days:
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) Minutely data will be used for duration within 1 day, Hourly data will be used for duration between 1 day and 90 days, Daily data will be used for duration above 90 days.
and it seems to return the Open price for each date.
For example:
>>> L=cg.get_coin_market_chart_range_by_id(id='bitcoin', vs_currency='usd', from_timestamp=1199138400, to_timestamp=1618396519)
>>> L['prices'][0] # first historical price available, 1367107200000 -> 28 Apr 2013
[1367107200000, 135.3]
>>> L['prices'][-1] #last historical price available, 1618358400000 -> 14 Apr 2021
[1618358400000, 63576.676041048275]
>>> L=cg.get_coin_market_chart_range_by_id(id='ethereum', vs_currency='usd', from_timestamp=1199138400, to_timestamp=1618396519)
>>> L['prices'][0] # first historical price available, 1438905600000 -> 07 Aug 2015
[1438905600000, 2.83162]
>>> L['prices'][-1] # last historical price, 1618358400000 -> 14 Apr 2021
[1618358400000, 2304.3435163110134]
Cheers
Thanks man I’ll check it out! Much appreciated! σας ευχαριστώ 🙏
Il giorno 14 apr 2021, alle ore 13:09, Manolis Christoforou @.***> ha scritto:
Hi!
As I checked you can get the first listed price using the endpoint /coins/{id}/market_chart/range -> cg.get_coin_market_chart_range_by_id(), raging from an extremely past timestamp (e.g. beginning of 2008 -> 1199138400) until a more recent timestamp (e.g. today -> 1618396519). This endpoint returns daily data for duration above 90 days:
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) Minutely data will be used for duration within 1 day, Hourly data will be used for duration between 1 day and 90 days, Daily data will be used for duration above 90 days.
and it seems to return the Open price for each date.
For example:
Getting first historical price for Bitcoin (BTC):
L=cg.get_coin_market_chart_range_by_id(id='bitcoin', vs_currency='usd', from_timestamp=1199138400, to_timestamp=1618396519) L['prices'][0] # first historical price available, 1367107200000 -> 28 Apr 2013 [1367107200000, 135.3] L['prices'][-1] #last historical price available, 1618358400000 -> 14 Apr 2021 [1618358400000, 63576.676041048275] Similar for Ethereum (ETH): L=cg.get_coin_market_chart_range_by_id(id='ethereum', vs_currency='usd', from_timestamp=1199138400, to_timestamp=1618396519) L['prices'][0] # first historical price available, 1438905600000 -> 07 Aug 2015 [1438905600000, 2.83162] L['prices'][-1] # last historical price, 1618358400000 -> 14 Apr 2021 [1618358400000, 2304.3435163110134] Cheers
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/man-c/pycoingecko/issues/31#issuecomment-819435759, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAE5SEB2KXUHS5FKOCT6HLTIVZU3ANCNFSM4ZZUT7BA.
Is there a way to get the first listed price for a coin, without knowing the date it was firstly listed?