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
26 views

Is there any way to estimate a multivariate GARCH-MIDAS model in R?

I'm writing my master thesis in economics, and would like to research the impact of both financial and macroeconomic variables on the S&P500 index. My plan was to use a GARCH model. I've stumbled ...
user avatar
0 votes
0 answers
15 views

How to find a data for Python for a secured and unsecured loan decisions? [closed]

I am doing a project where we have to provide a data and analytics for the following two scenarios: Scenario 1. Lending a money at a fixed rate for an unsecured purchase, Scenario 2. Lending a money ...
Lee's user avatar
  • 111
1 vote
1 answer
49 views

PV different from Dirty Price in QuantLib

As far as I understand, dirty price is the sum of clean price and accrued amount and should be equal to the Present Value (PV) of a bond at a certain yield rate. However, I can't replicate this ...
Oliver Mohr Bonometti's user avatar
0 votes
0 answers
26 views

Commodity forward curve Monte-Carlo

I need to value an Asian commodity option using Monte Carlo and a log-normal model. The inputs are the commodity forward curve and the volatility surface for futures/options expiry. Unfortunately, all ...
Sergey Chigrinov's user avatar
0 votes
0 answers
72 views

CoVaR/dCoVaR modelling using bivariate DCC-GJR-GARCH

For the several weeks, I have been looking for a way to calculate and display the results of my DCC-GJR-GARCH model to picture a dynamic relationship between daily return of, let's say for example, ...
Restu's user avatar
  • 1
2 votes
0 answers
37 views

ATM cap prices in Vasicek model (Filipovic)

I am trying to replicate the ATM cap prices in table 7.1 (see bottom of this post) from Filipovic's book "Term Structure Models - A Graduate Course" which assume the Vasicek model and uses ...
Landscape's user avatar
  • 528
3 votes
0 answers
200 views

Financial software: academia vs. real world [closed]

I am looking for resources (if they exist) that explain the differences between quant finance software in academia and the real world, or explain how quant software is implemented in practice. For ...
FISR's user avatar
  • 117
0 votes
1 answer
52 views

Uncertain Volatility Model - Option Pricing R code help

I am trying to price the following call option using the UVM method in R. The code I wrote below keeps producing the same price for the min and max volatilities, which is wrong, however, I can't seem ...
Imran Jabbar's user avatar
3 votes
1 answer
144 views

Curve construction with Python's RATESLIB package

As per the user guide of Python's RATESLIB package (https://rateslib.readthedocs.io/en/latest/i_guide.html#guide-doc), below example is provided to construct a Curve ...
augustine's user avatar
0 votes
1 answer
83 views

For a university project I need the historical number of outstanding shares for all companies currently in the S&P 500

Up until now I have been using the yahoo finance api which provides lots of data already that I can use for my analysis. Unfortunately I need the historical number of outstanding shares for multiple ...
Valentin 's user avatar
3 votes
0 answers
77 views

How to take into account transaction fee of a backtest from a list of returns?

I have a list of booleans that correspond to buy and sell signals that I would like to backtest. To achieve this, I calculated the return ret of a security and when ...
Florent's user avatar
  • 241
2 votes
1 answer
198 views

Why is the NPV of this FX Forward 0?

I've checked similar questions and answers but even after setting the evaluation date in ql.settings I still get zero. Like another poster, I also have the QL cookbook and have read everything I could ...
PythonAutomation's user avatar
1 vote
1 answer
65 views

QuantLib Python: How to print each caplet/floorlet value, intrinsic value and time value at each fixing date?

I have the following code to price a floor (can also be used for cap), and have been computing the payoff myself, but I think QL can already do this. Since the cashflows I print out aren't correct as ...
PythonAutomation's user avatar
0 votes
0 answers
45 views

Expanding window with ugarchroll in rugarch in R

I was wondering whether my code is crafted correctly to satisfy this requirement: use 1:1000 to predict 1001, then use 1:1001 to predict 1002, and so on rOHLC has a length of 10079 ...
Porsche Tan's user avatar
0 votes
1 answer
90 views

Using bid and ask prices with VectorBT library

I am creating a backtest using vectorbt library. This is my function for all the portfolio metrics: ...
arkon's user avatar
  • 1
0 votes
0 answers
51 views

Can anyone help me to understand why the GMV point is not on the efficient frontier?

I am following a course about portfolio construction with Python. I am able to successfully draw the efficient frontier and capital market line (CML), and the global minimum variance (GMV) point using ...
user3741124's user avatar
3 votes
1 answer
158 views

QuantLib: Analytical Greeks and Numerical Greeks do not match?

I use the Black Scholes Merton (BSM) model from QuantLib to calculate Call options price and its analytical Greeks. I also manually calculate its Numerical Greeks (Theta, Vega), but the results do not ...
Scoodood's user avatar
  • 133
1 vote
0 answers
26 views

Garch Model with Vix as external regressor un dummy rugarch r studio

I would like to try to replicate this variance dummied model in r studio, to try to compare garch vs i.v in forecasting vol: Data : S&P 500 log-return from 03.01.2020 to 31.12.2022 Ext regressor : ...
fabdellar's user avatar
2 votes
1 answer
199 views

Clarifying Parkinson Python Code [closed]

I would appreciate opinions/reviews on whether my python code to calculate Parkinson Volatility index is correct. Thank you very much! ...
Porsche Tan's user avatar
2 votes
1 answer
111 views

How to test an orderbook using real data

I'm pretty new to all this but haven't found anything online on my issue (the answer may be very obvious since I'm a beginner) - I'm currently coding up a very generic orderbook in C++ for fun, just ...
cocode's user avatar
  • 21
0 votes
0 answers
15 views

API for getting past 10 years of P&L data for a particular NSE/BSE stock [duplicate]

I am trying to get past 10 years P&L data for a bunch of Indian companies, but can't seem to find a good API to do so. I have tried yfinance, Alpha Vantage, IEX cloud and a few others. I tried web ...
Derek Langley's user avatar
1 vote
0 answers
73 views

Resource recommendations: Levy process estimation using programming languages

Perhaps this type of question is not very suitable for this forum, but I'll try to make my question a little useful. I'm studying stochastic processes, more precisely, Levy processes. A Levy process $...
André Goulart's user avatar
1 vote
1 answer
37 views

Can the coef be negative in cointegrated stocks?

I'm searching for cointegrated stocks using the Python CointAnalysis library. While computing stock prices on a 5 mins time frame, I found that the stocks MNST (Monster Beverage Corp.) and KDP (Keurig ...
Begoodpy's user avatar
  • 111
0 votes
2 answers
187 views

Pricing European Call Closed Form Spread Options in Python

I am currently trying to correctly price European Call Closed Form Spread Options using Python. The main problem I am currently running into is that I have nothing to compare the option price so that ...
Coco Garazzo's user avatar
2 votes
1 answer
88 views

Generating normally distributed random numbers using Sobol generator in QuantLib

I am trying use low discrepancy Sobol RNG to generate normally distributed random numbers and fill an Eigen matrix with those random numbers. The matrix represents a basket of 5 assets (rows) each ...
Yoshiro's user avatar
  • 21
0 votes
0 answers
80 views

Explicit Finite Difference method to price European Call in Python

...
hener's user avatar
  • 1
0 votes
1 answer
104 views

QuantLib Yield Curve Bootstrapping Fails with Bracketing Error

I'm trying to build the yield curve simply using Treasury yields one would get by querying the FRED API, but as my code below will show, I'm told on the 1st iteration that there was failure at the 4th ...
pmse234's user avatar
  • 15
0 votes
1 answer
112 views

Constructing a Custom Schedule in QuantLib for Long/Short Coupons

I am currently using QuantLib for some bond pricing tasks and I have run into a problem which I hope someone here can help me with. In my current project, I am required to model bond schedules that ...
TourEiffel's user avatar
0 votes
0 answers
44 views

How do I obtain the RMSE from a QuantLib curve estimation?

I'm estimating yield curves in Python using the QuantLib package and the included Nelson Siegel, Svensson, specifications. I can get the estimated parameters, but I would like to see a measure of the ...
ibbore's user avatar
  • 11
0 votes
0 answers
119 views

CIR model calibration - python

EDIT: or maybe to add, is the below way of calibration better than calculating as: longer term mean b: average of interest rates speed of reversion a: ln(1/drift) volatility σ I am trying to ...
hello543's user avatar
4 votes
0 answers
98 views

Plotting of trendlines with certain conditions post significant pivot point determination

I'm trying to get a point which is higher in a range of points, i.e., pivot high, then among a range of pivot high I want to find a significant pivot high. For this I am trying to create a range which ...
driver's user avatar
  • 91
3 votes
1 answer
88 views

Quantlib: Is linking the curve to the discount curve important in vanilla swaps?

Below are steps I followed to value a few swaps. Just want to know if I have included the key steps in the below definitions. In some examples I found that we are also adding indexcurve.linkTo(). I ...
robin's user avatar
  • 93
1 vote
1 answer
219 views

Understanding SOFR Fixing Rate Retrieval for Future Dates in QuantLib

I am using QuantLib to calculate the SOFR index for a bond's (ISIN : US025816CL12) cash flows. My objective is to understand how QuantLib computes the SOFR fixing rate for future dates. Here is my ...
TourEiffel's user avatar
0 votes
1 answer
61 views

Time Dependent Heston model yields a runtime error in Quantlib (Python)

I am trying to fit a time dependent Heston model using Quantlib Python. I'm getting the following runtime error: Boost assertion failed : px !=0. Can somebody help in this or is there an example of ...
Sarat Muppana's user avatar
0 votes
1 answer
139 views

getQuote function in quantmod package [closed]

just wondering if there is a similar function that I can use to get the last traded price of a stock? Cuz the getQuote function from quantmod package does not seem to be working no more. It would show ...
Bubbles's user avatar
  • 103
3 votes
0 answers
149 views

PBO algorithm "The Probability of Backtest Overfitting" paper

In this article by Lopez de Prado et al., an algorithm was proposed for assessing the overfit of a trading strategy: The Probability of Backtest Overfitting There is also a package for R: pbo: ...
mr.T's user avatar
  • 143
0 votes
0 answers
67 views

trailing Stop Calculation for a strategy

I have converted pine script (UT-Bot by Yo_adriiiiaan) strategy to python but facing some errors. It requires TRA calculation and trailing stop calculation. Problem is that ...
user3696623's user avatar
0 votes
1 answer
96 views

Issue with QuantLib's BondFunctions.zSpread using RelinkableYieldTermStructureHandle in Python

I'm using QuantLib in Python to calculate the z-spread of a bond. I have a RelinkableYieldTermStructureHandle for the yield curve, but I'm getting a TypeError when ...
TourEiffel's user avatar
1 vote
1 answer
94 views

Stochastic volatility estimation in R

Can anyone help me with the stochvol package in R? I estimated the volatilities using this package but I am not being able to understand how to download the ...
nusratecon's user avatar
0 votes
0 answers
29 views

R resources for GMM estimation and testing of multifactor asset pricing models

Has anyone seen R script for GMM estimation and testing of asset pricing models such as Fama-French 3-factor or similar? Ideally, I would like to have R scripts corresponding to Cochrane "Asset ...
Richard Hardy's user avatar
3 votes
0 answers
55 views

CDS Runtime Error: Issue changing evaluation date using UpfrontCdsHelper in Python

If I run the below CDS pricing example (from https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) using the UpfrontCdsHelper instead of the SpreadCdsHelper, I get the ...
bkhoor's user avatar
  • 31
1 vote
1 answer
165 views

what are the packages for effective backtesting in R

I need a fast package for backtesting in R. I'm going to optimize a lot so I'll be running my strategies many millions of times. I know about packages like ...
mr.T's user avatar
  • 143
2 votes
0 answers
99 views

Quantlib match clean price with bbg clean price : Huge gap between calculated price and bloomberg

I am not able to make quantlib match bloomber price, maybe I don't use the right parameters into ql.Schedule or ql.FixedRateBond ...
TourEiffel's user avatar
6 votes
2 answers
166 views

Replicating QuantLib plain vanilla Interest Rate Swap valuation

I'm learning QuantLib-Python and trying to replicate an Interest Rate Swap valuation on a custom curve constructed by passing lists of dates and discounting factors. Please see my code below ...
Hasek's user avatar
  • 744
2 votes
1 answer
165 views

Using Yield Term Structure for Bond Pricing in QuantLib: Is a Zero-Coupon Curve Necessary?

I've been using QuantLib for constructing a yield curve and pricing a bond. I am wondering if I'm using the correct method to create my yield term structure (yts) ...
TourEiffel's user avatar
0 votes
1 answer
164 views

Discrepancy between Bootstraped Zero Rates: Gaps between Bloomberg and My Calculated Zero Rates

I have been attempting to bootstrap zero rates using quantlib, but I am perplexed by the significant discrepancies between my calculated zero rates and those ...
TourEiffel's user avatar
4 votes
1 answer
282 views

Yield curve bootstrapping not producing expected cash flow start date

I'm currently working on building a yield curve using OIS swaps. However, I'm encountering an issue with the cash flow start date that I'm struggling to understand. Here's a simplified version of my ...
TourEiffel's user avatar
1 vote
2 answers
118 views

CrossCurrencyBasisSwapRateHelper feature deprecated

I have been using the CrossCurrencyBasisSwapRateHelper feature to generate a colateralised discounting curve where the collateral is in a currency different to that of the asset. However, I noticed ...
Stephen Ellis NZ's user avatar
0 votes
1 answer
101 views

QuantLib: null term structure set to this instance of index

I'm playing around with QuantLib and trying to price an interest rate cap using HW 1F model. ...
Hasek's user avatar
  • 744
3 votes
2 answers
301 views

Average drawdown and average drawdown length in Python

I'm trying to use Python to give me more information about drawdowns than just the max drawdown and the duration of the max drawdown. I would like to determine the number of drawdowns that have ...
user89135's user avatar
  • 304

1
2 3 4 5
23