ajrlewis on Nostr: ala ```python import matplotlib.pyplot as plt import numpy as np import pandas as pd ...
ala
```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
currency = "USD"
response = requests.get(
f"https://mempool.space/api/v1/historical-price?currency={currency}";
)
data = response.json()
prices = data["prices"]
df = pd.DataFrame(prices)
df["time"] = pd.to_datetime(df["time"], unit="s")
plt.plot(df["time"], np.log2(df[currency]))
plt.ylabel(f"Historical {currency} Price [Log Base 2]")
plt.show()
```
```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
currency = "USD"
response = requests.get(
f"https://mempool.space/api/v1/historical-price?currency={currency}";
)
data = response.json()
prices = data["prices"]
df = pd.DataFrame(prices)
df["time"] = pd.to_datetime(df["time"], unit="s")
plt.plot(df["time"], np.log2(df[currency]))
plt.ylabel(f"Historical {currency} Price [Log Base 2]")
plt.show()
```