Last active
October 14, 2021 05:02
-
-
Save marcosan93/6318e501576b17a60f2f07343b1cca06 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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