Skip to main content

Questions tagged [programming]

For questions about programming languages, implementation, and packages in quantitative finance. Note: question must be specific to quantitative finance and must necessitate knowledge of quantitative finance in order to be on topic.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

numpy.where with multiple conditions [closed]

I believe this may not be a difficult problem but I fail to solve it. Let's say, I want to generate a sell signal when z_score is above the threshold AND if there's no an open short position. When the ...
Fadai Mammadov's user avatar
0 votes
0 answers
35 views

ql.OvernightIndexFutureRateHelper asking for a fixing, but not able to add it

I´m trying to make a Overnight Index FutureRateHelper but when bootstrapping, the following Error arises: RuntimeError: 1st iteration: failed at 1st alive instrument, pillar May 31st, 2024, maturity ...
Esteban's user avatar
  • 11
0 votes
0 answers
44 views

Volatility Surface Modelling in Python

For my master thesis, I try to create a Volatility Surface for S&P500 Index options. Every time I run my code, the surface I get is full of spikes. I'm just not sure if these are outliers which ...
Aaron 's user avatar
0 votes
0 answers
16 views

Is there any way to implement GARCH-MIDAS model in R for multivariate estimation?

I'm writing a research paper in economics, and would like to research the impact of both financial and macroeconomic variables on the NIFTY50 index. My plan was to use a GARCH model. I've stumbled ...
Zeeshan Mohammad's user avatar
-2 votes
0 answers
30 views

Exporting IV Curve calibrated in Cpp to python for analysis

This is more of a dev question than a quant question but I think a lot of people here would have faced this issue and might know. I am calibrating a IV Curve inside cpp, now how do I export the curve ...
user50123's user avatar
-1 votes
2 answers
69 views

Get bonds data in python [duplicate]

Anyone knows a way of getting trustworthy bonds data in python? I know that for stock there is yfinance package but it doesnt include bonds. Thx
Lucca F's user avatar
5 votes
1 answer
184 views

Recommended Setup for QuantLib-Python AmortizingFloatingRateBond

I am trying to model a term loan in QuantLib-Python that makes quarterly interest payments at CME Term SOFR 3M + 10bps + 525bps paid in arrears with a 2 business ...
cpage's user avatar
  • 64
0 votes
0 answers
20 views

eGARCH(1,1) model evaluation (R). How to assess model integrity?

I am using GARCH modelling for my bachelor thesis in Economics. I am entirely new to the concept, and have only been looking into these kind of models for about a week now. I am trying to do a ...
Sam's user avatar
  • 1
-2 votes
1 answer
64 views

Get upfront bps from a CDS with QuantLib

I have an example the pricing of a CDS in Excel and I am trying to match it with QuantLib, in order to get the upfront bps. Below there is a print of the excel screen where I know all the values are ...
Gustavo Amarante's user avatar
2 votes
0 answers
87 views

Brent algorithm supporting automatic differentiation

I painfully implemented automatic differentiation (AD) and a Gauss-Kronrod numerical integration routine working with it with AD. (Fully tested etc, perfectly working.) Needing a root finding ...
11house's user avatar
  • 113
0 votes
1 answer
60 views

Maximze Sharpe ratio from matlab to python [closed]

I know there matlab library funtion for Optimzing Sharpe ratio estimateMaxSharpeRatio, it mentioned it use direct method How can i do the same thing in python Is there any python libraries Or need ...
andy's user avatar
  • 1
0 votes
0 answers
54 views

Visualizing Drawdown

I want to replicate the image below: Does anyone have an idea how to do this in Python. To be specific; I am only having problems plotting the blue shade and the blue lines.
Lyft's user avatar
  • 1
0 votes
0 answers
20 views

How to get a complete and up-to-date list of ticker symbols for any Yahoo Finance index? [duplicate]

Good afternoon everyone, I am currently in a dilemma to which I have tried to find a solution for a whole week but unfortunately I have come to nothing. I have tried to locate a library or create a ...
Luis David's user avatar
0 votes
1 answer
138 views

Reverse optimization: How to generate the expected portfolio returns given the weights and a series of constraints on those weights?

I have the below function in Python. My objective is to back out the expected returns associated with certain portfolio weights given a series of assumptions. From this I want to generate the expected ...
Farrep7's user avatar
1 vote
0 answers
69 views

Setting up QuantLib to get correct yield for bond with long first payment period

I am dealing with fixed rate bonds. There is one particular bond, 34659UAC0, that caught my eye. This bond has a first coupon period of a whopping 5 years, followed by regular periods of 6 months. My ...
Jerry's user avatar
  • 11
0 votes
2 answers
108 views

QuantLib Python: Calculate ZSpread

I am trying to use quantlib-python to calculate the z-spread of a fixed rate US corporate bond using a zero curve from swap rates provided. Here is the provided ...
cpage's user avatar
  • 64
0 votes
0 answers
34 views

YUIMA: Drift and diffusion parameters must be different?

I am currently working with the Yuima package and trying the estimate the parameters of a CARMA(p,q) model to real data. Using the eacf function of the TSA package a ARMA (2,1) process is recommended ...
Valentin's user avatar
  • 135
0 votes
1 answer
120 views

Portfolio optimization with Scipy in Python

I performed Scipy portfolio optimization in two scenarios: 1) when I cannot lend or borrow at the risk-free rate; 2) when I can lend and borrow at rf=1.5%. Now, optimal risky portfolio weights anyway ...
Maurizio Marinaro's user avatar
0 votes
0 answers
28 views

Getting standardized residuals from MSGARCH in R

After estimation by the MSGARCH package in R, I couldn't find a way to extract residuals from the estimation results. Anyone know how to extract the residuals from MSGARCH package in R? Thanks!
Frank Cheng's user avatar
0 votes
0 answers
36 views

Is there any way to view historical data on market capitalization?

Is there any way to view historical data on market capitalization? I would like to calculate a market capitalization weighted index with only the top 10 nasdaq stocks (like nasdaq 10). I have tried ...
nokemono's user avatar
1 vote
1 answer
185 views

GBP OIS Curve - Zero Rate Curve Calculation in Quantlib

I am new to Quantlib and I am looking to create a Zero Rate Curve from GBP OIS to then use to calculate the present value of fixed rate bonds. I have Looked at the documentation: https://quantlib-...
TheGr8Destructo's user avatar
0 votes
0 answers
22 views

Got different results using SEC EDGAR API and Seeking Alpha

I am trying to get the same Depreciation and Amortization (Total) we can get for AAPL on Seeking Alpha and QuickFS for instance. Here is what is their values: However, what I am getting using the SEC ...
J.Doe's user avatar
  • 73
0 votes
0 answers
42 views

Barrier option Greeks using AD

I am trying to price a Down-and-Out Barrier option using Monte Carlo and get the Greeks using autodiff as provided by PyTorch. However, comparing the output to bumping, I get vastly different values ...
nducl's user avatar
  • 1
1 vote
2 answers
178 views

fast backtesting library in R

I’m looking for a fast library for backtest in R that supports limit orders, stop-losses, and take-profits. The library should be optimized for repeated historical testing and ideally ported from fast ...
mr.T's user avatar
  • 125
0 votes
1 answer
33 views

Is End of Month (Eom) Rule overrides Unadjusted convention rule in Quantlib?

Concerning the post Is End of Month (Eom) Rule overrides convention rule in Quantlib Schedule? I noticed that with Unadjusted convention has the same behavior. Is this wanted? For example, with Target ...
Alessandro Ruo Bernucchio's user avatar
1 vote
0 answers
68 views

Python Quantlib Loop to calculate cap prices: Setting of evaluationDate

I am trying to calculate cap prices for different points in time (valuation dates) with Quantlib. I have built three loops for this. The first one creates the quantlib yield curve object ts_handle ...
Marc157's user avatar
  • 55
4 votes
1 answer
210 views

To estimate the parameters when only the characteristic function is known to us

Recently I was working with a process named Variance Gamma with Stochastic Arrival (VGSA) and trying to fit this process on a given data. To obtain VGSA, as explained in Carr et al. [2001], we take ...
Starlord22's user avatar
0 votes
1 answer
140 views

Why is my Risk Neutral Density recovery failing?

I'm working on a project to recover a known Risk Neutral Density from option prices, using the Breeden-Litzenberger formula (assuming a continuum of option_price(strike_price), the second derivative ...
v.y.'s user avatar
  • 31
0 votes
0 answers
63 views

How to simulate a conditional expectation given a filtration

I had a question regarding how to simulate a certain conditional expectation. I am given two processes $X_1(t), X_2(t)$ which both follow their own SDE, but both are of the form \begin{equation*} dX_i(...
Tipeg's user avatar
  • 1
1 vote
0 answers
131 views

Validator for Risk-Neutral Distributions Derived from Option Prices

I've developed a validator for risk-neutral distributions. I did this for the purpose of testing the risk-neutral distributions generated by a Spectral Analysis risk-neutral density recovery method, ...
v.y.'s user avatar
  • 31
0 votes
0 answers
20 views

How to analyse success of trades by time of day, day of week, duration from the output of an MT5 Expert Advisor

I have the output of an MT5 EA in csv format. I want to analyse the output to identify best time of day, day of week, duration, buy or sell, consecutive wins and losses. Ideally I would like to use a ...
Eric's user avatar
  • 1
3 votes
2 answers
238 views

QuantLib calculations for a Canadian corporate fixed rate bond differ from BBG YAS

I am pricing a non-callable, fixed-rate, Canadian corporate bond with the following parameters: Name Value CUSIP 12657ZAT0 Evaluation Date 2/14/2024 Settlement Date 2/16/2024 Bond Issue Date 3/6/...
Juice's user avatar
  • 31
0 votes
0 answers
158 views

Longstaff & Schwartz algorithm - Python: American option cheaper than European option

I have implemented the Longstaff & Schwartz algorithm for pricing American Option in Python, but I ran into an issue while doing some experiments: sometimes, for the same option, I get a higher ...
Noomkwah's user avatar
  • 101
0 votes
1 answer
70 views

How does the isInArrears affect the quantlib IborLeg? [closed]

Deal details ...
Roshan Yadav's user avatar
0 votes
2 answers
129 views

how to make this time series reguarly spaced

in the picture below we have in the first coloumn the day of the month, in the second coloumn the time in millisecond in epoch time(elapsed from 1 january 1970), third coloumn the stock price and in ...
XY0's user avatar
  • 127
1 vote
0 answers
250 views

IDE to use for Python for Quant Trading [closed]

Dear Quantitative Finance Stack Community, Since many Quantitative propietary trading firms seem to be using Python over alternatives such as STATA. I have now decided to get myself familiar with ...
Julien Maas's user avatar
0 votes
2 answers
170 views

My Montecarlo Simulation is not working?

My aim is to predict 1 year ahead and daily, the price of a stock under certain scenario. These scenarios are the ones that this year the stock will have a similar year, in terms of standard deviation ...
Ricter's user avatar
  • 101
0 votes
1 answer
137 views

Python Quantlib G2 calibration with negative interest

I am currently calibrating the G2++ in Python with Quantlib in negative interest rate environments with cap volatilities. Unfortunately, this does not work as intended and I get error messages:...
Marc157's user avatar
  • 55
0 votes
1 answer
222 views

How to bootstrap the zero coupon curve for US treasuries

Here is my understanding of the process: Capture price of most recently sold gov security at each tenor of the curve (reference treasuryDirect) For coupon paying securities, (i.e. tenor>2yr) you ...
dbojanin's user avatar
0 votes
1 answer
69 views

ISIN symbol pairs for DAX, MDAX, SDAX, TecDAX and Nasdaq-100

I am looking for a simple source for ISIN-symbol pairs for DAX, MDAX, SDAX, TecDAX and Nasdaq-100? I can't find anything on Yahoo and possible sources only offer searches for individual stocks, but I ...
M14's user avatar
  • 101
1 vote
0 answers
74 views

Reserves using Thiele differential equation

I am trying to solve the Thiele differential equations $$ \frac{d}{dt}V^1(t)=r(t)V^1(t)-b^1(t)-\mu_{12}(t)(V^2(t)-V^1(t))-\mu_{10}(t)(V^1(t)) \\ \frac{d}{dt}V^2(t)=r(t)V^2(t)-\mu_{21}(t)(V^1(t)-V^2(t))...
idlatva's user avatar
  • 11
0 votes
0 answers
111 views

Quantlib Python bootstrapping with ArithmeticOISRateHelper: cannot find a soluton for forward rate

I am trying to construct a curve based on OIS quotes. Fixed rates in those OIS are quoted againgst the arithmetic average of the floating rate. Consequently, I am using the correspoding helper class - ...
feeshee 's user avatar
0 votes
1 answer
152 views

How to calibrate a volatility surface using SSVI with market data?

Context I'm a beginner quant and I'm trying to calibrate an vol surface using SPX Implied Vol data. The model is from Jim Gatheral and Antoine Jacquier's paper https://www.tandfonline.com/doi/full/10....
khubquant's user avatar
0 votes
1 answer
115 views

QuantLib: How to compute the forward rate using historical fixing rate and discount factor data

Let's say the valuation date is 08/24/2023. The effective date and maturity date of the swap are 03/12/2022 and 01/10/2024. I want to apply the given historical fixing rates till the valuation date ...
John83's user avatar
  • 37
0 votes
1 answer
116 views

Creating Implied Volatility surface using log moneyness [closed]

When creating the implied volatility surface using $\left(T,log\left(\frac{K}{S_0}\right)\right)$ as $(x,y)$ axis, do the inputs for the implied vol calculation need to be logged too? In other words, ...
ayamathss1's user avatar
6 votes
0 answers
289 views

Creating the local volatility surface from the IV surface

I have been using the dupire equation: $$ \sigma_{LV} (K,T) = \frac{\sigma_{i m p}^2+2 \sigma_{i m p} T\left(\frac{\partial \sigma_{i m p}}{\partial T}+(r-q) K \frac{\partial \sigma_{i m p}}{\partial ...
Xerium's user avatar
  • 89
0 votes
1 answer
264 views

Approximation of an Itô integral with python

Exercise 3.11 (Approximation of an Itô Integral). In this example, the stochastic integral $\int^t_0tW(t)dW(t)$ is considered. The expected value of the integral and the expected value of the square ...
Jessie's user avatar
  • 103
1 vote
0 answers
105 views

Interpreting parameters on Matlab from Patton's code on time varying copulas

I ran Andrew Patton's code (2006) for Markov switching time varying copulas with an example code given in the Matlab tool box. This is the equation for Markov switching time varying normal copulas I ...
nadeem's user avatar
  • 23
0 votes
1 answer
102 views

QuantLib FittedBondDiscountCurve does not produce expected rates

I am using the QuantLib library to fit yield curves. For a $\\\$100$ face bond, with price equal to $\\\$100$, and coupon equal to $\\\$0$, I would expect it to provide a zeroRate of $0.0\%$. However, ...
Trevor J Richards's user avatar
3 votes
0 answers
65 views

Finite difference method for the Heston model using the ADI scheme

I am trying to implement the ADI FDM scheme for the heston and I am following The Heston Model and Its Extensions in Matlab and C#. They have the scheme: $$U'(t) = \textbf{L}U(t),$$ $$\textbf{L} = A_0 ...
Xerium's user avatar
  • 89

1
2 3 4 5
24