By default, QuantLib expects a continuously compounded rate in the FlatForward constructor.
So the PV you are getting is basically:
from math import exp
print(110 * exp(-0.1))
If you define your curve with an annually compounded rate like so:
curve_30_360 = ql.YieldTermStructureHandle(
ql.FlatForward(calc_date, risk_free_rate, ql....
I believe that Taleb made a mistake in his book.
Several days ago I met the same question, and I came to read the original article of Parkinson(1980). After doing some simple math, I was aware that the 1.66( the sqrt of 4log2) was already counted in the Parkinson Number Formula. As a result, I believe that the theoretical ratio of Parkinson number to close-...
I think that you almost had both. You were just missing the combination of an InterestRate and the includeSettlementDateFlows boolean flag. The following works:
import QuantLib as Ql
ql = Ql
# Set up logging
numeric_level = getattr(logging, 'INFO', None)
logging.basicConfig(level=numeric_level, format='%(asctime)s %(levelname)-8s %(message)s',...
Fractional differentiation (or differencing) is a technique that transforms an input series to a stationary series while retaining "long-term" memory.
Consider the following example based on S&P 500 closing prices.
The daily returns pass the ADF test however the memory is now lost:
CV 1%: -3.43
QuantLib has a concept of evaluation date (for a number of reasons that I'm now glossing over). By default, it's today's date, which implies that all your cashflows are in the past and thus worthless. If you want to calculate the NPV as of the calc date, add:
ql.Settings.instance().evaluationDate = calc_date
before calculating. Your construction of the ...
By default, QuantLib will set the evaluation data as the present date.
If you inspect your current date with:
You will see that you are trying to get the npv of all past cashflows, which would be zero.
Try inserting this line after defining the d1.
It's normal that it takes very long to come close to
the efficient frontier with random portfolios.
How close you come how fast will be strongly influenced
by how you sample the portfolios. In your code, you
sample uniformly. You may want to look at the weight
distributions of the portfolios on the frontier, and
then consider how likely it is that you arrive ...
In case this is useful for anyone else who comes across this, the issue was that I had set up my vector of terminal values the wrong way round (ie from smallest to largest rather than largest to smallest). The code to set up the terminal vector should read as follows:
# set up terminal vector and prob vector
c_n = np.zeros(steps + 1)
c_n = s * (u ** ...
There are many (hundreds?) of ways to get historical equity data online, both free and paid.
Check out the "What data sources are available online?" megathread: What data sources are available online?
I have my own data service I just started, https://tendollardata.com, that I really do think is worth checking. I write out why in that thread (https:...