IRR bitcoin help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

IRR bitcoin help

IRR Let's continue with our Bitcoin project! You decide to start a Bitcoin mining business in January of 2017. You make an initial investment of $500K to buy the required mining hardware. Each year the hardware can mine 10 bitcoins, so your first return will come on January 1, 2018. Task Calculate the return for each year and output the IRR of the project. Hint Create an array with the initial investment as the first element (with a negative value), followed by the cost of 10 bitcoins per year -- multiply the values of the given array by 10 and accordingly add them to the list you created, placing them after the investment value. Expected result 0.07297215919675315 Use npf.irr() function to calculate the IRR. import numpy as np import numpy_financial as npf #price for 2018-2021 bitcoin = [3869.47, 7188.46, 22203.31, 29391.78] res = np.std(bitcoin ) print (res)

28th Oct 2022, 2:47 PM
Vedansh Sharma
Vedansh Sharma - avatar
2 Answers
+ 6
Vedansh Sharma , the code you have shown here is not what is required in your description. you are calculating the standard deviation, but it is mentioned to use the irr() function. may be you mixed something up, so please review these both code repos: 6.2 and 10.2 in the tutorial *python for finance*
28th Oct 2022, 4:55 PM
Lothar
Lothar - avatar
0
import numpy as np import numpy_financial as npf #price for 2018-2021 bitcoin = [3869.47, 7188.46, 22203.31, 29391.78] print(np.std(bitcoin )) x=[-500000,np.std(bitcoin)*10] print (npf.irr(x)) Perfect solution
10th Feb 2023, 10:22 PM
Mahmoud Omar ELRomy
Mahmoud Omar ELRomy - avatar