Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Last active October 14, 2021 05:02
Show Gist options
  • Select an option

  • Save marcosan93/6318e501576b17a60f2f07343b1cca06 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/6318e501576b17a60f2f07343b1cca06 to your computer and use it in GitHub Desktop.
def getCryptoPrice(api_key, ticker="BTC-USD", n_days=1000):
# Time periods
now = datetime.now()
# How far back to retrieve
ago = now - timedelta(days=n_days)
# Getting the price history for the crypto
df = get_eod_data(
ticker,
"CC",
api_key=api_key,
start=ago,
end=now
)
# Dropping a column
df.drop(
["Adjusted_close"],
axis=1,
inplace=True
)
return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment