New answers tagged

3

I see several problems that might explain those differences: The frequency of the fixed leg on a EONIA swap is Annual and not semi The deposit facility rate is not part of the EONIA curve. Use the Eonia rate. You are calculating rates with simple compounding and not annual compounding Here is an alternative implementation: tenors = [ '1D', '1W', '2W', '...


0

As a first step, I would check whether this time series is autoregressive, that is, of the form $$ y_t = c + \phi_1 y_{t-1} + \ldots + \phi_p y_{t-p} + \varepsilon_t. $$ If this is the only feature of your data, then you should have stationary residuals $\varepsilon$.


1

Does it really matter? It is an initialization issue, and once you have enough data the two methods will converge. adjust=False calculation is simpler, but adjust=True is theoretically better suited to a finite series (yes, I think it is the opposite of what you said). Probably most people still use the simpler, older method, but since the computer does all ...


1

Echoing @noob2 's comments. Additionally, one of the things you might want to be aware of is there is a time to maturity difference between VIX and your calculation of historical volatility. While you are using a constant time frame (30 day) for your volatility calculation, VIX utilizes the near term options contracts for its calculation. As options have ...


1

Let's see. You have the following SDE for the stock price under the measure $P$: $$ dS(t) = \alpha \cdot (\mu - \log S(t)) \cdot S(t) \cdot dt + \sigma \cdot S \cdot dW^P(t), $$ with initial condition $S(0) = S_0$. Moreover, defining $X(t) = \log S(t)$, assuming a constant market price of risk $\lambda = \mu - r$ and performing a change of measure, you get ...


1

I have recently released a Python financial library called FinancePy. It has a convertible bond model implementation. It is still in beta so may have some bugs but you are welcome to try it out. It also uses Numba so it is fast and you can look through to the actual Python code. The github is at https://github.com/domokane/FinancePy Here is an example ...


1

I googled and found https://github.com/TommasoBelluzzo/BaselTools . It says: BaselOP The tool can be run by executing the BaselOP.m script. The underlying calculations are based on the SMA model defined within the BCBS 356. The application offers the opportunity to compare the SMA capital requirements with those produced by the obsolete Basel II approaches ...


3

The constructor of GarmanKohlagenProcess takes a Handle, so if you really want to avoid it you'll have to modify the constructor (and the type of the corresponding data member it initializes).


3

A test for arbitrage opportunities with an LP is to minimize the cost of setting up the portfolio, subject to the restriction that the portfolio loses money in no state of the world. (Note that in your formulation you are missing the actual objective; you only list constraints.) If you find a portfolio that has a negative cost (i.e. you get paid for holding ...


0

By mixing multiple approaches I came up with algorithm that does not need guess as an input. I focused on custom precision and resiliency. Please take a look. https://medium.com/@manchikanti/irr-internal-rate-of-return-calculator-15ec269bd8f5?source=friends_link&sk=21cc51cc485647cb73eb0a66c57522bd https://chitbazaar.github.io/kautilya/


2

I can't quite even re-create your vol smile... when I plug in the parameters you've provided (at $\tau = 0.12$) I get a downward sloping vol smile that doesn't have a minimum at the strikes I looked at I then backed out the options prices at each of a close-up grid of strikes and calculated the curvature of the prices, which is very close to the rn pdf (...


0

Most index distributors publish current holdings for their indexes but historical holdings are only generally available for a cost. Data distribution is the primary way index providers (eg, FTSE Russell in this case) make their money, they're not giving away this stuff for free.


5

Here is a simple example that might be useful. Basically finding parameters for a given section. Some of the parameters might be assumed at start instead of calibrated. import QuantLib as ql import matplotlib.pyplot as plt import numpy as np from scipy.optimize import minimize strikes = [105, 106, 107, 108, 109, 110, 111, 112] fwd = 120.44 expiryTime = 17/...


0

import QuantLib as ql today = ql.Date().todaysDate() initialValue = 40 riskFreeTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.01, ql.Actual365Fixed())) dividendTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.02, ql.Actual365Fixed())) volatility = ql.BlackVolTermStructureHandle(ql.BlackConstantVol(today, ql.NullCalendar(), 0.2, ql....


1

You will need to change the payoff from: payoff = ql.PlainVanillaPayoff(ql.Option.Call, strike_price) to payoff = ql.CashOrNothingPayoff(ql.Option.Call, strike_price, 1)


1

A few things... firstly, I've attached a correction to your code at the bottom. It runs, but gives a solution of 0.0. Not sure why that is, but the code runs at least, can you work out the pricing problem yourself? You've used the import * pattern here. It seems easy now, but it will cause you trouble in future, because when you come to work out where each ...


1

Using MC Simulation, if I am trying to price Geometric Average Asian Option by running the following code: import QuantLib as ql today = ql.Settings.instance().evaluationDate averageType = ql.Average.Geometric option_type = ql.Option.Call strike = 100.0 exerciseDate = ql.TARGET().advance(today, 90, ql.Days) pastFixings = 0 # Empty because this is a new ...


3

QuantLib does have an FD pricing engine for asian options ql.FdBlackScholesAsianEngine(stochProcess, tGrid=100, xGrid=100, aGrid=50), but I've just discovered it only prices Discrete, Arithmetic payoffs! Moving from Continuous to Discrete (documented here) doesn't change the price of the option much, if you pass in something like asianFixingDates = [ql....


3

The price close to 0.93 is correct, here is a reimplementation of both FD and analytic using QuantLib: import QuantLib as ql # World State for Vanilla Pricing spot = 50 vol = 0.2 rate = 0.01 dividend = 0.0 today = ql.Date(1, 9, 2020) day_count = ql.Actual365Fixed() calendar = ql.NullCalendar() # Set up the vol and risk-free curves volatility = ql....


0

Look at this thesis which provide algebra and code in Matlab: https://research.cbs.dk/da/studentProjects/2ce27aba-d4df-4daa-b00e-1ea9a5e21049


2

Though your code is already giving you the correct result, I almost feel bad for you that you have to wait 5 seconds for such a small amount of data. Your code is slow because you are kind of reinventing the wheel instead of using some built-in pandas and numpy functionality. For example, product and wma in your code can be combined and accomplished using ...


Top 50 recent answers are included