Python Bitcoin | Sololearn: Learn to code for FREE!

0

Python Bitcoin

#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. This is the correct result: 0.07297 import numpy as np import numpy_financial as npf #price for 2018-2021 bitcoin = [-500.000, 3869.47*10, 7188.46*10, 22203.31*10, 29391.78*10] print(npf.irr(bitcoin)) What is wrong hereß

2/6/2022 4:17:39 PM

Anil Can Durmus

4 Answers

New Answer

0

The initial investment should be -500000 as the irr function goes like -Initial_Investment+(value1/(1+r)) + (value2/(1+r)^2)... And so on till last value of array such that the sum results in 0 as output in order to have the exact internal rate of return

0

It's wrong: -500.000 You need: -500000 Point is not needed here.

0

import numpy as np import numpy_financial as npf #price for 2018-2021 bitcoin = [3869.47, 7188.46, 22203.31, 29391.78] x=np.std(bitcoin) print(x) bitcoin = [-500000, 3869.47*10, 7188.46*10, 22203.31*10, 29391.78*10] print(npf.irr(bitcoin))