-
-
Save yangwao/c2295fcfe02a75f805bba8666c63ad3e to your computer and use it in GitHub Desktop.
Price of Edgeware for last 30 days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://repl.it/talk/share/calculate-edgeware-price-for-30d/118764