# 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.

433 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
331 views

### Problems in computing VaR with GARCH-GPD-copula approach

I use a time-varying Gaussian copula (with GARCH-filtered standardized residuals modeled semiparametrically with Gaussian kernel interior and GPD tails, i.e. generalized pareto distributed) to ...
• 449
2 votes
0 answers
70 views

### False warning messages in R, is it possible?

I'm modeling GARCH-filtered standardized residuals via semiparametric distribution with Gaussian kernel and GPD (generalized pareto distribution) tails with thresholds at 5% and 95%. For some series I'...
• 449
2 votes
0 answers
171 views

### Monte Carlo approach to RAN bonds in Quantlib or suggestions

This is a problem from Schlogl's book in the chapter on the HJM model: Price option of the RAN instrument with 3 month coupons and maturity 3 years using Monte Carlo(Exercise 4 Range Accrual Note). ...
• 181
2 votes
0 answers
734 views

### Backtesting Long/Short Market Neutral Z-Score Strategy with Custom Factors and Custom Stock Universe

So I've managed to backtest simple strategies, like MA, RSI and some fundamental ones (P/E ratios etc) but Im stuck at my last strategy. Here is some information: Tools: Excel and Python (also a ...
2 votes
0 answers
170 views

### Using Market Prices of Bonds to Model the Discount Curve with a Polynomial (Math + R)

I have a small program I'm building to interpolate the discount curve from a portfolio of benchmark bonds. If anyone has any guesses as to whether it's my process, or my code that's messed up I would ...
2 votes
0 answers
886 views

### Johansen cointegration test interpretation in R

I want to test my time series for cointegration using the Johansen test in R. I got the following result and so I know now that at least 5 out of 9 of my time series are cointegrated. My question is, ...
• 21
2 votes
0 answers
157 views

### Interpreting different factor models w.r.t. correlation matrix and min variance portfolio weights

Background In Eric Zivot's analysis of factor models he uses three models The sample (.sample) Single index model (.si) Barra factor industry model (.ind) PCA model (.pca) You can download his ...
• 233
2 votes
0 answers
734 views

### backtest asset allocation strategies

I've searched the site but haven't found an easy way to backtest my personal portfolio allocations. Suppose I want to know the total return for the following portfolio from Jan 1, 2009 to Dec 31, 2014:...
2 votes
0 answers
2k views

### How to fit a VAR + GARCH in R

I should create a VAR model with Garch error in R but i don't know how to do it and which package to use. The Vector Autoregressive model (or VECM) should also have covariates in it. Then I should ...
• 21
2 votes
0 answers
299 views

### What is the best open source automated trading platform or options?

I would like a custom C++ Automated Trading Platform for Futures like Multicharts, or similar automated trading platform that I can put on my servers so its secure and fast. I have found this so far, ...
• 21
2 votes
0 answers
437 views

### Downloading IB futures data and then making a datapump to another program

I never have programmed before in my life but I wouldn't mind learning if I knew what i needed to do in order to solve my problem. I use neuroshell for day trading and use it extensively for trading ...
2 votes
0 answers
230 views

### Liquidity Adjusted Asset Pricing Model

I have a data set with 4000 companies and I have calculated a liquidity measure of each of the company in the dataset as Where, Turnover is the monthly average ratio of daily volume to shares ...
• 83
2 votes
0 answers
288 views

### Behaviour of out of sample efficient frontier

I am comparing the efficient frontier of a set of portfolios that are in and out of sample. The first period is from 1991-01-03 until 1992-10-03 and the second one from 1992-10-03 until 1994-03-03. I ...
• 189
2 votes
0 answers
664 views

### Gaussian Time-varing copula in R

I want to estimate the parameters of time-varing Normal Copula using R. A bivariate Normal copula is defined as following: The dynamic equation of dependance parameter ρ is : So I need the identify ...
2 votes
0 answers
867 views

### More cache friendly linked list or alternative with optimal append, delete, and ordered traversal for limit order book?

I am trying to implement a stock matching engine/order book in C++, and am searching for a more cache friendly architecture. Currently, my data structures are as follows: An intrusive rb-tree for the ...
2 votes
0 answers
233 views

### Issues with +100 symbols in Quantstrat, Erratic Trades

I've tested my code against individual symbols and very small groups of symbols. I'm finding the more symbols I add the fewer trades I get. For instance, if I just include the first five symbols, all ...
• 121
2 votes
0 answers
1k views

### Forecast of ARMA-GARCH model in R

I managed to forecast a GARCH model yesterday and run a Monte Carlo simulation on R. Nevertheless, I can't do the same with an ARMA-GARCH. I tested 4 different method but without achieving an ARMA-...
• 21
2 votes
0 answers
2k views

### Simulation of Heston process

I am currently working on implementing Heston model in matlab for option pricing (in this case I am trying to price a European call) and I wanted to compare the results I obtain from using the exact ...
• 71
2 votes
0 answers
126 views

### Problem with Naive Bootstrapping (US Government Bonds)

I am using the formula here to determine the discount factor function and eventually the zero-coupon yields. I get the data for Coupons, Face Values and Closing Prices from Thomson Reuters, which I ...
• 895
2 votes
0 answers
531 views

### Can you tell me what this RBloomberg formula means?

I've been asked to re-create a spreadsheet that used RBloomberg using a different data source. But I'm having trouble figuring out exactly what one of the spreadsheet's formulas does. Can anyone tell ...
2 votes
0 answers
539 views

### Initial values for Heston Model calibration

I'm doing a Heston model in Matlab using simple Monte Carlo simulations (5.000 paths and 2 steps per day, simulating 360 days). When I try to calibrate the Heston parameters using fminsearch it takes ...
2 votes
0 answers
137 views

### How to estimate constrained a constrained VAR(1) with MATLAB?

Suppose I want to estimate the following VAR(1) model: $$Y_t = \mu + \Phi Y_{t-1} + \varepsilon_t$$ where $Y_t=(y_{1t}, y_{2t},…,y_{kt})'$, $\mu=(\mu_1,…,\mu_{k})’$ and $\Phi$ a matrix of ...
• 1,886
2 votes
0 answers
262 views

### Ibrokers: reqMktData extremely slow when adding tickers

I am trying to snap prices in R for the latest price for a list of stocks (around 150). When I snap them for 2 stocks, it's almost instantaneous: ...
2 votes
0 answers
522 views

### Stationarity tests in the frequency domain for regression

Strict stationarity is the strongest form of stationarity. It means that the joint statistical distribution of any collection of the time series variates never depends on time. So, the mean, variance ...
• 436
2 votes
0 answers
298 views

### trading strategy outperforms passive strategy in absolute terms, but in returns vice versa. how could this be?

Background: I want to compare two trading strategies in term of profitability. The red one is an active trading strategy, which involves many entry and exit to a specific market. The blue one is a ...
2 votes
0 answers
1k views

### fetch from yahoo! finance database - varying number of ticks

To test a model with real-life data, I used the fetch-function in matlab to connect to the database of yahoo! finance. My code to try and get 7 different assets' returns is the following: ...
• 519
2 votes
0 answers
151 views

### How to simulate a Geometric Binomial Process with state/tie dependent increments?

I want to simulate a geometric binomial process with state/time dependent increments. So the model is given by \begin{align}R_t=\frac{X_t}{X_{t-1}}\end{align} \begin{align}P(R_t=u)=p(X_{t-1},t) \...
2 votes
0 answers
1k views

### Interpolate option volatility in delta space in R

I have a bunch of deltas and option implied vols at those deltas. I would like to interpolate them in R. Interpolating them in delta space seems difficult, since normally you would like the ATM calls ...
• 153
2 votes
0 answers
729 views

### portfolio optimization with a loop

I am attempting to minimize the variance of a 3 stock portfolio using optimization within a loop. What I have done is calculated the stock returns and cov matrix from dates 1980-01-01 to 1989-12-31 ...
2 votes
0 answers
230 views

### Looking for FpML best practices

We want start using FpML within our organisation; where message will be sent using FpML. What are best practices to do this ? If anyone who have used Tools as well as; i want to use FpML for ...
• 141
2 votes
1 answer
881 views

### How to extract sentiment from Yahoo finance message board?

Does anyone know if it is possible to write a software to pull Yahoo message board sentiment for a specific stock? Any API from Yahoo or anyone has done it before?
• 153
1 vote
0 answers
67 views

### QuantLib: Latin American FixedFloat Swap pricing with multiple payment frequency specification

With reference to the post of latin american swap, I am valuing the FixedFloat CLP swap.The specifications of this swaps has payment frequency upto 18 months as Zero coupon(1T) and after that ...
• 37
1 vote
1 answer
105 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 ...
• 21
1 vote
0 answers
80 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 ...
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 &...
• 33
1 vote
1 answer
198 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 ...
• 33
1 vote
1 answer
54 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 ...
• 11
1 vote
1 answer
63 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 : ...
1 vote
0 answers
75 views

• 11
1 vote
0 answers
43 views

### Fitting model between security price and intraday volatility

I'm trying to construct a model which shows how much the closing price of a security ($P_t$) differs from the VWAP of that security on that day ($VWAP_t$). I'm calling this measure the "VWAP ...
• 118