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
2
votes
1answer
308 views

Generating surface of Kernel Density Estimates over time

I have a 1-minutely OHLC dataset indexed by time as follows: ...
0
votes
2answers
82 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
32 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, ...
1
vote
3answers
153 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
37 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
86 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
18 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
32 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
21 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
44 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
19 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
78 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
630 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
52 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
964 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
131 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://...
1
vote
0answers
32 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
29 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
127 views

evaluating garch models

I used ugarchroll to backtest my garch model on S&P returns this is my code ...
1
vote
1answer
322 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
50 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
68 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
910 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
92 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
38 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
95 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
38 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
94 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, ...
11
votes
5answers
13k 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
32 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 ...
1
vote
1answer
92 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 ...
0
votes
0answers
22 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
225 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 '...
0
votes
1answer
62 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
90 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
0answers
114 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
117 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
35 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
161 views

QuantLib returns slightly different bondYield when backtested

I am just starting to get familiar with QuantLib (in particular, fixed rate bond pricing functions). I read a number of examples, from which I am able to calculate bond price and bond yield. The ...
0
votes
0answers
69 views

Quantlib - Duration of a Floating Rate Bond with Spread

I've used Luigi Ballabio's workaround to calculate the duration/modified duration of a floating rate bond (which you can find here: https://www.youtube.com/watch?v=r_1wSd0hnN4). However, if I add a ...
0
votes
1answer
50 views

Why does changing the evaluationDate multiple times lead to a performance lag?

I am simulating an swaption strategy through time. Following the examples in the Python Quantlib cookbook, as I progress through time I am updating the internal evaluation date ...
3
votes
2answers
1k views

SVCJ (SVJJ) Duffie et. al Model implementation in Matlab

I'm attempting to implement aforementioned SVCJ model by Duffie et al in MATLAB. so far without success. It's supposed to price vanilla (european) calls . parameters provided, the expected price is: ~...
-4
votes
1answer
337 views

Why I can't append a string to a empty list? [closed]

Why I can't append a string to a empty list in Python? For example: lista_arg= list() arg="Nome" lista_arg= lista_arg.append(arg) I get this error: ...
5
votes
2answers
4k views

Programmatically detect RSI divergence

How can I programmatically detect bullish and bearish RSI divergences? A bullish divergence occurs when the underlying security makes a lower low and RSI forms a higher low. RSI does not confirm the ...
2
votes
1answer
83 views

SquareRootProcess in QuantLib - Python

I would like to price an American put option using the SquareRootProcess class in QuantLib - Python but it seems that it does not exist. As the underlying follows the following model : $$\rm{d}S_t=...
0
votes
2answers
127 views

Why doesn't tenor of Euribor index change spot rate in Quantlib?

I'm trying to create a yield curve in QuantLib based on swap rates. The swap rates I'm using have a 6 months fixed frequency and a 3 month float frequency based on LIBOR. What I don't understand is ...
4
votes
2answers
349 views

Valuing structured loans in QuantLib

I'm trying to figure out if it's possible to value structured products, mainly loans, in quantlib. The idea is to build a bond class with different cash flows. For example, a loan could have coupons ...

1 2 3
4
5
27