As of May 31, 2023, we have updated our Code of Conduct.

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

Help RSI Python Tradingview

I'm trying to calculate the RSI using Python and, comparing it with Tradingview, I have from 10 to 40 point of difference. How can I obtain a value similar to the one in Tradingview? Thanks. My script:...
Spanu18's user avatar
3 votes
0 answers
17 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
-3 votes
0 answers
23 views

Suggestions for a project [closed]

This is the first time that I write in this forum. I suppose many of you currently work in the financial industry: banks, hedge funds, fintechs... I would like to ask for suggestions to develop a ...
Samantha Smith's user avatar
1 vote
1 answer
80 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
  • 111
2 votes
0 answers
71 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
5 votes
1 answer
68 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
  • 699
2 votes
1 answer
63 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
-3 votes
0 answers
46 views

python code for DV01 [closed]

python code to Draw a curve for DV01 risk of a puttable bond, which is due to mature at 30 years and have a feature of put at 15 years. Where will the maximum exposure be? Shall this bond be sold at ...
AK87's user avatar
  • 1
0 votes
1 answer
81 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
186 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
74 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
58 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
  • 699
3 votes
2 answers
134 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
4 votes
1 answer
80 views

Quantlib Slow valuation of ois_swap on multiple eval days

I have bootstrapped a curve using several depo and swap rates and am trying to use that curve to get the NPV of a swap over a period of time. The generation of prices iteratively through time is ...
StormsEdge's user avatar
1 vote
1 answer
84 views

QuantLib: How to iterate over Cashflows in a Leg

I am looking for a way to obtain dates and amounts of each cashflow in a leg, without having to pop the cashflows out of the leg, like this ...
Leonardo Cruciani's user avatar
3 votes
1 answer
39 views

Quantlib: how to construct CDOR volatility cube? Getting error when using SwapRateHelper

...
Arron Tran's user avatar
0 votes
0 answers
63 views

Is my time horizon for GARCH(1,1)/ARCH(1)/EGARCH(1,1) reasonable?

I am trying to learn about volatility forecasting using three models: ARCH(1), GARCH(1, 1) and EGARCH(1, 1) using python. I wanted to know if my general procedure is correct, and specifically if my ...
probablysid's user avatar
1 vote
1 answer
41 views

API for stock price data for commercial re-distribution? [duplicate]

(I know there are existing questions on this topic, but none seem to be for commercial re-distribution use, so please keep this question active.) It seems there are many websites offering API for ...
Cool_Coder's user avatar
0 votes
0 answers
32 views

Define the supports and resistances [duplicate]

When I day trade, I easily notice support and resistance areas. Visually it seems very intuitive to spot them, but I can't define them so that I can spot them using python. Can you give me a clear ...
David's user avatar
  • 3
0 votes
0 answers
41 views

How to use GARCH/ARCH/EGARCH volatility forecasts to compare the Black Scholes constant volatility assumption with GARCH/ARCH/EGARCH volatility

I should preface this by saying I am an undergraduate physics student, this is more of a side interest to me, so I apologise if I am missing something obvious. I am not following a formal class or ...
probablysid's user avatar
0 votes
0 answers
35 views

Estimating Returns with the Non-Central t-distribution

The Boost C++ Libraries provide a set of statistical distributions in their Math Toolkit library. The best candidate I can find among those available that will capture skew and kurtosis typically ...
djhanson's user avatar
0 votes
0 answers
40 views

Hurst Exponent and Smoothed Hurst Exponent values are the same and incorrect plotting

I'm working on a script to calculate and plot the Hurst Exponent and Smoothed Hurst Exponent for a stock's historical price data using Python. When I run the script, I face two major issues: The ...
QuantDuckling's user avatar
4 votes
1 answer
270 views

Bartlett's delta gives wrong signs for calls and puts

There is a paper by Bruce Bartlett introducing a modified delta for SABR model which accounts for the correlation between forward and volatility processes. The main result of the paper is that if $dF$ ...
Hasek's user avatar
  • 699
1 vote
1 answer
98 views

How to calculate the discount factors for two deposits in an interest rate curve [closed]

I am trying to calculate the zero rate for a piecewise linear zero curve. I have the following deposit on the short end STIBOR 1D, is identified as a tomorrow next deposit: 0.02416 STIBOR 3 Month: 0....
Xiarpedia's user avatar
0 votes
0 answers
20 views

Free historical data for options [duplicate]

is there a way to get options historical data for free or for a cheap price, let's say 2 years at least for both EOD data and hourly ones for just one underlying instrument such as sp500? Or ...
fede72bari's user avatar
1 vote
1 answer
184 views

Python yield curve bootstrapping equivalent to Matlab IRDataCurve.bootstrap

I want to bootstrap the yield curve of multiple currencies using 3M futures. I have it implemented in Matlab, but need to transfer to Python. I have a vector of dates and a vector of future prices. ...
Afonso Batista's user avatar
0 votes
1 answer
67 views

Pricing a fixed rate bond with ex-dividend date in QuantLib Python [duplicate]

I'm trying to price a fixed rate bond with ex-dividend date using Python QuantLib. This is a feature of UK Gilts. On regular days, I'm able to get the correct accrued interest, but on days in the ex-...
thoughtnewbie's user avatar
2 votes
1 answer
305 views

Gamma for a basket option in Python - Finite Differences vs. AAD Autograd library using Heaviside Approximation

I have been trying to use the Heaviside Approximation for a simple basket option so that I can solve for Gammas with AAD (Adjoint Automatic Differentiation). This routine smooths the payoff function ...
Matt's user avatar
  • 139
1 vote
0 answers
87 views

Market impact power law fitting confusion

In many market impact papers such as "Anomalous price impact and the critical nature of liquidity in financial markets" by Tóth et al (2018), there is a standard power-law relation in the ...
des224's user avatar
  • 93
0 votes
1 answer
152 views

Does QuantLib have a DayCount convention that supports India financial year calculations?

I'm currently using QuantLib to perform financial calculations in my application, but I'm having trouble finding a DayCount convention that supports the India financial year calendar (April 1 to March ...
Roshan Yadav's user avatar
1 vote
1 answer
212 views

How to interpolate volatility's skew using spline in Python

I have two lists to describe the function y(x) that represents strikes and the relative value of the skew of a volatility surface: ...
Giovanni Venticinque's user avatar
1 vote
0 answers
47 views

Python Quant Lib - Bond Pricing ex coupon period [closed]

were wondering If anyone knows how to use rate bonds on Python Quantlib, that have an ex-coupon period. For example the link below shows the construction of such a bond in the c++ quantlib using ...
RD k3's user avatar
  • 11
1 vote
0 answers
76 views

Minimum transaction size for portfolio optimization with CVXPY

Long time reader, first time asker! I am working on a portfolio optimizer where I have a universe which is much larger than potential portfolio and where I want to exclude small transaction, i.e. a ...
herminat0r's user avatar
1 vote
1 answer
226 views

Basket option value calculation

I am reading the article, where different approximations for the pricing of basket options are presented. I have tried to reproduce the result obtained by the Gentle's method in Python. We define the ...
Nick's user avatar
  • 239
0 votes
0 answers
53 views

How to calculate forward swap curves for different tenors using QuantLib in python

I am interested in calculating the forward curve for different swap tenors. I have the below code in Python, but I believe that this only calculates the forward discount curve. Are we able to modify ...
Rob's user avatar
  • 1
0 votes
1 answer
93 views

Stock fades off all day [closed]

I have collected data to analyse statistically certain patterns. One of them gives me quite a high certainty it will fade off all day. Visually, when I observe a graph, it's straightforward if a stock ...
David's user avatar
  • 3
0 votes
0 answers
147 views

Quantlib: swap curve discount rate from spot rates

I'm new to Quantlib on Python and I'd like to use the overnight swap rate from Bloomberg to derive the swap curve discount factors. I don't know which yield term structure I should specify? I checked ...
sp1r0u's user avatar
  • 3
1 vote
1 answer
234 views

Getting incorrect options data with IB API. Missing real time market data subscription?

I'm having a problem getting options data with IB's API. The data seems not to be correct. In my code I'm getting some 0DTE call options for the Mini SP500 March Futures contract and printing their ...
rugobal's user avatar
  • 11
0 votes
1 answer
100 views

How would I find correlation / association of different time series datapoints with a target variable?

the title is a bit confusing. Functionally, I have a dataset of N stocks containing options information, short information, and earnings information for each of the N stocks. For each unique stock in ...
birdman's user avatar
0 votes
1 answer
201 views

Option Prices And Calibrating The Heston Model Code Question

I'm trying to understand this Python code that uses Quantlib to calibrate the parameters of the Heston model. The data that is provided in the code is the spot price, the risk free interest rate, the ...
Daniel Berkowitz's user avatar
0 votes
3 answers
156 views

Simulate from a SDE where drift and diffusion terms are matrices using Yuima in R

I'm trying to implement an SDE in R using Yuima. Most of examples and literature show how to implement and how the math works for SDE where drift and diffusion terms are scalar. What if I want to ...
Nic's user avatar
  • 1
1 vote
0 answers
45 views

Johansen Cointegration Test returns non-stationary error even though trace statistics suggest their existence

I'm working with Python and use the statsmodels.tsa.vector_ar.vecm.coint_johansen function to analyze if several stocks have a stationary error term with respect to ...
Marx's user avatar
  • 11
0 votes
1 answer
123 views

Forward pricing of cashflows with QuantLib - Python

I am building a tool with Quantlib (Python) to work on the forward pricing of different types of assets (inflation linked, amortizing, vanilla, zero coupon bonds). For a number of reasons I am using ...
peanut_butter_from_the_tub's user avatar
0 votes
1 answer
97 views

QuantLib: How to check or access the QuantLib version in conda prompt or spyder?

I didnt find the answer in QuantLib library. This will surely help to get the track of quantlib version and installed package versions.
robin's user avatar
  • 63
3 votes
3 answers
267 views

How to identify daily returns as an unusual daily return given a dataset

I am currently calculating daily returns of a stock with the following formula: $$R_t = \frac{P_t - P_{t-1}}{P_{t-1}}$$ However, once I have the data, I am unable to establish a range to classify the ...
FFFAR's user avatar
  • 33
1 vote
1 answer
466 views

Intraday (non-tick) Historical Data - Bloomberg Python API

Is it possible to get hourly or minute-by-minute data (in the form of a dataframe) in Python using one of the API wrappers (xbbg or ...
Student's user avatar
  • 151
0 votes
1 answer
90 views

Python Quanlib : yearFraction returns same number when I change the valuation date

I am completely new to python/coding so apologies in advance if the question is too basic but I could not find the answer elsewhere. I am trying to calculate the daycount fraction from the settlement ...
user58873's user avatar
0 votes
0 answers
82 views

Quantlib Piece-wise Heston for Monte Carlo Path Generation

I am trying to use a piece-wise heston to generate paths for a Monte Carlo Simulation. I create and calibrate a ql.PiecewiseTimeDependentHestonModel as in the example on the ql doc python site: https:/...
vman's user avatar
  • 31
1 vote
1 answer
110 views

Is this the correct discretisation of the Hull-White SDE for building a python model?

I've tried to build a basic one-factor Hull-White model using python, which I've done by trying to discretise the characteristic SDE. According to my notes, the Hull-White SDE is $$ dr_t = \alpha (\mu(...
J. Chapman's user avatar
0 votes
0 answers
71 views

Quantlib Monte Carlo using regular Volatility Surface, not Local Volatility surface

I am trying to run a Quantlib Python Monte Carlo simulation using either the ql.BlackScholesMertonProcess or the ql.GeneralizedBlackScholesProcess. I have a vol surface that I have generated using ql....
vman's user avatar
  • 31

1
2 3 4 5
22