Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
24.2 Code Repo Analyzing Bitcoin
Has anyone made progress up to the final code repo for the Python for Finance course?
6 ответов
+ 2
import numpy as np
import numpy_financial as npf
#price for 2018-2021
bitcoin = [3869.47, 7188.46, 22203.31, 29391.78]
devi1 = np.std(bitcoin)
print(devi1)
+ 7
This was a tricky one. I didn't know how to handle the ret= without weights axis value described in the volatility lesson. Turns out, this works:
data = yf.Ticker('BTC-USD')
x = data.history('1y')['Close']
ret = x
risk = np.std(ret) * np.sqrt(252)
sharpe = (np.mean(ret) / np.std(ret))*np.sqrt(252)
print("Risk", risk)
print("Sharpe", sharpe)
plt.plot(x)
plt.savefig('plot.png')
+ 2
No there is confusion. There is no proper explanation given.
+ 1
Ok, so I'm not the only one that thinks that. Thanks!
0
My problem is that I think I have it done, but nevertheless I am stuck.
It doesn't show up as completed and therefore the following chapters are unavailable to me :-(
Has anybody the same problem?
0
If you can't get the code to work, you can go back to the lesson and continue through. After the code is 1 more question to finish the lesson