In [1]:
Copied!
import os, sys
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
%matplotlib inline
import marketdata as md
import os, sys
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
%matplotlib inline
import marketdata as md
In [2]:
Copied!
# Fixed manually
x = ['DAI','USDC','USDT','ETH','BTC','SQETH', 'SOL']
y = ["dai","usd-coin","tether","ethereum","bitcoin","opyn-squeeth","solana"]
stablecoins = dict(zip(x,y))
# Fixed manually
x = ['DAI','USDC','USDT','ETH','BTC','SQETH', 'SOL']
y = ["dai","usd-coin","tether","ethereum","bitcoin","opyn-squeeth","solana"]
stablecoins = dict(zip(x,y))
In [3]:
Copied!
hmd = md.HistoricalMarketData( y, 'usd', '2021-01-01','2022-08-15').price()
hmd.columns = [i.lower() for i in x]
hmd = hmd.fillna(method='bfill')
hmd.tail()
hmd = md.HistoricalMarketData( y, 'usd', '2021-01-01','2022-08-15').price()
hmd.columns = [i.lower() for i in x]
hmd = hmd.fillna(method='bfill')
hmd.tail()
Out[3]:
dai | usdc | usdt | eth | btc | sqeth | sol | |
---|---|---|---|---|---|---|---|
2022-08-11 | 1.000538 | 1.000510 | 1.000595 | 1852.878555 | 23948.829553 | 184.590822 | 42.295780 |
2022-08-12 | 1.001991 | 0.999959 | 0.999916 | 1881.427405 | 23948.751704 | 187.335758 | 42.752870 |
2022-08-13 | 1.001456 | 1.000885 | 1.001999 | 1959.330925 | 24411.379872 | 202.250714 | 45.340525 |
2022-08-14 | 1.000894 | 1.001678 | 1.000588 | 1982.411828 | 24433.653747 | 207.888264 | 46.627628 |
2022-08-15 | 0.999468 | 0.999402 | 0.999533 | 1936.701164 | 24312.541425 | 198.498785 | 44.977699 |
In [4]:
Copied!
# Send to csv
hmd.to_csv('market_data.csv')
# Send to csv
hmd.to_csv('market_data.csv')