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
0answers
6 views

How to make set up the maximum likelihood for a GARCH-type of model

I'm currently working with the following GARCH process from Heston and Nandi (2000): \begin{align*} r_{t+1} - r_f &= \lambda h_{t+1} - \frac{h_{t+1}}{2} + \sqrt{h_{t+1}}z_{t+1} \\ h_{t+1} ...
2
votes
1answer
294 views

Generating surface of Kernel Density Estimates over time

I have a 1-minutely OHLC dataset indexed by time as follows: ...
0
votes
2answers
51 views

Black-Scholes Delta value at maturity?

Having to implement a replication strategy for European options, I encounter the following problem: Delta tells me how many shares to hold at time t in my replication strategy. To do so, I simply ...
0
votes
0answers
19 views

Charting & Trading platform with 3rd party integration

so it's 2020 and I'm surprised that there don't seem to be any platforms that provide clear and easy integration with a 3rd party backend for indicator/signal generation, charting, trade execution, ...
0
votes
1answer
29 views

Bootstrapping the 6m Sterling Libor curve

I am trying to bootstrap the 6m sterling swap curve using the depos and swap rates codes are below. I am a newbie and have been following (or at least trying to!) the python cookbook. I wanted to know ...
0
votes
3answers
91 views

C++ textbook recommendation for quants

I work as a Quant Dev at a financial institution where I'm mostly using Python for development and thus I have a few years of Python programming experience. I'm planning on learning C++ and therefore ...
0
votes
0answers
7 views

n-th to default swap with five reference names

I am pricing a nth to default swap with 5 reference names. I coded in R the following routine but it looks there is a bug or something that R cant read. Could anyone please help me to improve my Code ?...
2
votes
0answers
46 views

GARCH(1,1)-M MLE optimization with fmincon in R

I've searched thru dozens of papers and did not find in any of them satisfying and enough theoretical answers to my concerns. So I've combined everything what I found below. Please indicate if my ...
0
votes
0answers
17 views

best method for calculating dynamic hedge ratio between pairs?

I am relatively new to quantitative finance, and I would like to clarify something regarding the hedge ratio used in calculating the spread between the pair. using python Say I have time series <...
0
votes
0answers
23 views

What API to query to get the financial information of non US stocks?

I am reaching some API in order to get a few information necessary to know which ones are suitable for a defensive investor strategy from 100 tickers worldwide that you can download here. However it ...
1
vote
2answers
38 views

QuantLib : How to get the 'last' and 'next' cash flow date and amount from the date of valuation in plain vanilla interest rate swap in Python?

Do we have any direct method to get the 'last' and 'next' cash flow date and amount from the date of valuation in Quantlib Python using fixed leg amt or floating leg amt, day counter,valuation date , ...
0
votes
0answers
14 views

Theta function in the Black Karasinski model to replicate the current yield curve?

I am trying to replicate a research paper "Gas Storage valuation using a Monte Carlo method" Gas storage valuation using a monte carlo method which is to me a not very complex but technical ...
0
votes
1answer
23 views

Pricing Compound Options using QuantLib

I am trying to price Compound Options using QuantLib on Python. I've looked around but am unable to find any sample code. I believe that the CompoundOption Class ...
0
votes
0answers
17 views

What are the API to get the key statistics (sales, dividends, earnings …) for any company on any tradable stock markets?

I am looking for an API that would help me do the analysis Graham provides for most Stock markets of the world in order to know which are the eligible stocks. So far I am doing it by hand with ...
0
votes
0answers
23 views

Correct labelling for trading strategies

In trying to build a ML powered trading strategy, one of the most important tasks is to correctly label the data so that the results of whatever classification algo you are using will be properly ...
0
votes
0answers
18 views

Why does real time tick data have to go through a Dataprovider to Business/Consumer?

So the data-flow for real-time tick data as I know it is from Exchange --to-- Dataprovider --to-- Business/consumer; but I want to understand why that dataprovider is necessary? I am full of fair ...
1
vote
1answer
60 views

How do I create a term structure of a bond using QuantLib?

Has anyone used QuantLib to create term structure (i.e bootstrapping process to produce spots) in python? I have been using the below example http://gouthamanbalaraman.com/blog/quantlib-term-structure-...
4
votes
1answer
598 views

Optimal Portfolio from Efficient Frontier

I found this code on plotly site, using CVXOPT to find the efficient frontier, and then, the optimal Portfolio. The optimal function is ...
2
votes
1answer
31 views

Pricing options using the IG component GARCH model of BCHJ(2018)

Babaoglu, Christoffersen, Heston and Jacobs (2018) introduced a component GARCH model with inverse Gaussian innovations and an exponentially quadratic pricing kernel back in 2018. The article shouldn'...
9
votes
3answers
905 views

Identify Iceberg Orders

What would be the best algorithm to identify Iceberg Orders? I have found one in the paper "The Impact of Hidden Liquidity in Limit Order Books" by Stefan Frey and Patrik Sandas, but I was wondering ...
1
vote
1answer
118 views

Which Maximum Diversification Approach in MATLAB is correct?

I am currently trying to find the portfolio weights of the Maximum Diversification Portfolio and found two approaches which result in different outcomes. The first one is based on this paper:https://...
0
votes
0answers
18 views

Heston volatility surface in Python QuantLib

Does anyone have experience with the Python QuantLib function HestonBlackVolSurface? I'm trying to produce a 3D plot of the volatility surface as done in the ...
1
vote
0answers
31 views

What is a call-spread and its formula?

I am attempting Mark Joshi's The Concepts and Practice of Mathematical Finance. In B.3 Project 1: Vanilla options in a Black-Scholes world, he asked the following question. We need to be sure that ...
0
votes
0answers
28 views

Can someone show me an example of retrieving ticker data by the minute in python?

Can someone show me an example of retrieving ticker data by the minute in python? I am new to python and trying to retrieve stock data by the minute for a stock. Id
3
votes
1answer
116 views

evaluating garch models

I used ugarchroll to backtest my garch model on S&P returns this is my code ...
1
vote
1answer
208 views

Is my python solution good? : Global Minimum Variance portfolio with 'no-short sale' constraint

Question Is my python code an answer (at least a close answer) to get the weight vector of the Global Minimum Variance portfolio problem? My codes are shown below after some explanations. Details ...
0
votes
0answers
39 views

Two- (multi) dimensional geometric Brownian Motion

I am trying to calculate the value of a Basket Option with two stocks and the following information: S1 = 100, S2 = 120, r = 0.06 L = Volatilitymatrix = ((0.3, 0.1), (0.0, 0.2)), weight of Stock 1 = 1/...
0
votes
0answers
29 views

Quantlib : How does interpolation technique in zero curve improve the valuation of interest rate swaps?

I am working on building zero curve using interpolation = ql.Linear(). I know that this method is very popular to build short and long end curve. But am wondering if there is any another way of ...
1
vote
1answer
801 views

How to efficiently get covariance matrices from a rolling window in Matlab?

I'am trying to produce a rolling window to estimate a covariance matrix using a for-loop. I have my returns under the variable returns_sec and I have 260 ...
3
votes
1answer
70 views

Quantlib - exercise probability function?

I am using Quantlib to obtain the option value embedded in a convertible bond. I create an american option as follows: ...
0
votes
0answers
27 views

Discretizing Bates SVJ Model to simulate paths

I am trying to simulate a path for Bates Stochastic-Volatility-Jump model. It has the following dynamics: I've managed to implement the Heston model by following Gatheral's books the Volatility ...
2
votes
1answer
79 views

R: Finding peaks on a stock price chart

I would like to do is what I thought to be a simple task: find the locations of peaks for a certain stock, and mark those peaks on a chart. I was surprised by a lack of appropriate examples on the ...
0
votes
0answers
29 views

Evaluating Markov switching garch models with R

Hello I have been working on a Markov switching GARCH model my intention is to use it to trade options volatility . I have created a Markov switching garch model using the MSGARCH package in R and in ...
0
votes
2answers
88 views

Calculate intermediate highs and lows given a minimum price movement threshold

I'm looking to get the high and low reversals/pivots in a price series given a minimum price movement threshold and wondering if there are any existing python libraries that can do this. Essentially, ...
0
votes
1answer
47 views

Is there something for API trading in E-mini S&P 500 Futures or other futures

I found a lot of results about data feeds, and I found some platforms (like Alpaca) for API trading. But none seem to have the possibility to sell/buy futures via a REST API. So my question is: Who ...
9
votes
5answers
12k views

How to learn QuantLib-python at first?

In my project, I have to get the delta of up and out call option (with vol surface). I found out that QuantLib might help me on that. Since my main language is python and I don't know well about C++, ...
0
votes
0answers
27 views

R-Help..Question regarding working day Frequency in Time series

I have a data where there are observations based on working days in a year. The working days are not same in each year. These are 248 (say in 2018) observations in first year and then may be 246 ...
0
votes
1answer
67 views

Orderbook db structure

I am currently saving a sub 1 sec snapshot of an orderbook to my SQL db. However I have quite the trouble on figuring out the architecture of this DB What I'm currently doing is saving a table with ...
1
vote
1answer
56 views

Appropriate Encoding for Stock Technical Indicators ? RSI

happy new year and i am new to machine learning + python.. so recently i am doing a project on my own to use machine learning models on technical indicators.. I have my technical indicators data ...
0
votes
0answers
20 views

TFX(R Interface to the TrueFX) does not work properly

There's an R package for retrieving FX rates from TrueFX in the Cran but it does not work properly. In the tutorial here, it is said that the following will return the prices as shown below. But ...
0
votes
1answer
75 views

Python Quantlib : How to value the Non Deliverable currency Interest Rate Swaps?

I followed all the procedure in Quantlib to process interest rate swap valuation through Python Quantlib. I valued more than a million records. All the valuation is almost the expected amount. But '...
1
vote
1answer
93 views

Error in QuantLib-Python when I use function “Bond”

I am using the "Bond" function in QuantLib-Python 1.14. I am planning to use it in this way: ...
0
votes
1answer
58 views

QuantLib Error “=negative probability”

I am trying to calculate the price of an american option. The code works fine for some options but for an deep out of the money call, I get the above error. Below is my code that I am trying to run. ...
0
votes
1answer
79 views

Numerical simulation of Bates model (Monte Carlo)

I'm trying to build Bates model in Python! $$dS_{t} = \mu S_{t} dt + \sqrt{V_{t}}S_{t}dW_{t}^{1} + J_{t}dQ_{t}$$ $$dV_{t} = \kappa(\theta - V{t})dt + \eta \sqrt{V_{t}}dW_{t}^{2}$$ $$dW_{t}^{1}dW_{t}^{...
0
votes
1answer
76 views

Calculate return for a set of securities downloaded using quantmod

I downloaded adjusted closing price using quantmod for a set of securities. I want to calculate daily/weekly/monthly return for all securities. Usual dailyReturn, weeklyReturn etc not working. What do ...
0
votes
0answers
109 views

Pnl Explanation using R (blotter)

I have a portfolio of stocks based on a proprietary strategy. I would like to explain the Pnl over a period, for example I would like to find the pnl contribution of each name of the period. Is there ...
0
votes
1answer
113 views

How to extract standard deviation from normal distribution in R

If I have some point forecast and an 80% confidence interval, with the forecast assumed to be normally distributed with a constant variance, how do I extract the actual variance? Let us work with the ...
0
votes
0answers
25 views

How to obtain tangency portfolio of the resampled efficient frontier in MATLAB?

I have generated the resampled frontier according to Michaud's approach. In order to compare it with the classical mean variance approach I want to invest in the respective tangency portfolios. While ...
1
vote
1answer
619 views

Calibration of Theta, A(t) and B(t) of Hull White 1Factor model

I’m simulating interest rates via the HullWhite One factor model. To simulate the short rate I’m using the code from the Quantlib Python Cookbook, chapter 15 and beyond (By Goutham Balaraman and Luigi ...

1
2 3 4 5
25