24.2 Code Repo Analyzing Bitcoin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

24.2 Code Repo Analyzing Bitcoin

Has anyone made progress up to the final code repo for the Python for Finance course?

7th Dec 2021, 2:58 PM
Cory Peitsch
Cory Peitsch - avatar
6 Answers
+ 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)
8th Dec 2021, 11:15 AM
Dimitar Pavlov
Dimitar Pavlov - avatar
+ 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')
12th Jan 2022, 6:22 PM
Adam Dirker
Adam Dirker - avatar
+ 2
No there is confusion. There is no proper explanation given.
7th Dec 2021, 3:58 PM
A͢J
A͢J - avatar
+ 1
Ok, so I'm not the only one that thinks that. Thanks!
7th Dec 2021, 4:03 PM
Cory Peitsch
Cory Peitsch - avatar
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?
9th Mar 2022, 10:43 AM
Guenni
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
22nd Sep 2022, 3:32 PM
Benny Van Der Lans
Benny Van Der Lans - avatar