Skip to content

Instantly share code, notes, and snippets.

@yangwao
Forked from vikiival/ksm.py
Last active February 1, 2021 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangwao/c2295fcfe02a75f805bba8666c63ad3e to your computer and use it in GitHub Desktop.
Save yangwao/c2295fcfe02a75f805bba8666c63ad3e to your computer and use it in GitHub Desktop.
Price of Edgeware for last 30 days
from pycoingecko import CoinGeckoAPI
import datetime
from statistics import median, mean
cg = CoinGeckoAPI()
def main():
numdays = 30
base = datetime.datetime.today()
date_list = [base - datetime.timedelta(days=x) for x in range(numdays)]
fn_format = lambda x: x.strftime("%d-%m-%Y")
fn_gecko = lambda date: cg.get_coin_history_by_id(id='edgeware', vs_currencies='eur', date=date)
fn_price = lambda x: x['market_data']['current_price']['eur']
prices = sorted(map(fn_price, map(fn_gecko, map(fn_format, date_list))))
print('MEDIAN', median(prices))
print('MEAN', mean(prices))
return prices
if __name__ == "__main__":
main()
@yangwao
Copy link
Author

yangwao commented Feb 1, 2021

https://repl.it/talk/share/calculate-edgeware-price-for-30d/118764

MEDIAN 0.011521385951866803
MEAN 0.011050162762866796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment