Created
February 19, 2024 18:05
-
-
Save cbergz/aef7258a7ec601d7ac2405f554cadae9 to your computer and use it in GitHub Desktop.
DEP TWAP Calculator
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 pandas as pd | |
cg = CoinGeckoAPI() | |
dydx_trades = cg.get_coin_ohlc_by_id("dydx", "usd", 7) | |
dydx_df = pd.DataFrame(dydx_trades, columns=['time', 'open', 'high', 'low', 'close']) | |
twap_price = dydx_df[['open', 'high', 'low', 'close']].mean(axis=None) | |
print(twap_price) | |
## Ran on Feb 19th at 18:00 UTC | |
## Returns 3.112674418604651 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment