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

Distribution of this test statistics

I am trying to implement this test statistics in MATLAB to inspect endogeneity between efficient price and sampling times . $$ \frac{\sum_{i=1}^{M_n} \bar{Y}_{(i-1)kn+1}\left(\bar\Delta_{(i-1)kn+1} - \...
XY0's user avatar
  • 37
2 votes
1 answer
58 views

QuantLib: Pricing BRL zero coupon swap using relevant attributes in Quantlib

I am trying to price the BRL zero coupon swap. As we know that ZC swaps fixed payer pays a single payment at maturity and the float payer pays the interim payments till maturity. So in this case, ...
John83's user avatar
  • 27
-2 votes
0 answers
39 views

Calibration of Heston model In Python [closed]

Has anyone seen Python code for Levenberg algorithm (Full and fast calibration of the Heston stochastic volatility mode)? Thanks in advance.
Анатолий Клим's user avatar
0 votes
0 answers
20 views

Searching for minute binned OHLCV Cryptocurrency data from 5 January 2018 to 7 September 2018

As the title states, searching for OHLCV data (USD) from the dates listed for these coins: [ADA, BCH, CVC, DASH, EOS, ETC, ETH, LTC, MANA, OMG, BCN, BTC, CND, DATA, ETP, GNT, NEO, NXT, QASH] I'm a ...
Jackson Thorn's user avatar
0 votes
1 answer
125 views

QuantLib: How to price or construct a zero coupon swap using Quantlib

I am trying to construct and price the zero coupon swap. However its giving me the AttributeError: module 'Quantlib' has no attribute 'ZeroCouponSwap'. Please let me know how to price the zero coupon ...
John83's user avatar
  • 27
1 vote
1 answer
101 views

Find the right module for CDI DI BRL swaps valuation Quantlib

I'm trying to find a way to price BRL CDI Swaps with Quantlib but I can't find any solutions so far - so I was wondering if anyone encountered this issue: I don't see any solution on Quantlib. I ...
Gloomy's user avatar
  • 21
1 vote
0 answers
77 views

Efficient Method of Moments(EMM) for Stochastic volatility model

We are attempting to calibrate the parameters of the Heston model via EMM on historical stock price returns. However, we are first trying a simple stochastic volatility model using EMM. We have come ...
AJ van Niekerk's user avatar
0 votes
0 answers
40 views

Lognormal-mixture dynamics and calibration to market volatility smiles

Can someone assist me in replicating the code and results from page 11, Figure 3 of the paper 'Lognormal-mixture dynamics and calibration to market volatility smiles' by Damiano Brigo, Fabio Mercurio, ...
BloomShell's user avatar
0 votes
0 answers
22 views

Implementations of stochastic collocation for Arbitrage Free SABR

I am currently reading this paper (link) on fitting arbitrage free parameters for SABR using stochastic collocation. Are there any publicly available github repos that implement solutions that are ...
user85127's user avatar
2 votes
0 answers
89 views

Antoine Savine's store

In his book "Modern Computational Finance, AAD and Parallel Simulation", Antoine Savine writes page 263 in the footnote : "We could have more properly implemented the store with GOF’s ...
11house's user avatar
  • 93
0 votes
0 answers
104 views

Simulating Hull-White Model in Python

I first simulated the short rate in the Vasicek model using the following code, which is equivalent to simulating the following normal distribution $r_{t} \sim N\left(r_{0}e^{-at} + b\left(1-e^{-at}\...
Guyon Van Rooij's user avatar
2 votes
1 answer
82 views

Uncertainty on volatility prediction using GARCH(1,1)

I have daily returns data and I predict the variance for the next day using GARCH(1,1) as follows ...
PhDStudent's user avatar
2 votes
2 answers
147 views

Extending/Subclassing QuantLib Classes in Python?

I'm using quantlib via the quantlib-python or open-source-risk-engine both on pypi. The question relates whether it's possible to extend QuantLib term structure base classes in python rather than C++....
Phil's user avatar
  • 123
1 vote
0 answers
30 views

Seeking a Model to Extrapolate Locate Fees for Short Selling in Absence of Historical Data

I'm in the process of developing an automated stock trading algorithm, with short selling being a significant part of the strategy. A key factor in deciding whether to short a stock is the associated &...
David's user avatar
  • 33
1 vote
1 answer
191 views

Python - yahoo finance options data - volatility smile plot

I have plotted the IV of TSLA options using yahoo options data, but the scatter plot doesn't look right, can anyone advise why the plot looks like this? I would expect to see a vol smile plotted. EDIT ...
Skittles's user avatar
0 votes
0 answers
20 views

Determining an Appropriate Locate Fee Threshold for Short Selling Based on Expected Return

I'm working on an automated stock trading program and often consider short selling as part of my strategy. For each potential short sale, there's an associated "locate fee" that I have to ...
David's user avatar
  • 33
1 vote
1 answer
51 views

replicating momentum strategy - Formation Periods

I am trying to replicate the momentum strategy of the study by Jegadesh and Titman (1993) onyl using data from the past 10 years.I am trying right now to calculate the formation period returns. But I ...
Vici's user avatar
  • 11
0 votes
1 answer
56 views

From OHCLV dataset to Tick Chart

We are all familiar with time-based candlestick charts, such as 1 Minut, 15 Minuts, 1 Hour and so on. The dataset is more or less something similar: ...
Bruce Ecurb's user avatar
0 votes
1 answer
97 views

Clustering of Maximum Drawdown Values in Monte Carlo Simulations (Jaekle & Tomasini example)

Hope this question isn't too naive. I've been trying to replicate the Monte Carlo method using sampling without replacement as described in the Jaekle & Tomasini book (Trading Systems: A New ...
djhanson's user avatar
0 votes
1 answer
115 views

Checking short term supply and demand in the stock market

I am implementing a pretty simple market making strategy. I want to see if the demand is higher than the supply in the short term so that I will be able to buy and sell decently fast. My goal is to be ...
David's user avatar
  • 103
0 votes
0 answers
32 views

Heston model using YUIMA package

I am trying to estimate a Heston model using the Yuima package, but i am in trouble. This is my script: ...
Luiz Araújo's user avatar
0 votes
0 answers
49 views

COS method for Wishart Heston Model

NOTE: This code is a piece of code I am using for a master's thesis, so I do not expect someone to do the work for me, but I gladly accept suggestions of any kind. However, I am trying to get the ...
SimoPape's user avatar
2 votes
1 answer
105 views

Characteristic Function for Wishart Heston Model

I don't know if this is the right place (at most they will close the post). Anyway, I am trying to implement the characteristic function of the Heston Wishart Stochastic Volatility model illustrated ...
SimoPape's user avatar
2 votes
0 answers
159 views

Best practices for building an FX volatility surface with Quantlib in Python

Generally my question is: what are best practices for building FX volatility surfaces with Quantlib? In FX options, I would like to price structures such as risk reversals, strangles and butterflies. ...
Wynn's user avatar
  • 95
3 votes
0 answers
148 views

Which C++ implementations of Levenberg-Marquardt does the "industry" use?

According to your various experience, is there an industry consensus about which C++ implementation of the Levenberg-Marquardt algorithm to use ? I came across two places where it was the C numerical ...
EricFlorentNoube's user avatar
0 votes
0 answers
52 views

Profit optimal algorithm for market clearing

There is a well known offline profit optimal algorithm for market clearing (matching buy-bids with sell-bids, visit for more details) which is based on bipartite weighted matching. This algorithm ...
Grigori's user avatar
0 votes
0 answers
80 views

Quanto CDS pricer in Python

I am sales and would like to grasp rough levels of quanto CDS, such as BMW denominated in USD, without askin traders each time. What i'm thinking is to calculte it using Python. But i cannot build up ...
neko's user avatar
  • 3
0 votes
0 answers
95 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
1 vote
1 answer
68 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
41 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
93 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
45 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
  • 548
3 votes
0 answers
227 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
63 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
236 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
97 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
101 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
214 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
2 votes
1 answer
101 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
47 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
153 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
56 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
197 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
1 answer
53 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
248 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
140 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
75 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
38 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
239 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

1
2 3 4 5
23