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
3 votes
0 answers
479 views

What R-packages for SOCP problems are there?

Currently, I am looking deeper into the topic of second-order cone programming. Could you suggest packages that solve SOCP-problems in R? With your answer, please provide a short description of ...
vanguard2k's user avatar
  • 2,915
3 votes
0 answers
2k views

Philips-Ouliaris test for cointegration

I'm trying to implement cointegration tests using the R urca package. I've figured out the Johansen test (ca.jo), but I'm having trouble with the Philips-Ouliaris test (ca.po). I have two questions: ...
anonymous's user avatar
3 votes
0 answers
247 views

What does negative gamma mean in APGARCH model?

I got a gamma of -0.1321677. ...
user5116's user avatar
3 votes
0 answers
3k views

Backtest pair trade strategy in R

I am looking for some tips on how to run a simple backtest on a pairtrading strategy intraday using eg. 30minute bars. I have calculated the spread, ...
nikke's user avatar
  • 39
3 votes
0 answers
389 views

How to balance two Forex crosses correctly to do a linear regression?

I have two cross and an account in EUR: EUR/USD GBP/USD I would like to do a balanced linear regression using R. With "balanced" I mean that I would like to normalize it by calculating the ...
Dail's user avatar
  • 389
2 votes
0 answers
90 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
2 votes
1 answer
95 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
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
2 votes
1 answer
143 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
2 votes
0 answers
109 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
2 votes
0 answers
124 views

QuantLib option.NPV() returns interpolation error

I've been trying to price some barrier options with a Heston model on Quantlib and it works quite well most of the times, but sometimes I get the error: "interpolation range is [3.4314, 4.28384] ...
gibster's user avatar
  • 21
2 votes
0 answers
144 views

option pricing using empirical distribution

I am looking for ways to express a directional bet on a commodity through futures options. Assume that there's 50% probability that oil will spike up 100% in the span of 30% during the next 9 months ...
Spasski's user avatar
  • 21
2 votes
0 answers
83 views

CRSP Permco Aggregation

I saw that for one CRSP Permco, there could be multiple CRSP Permnos. Could anybody provide guidance on how to aggregate the market capitalization, returns, etc... by permco and date? I am currently ...
Guyon Van Rooij's user avatar
2 votes
0 answers
428 views

Interesting finding... "Adjusted Kirk's" and "Bjerksund-Stensland" are exactly the same ??? Spread option calculation

This is more of an academic question. The results are SO close, I think they are ACTUALLY THE SAME FORMULAS. So someone published a paper with a "new" method to adjust Kirk's formula to ...
Matt's user avatar
  • 139
2 votes
1 answer
588 views

TradingView STC vs any python STC

I am trying to use in a trading strategy the STC indicator, but I can not find out why its not working properly. The chart that I am using is BTC/USDT on UTC as a timeframe. Chart time: 01 Feb 22 - 16:...
Mircea's user avatar
  • 141
2 votes
0 answers
96 views

Free paper trading with api

Im currently using Alpaca but I want to switch the service since it had some major outages. Does anyone know a good reliable free broker with paper trading and api so I can test my trading bot. Thanks
luis's user avatar
  • 21
2 votes
1 answer
314 views

Actual360 convention in quantlib schedule

I'm trying to make a payment schedule for different bonds in quantlib. For example, I made such a schedule: ...
Igor Igor's user avatar
  • 193
2 votes
0 answers
176 views

Fitting ARIMA + GARCH in R

I'm forecasting Electricity consumption Data. I have data for one year , so for every 15 minutes there is an observation. My data contains seasonality and I don't know how to fit SARIMA + GARCH into R,...
kim.c's user avatar
  • 21
2 votes
0 answers
57 views

Approximating second derivatives at boundary of finite difference scheme

The Question I am implementing a finite difference scheme for the Heston-Hull-White PDE: \begin{align} \frac{\partial u}{\partial t} &= \frac{1}{2}s^2v\frac{\partial^2 u}{\partial s^2 } + \frac{1}{...
user59093's user avatar
2 votes
0 answers
378 views

Are there any public implementations of realized kernels? (preferably in Python)

looking to implement a realized kernel model to forecast realized variance of around ~140 equities and indices in Python given order book data. I have read "Realised Kernels in Practice: Trades ...
Kareem Sayed's user avatar
2 votes
0 answers
167 views

How to identify active vs inactive ISINs?

Background I understand that through the work of ANNA and GLEIF, the relationships between ISINs and their respective LEI (Legal Entity Identifier) are now more accessible. GLEIF API Lookup To lookup ...
paulkmoore's user avatar
2 votes
1 answer
618 views

How to calculate basic components like trend, momentum, correlation and volatility in Pandas(Python)

I am new to quant. finance and trying to calculate trend, momentum, correlation and ...
DDStackoverflow's user avatar
2 votes
0 answers
172 views

GARCH Option Pricing in R

I am trying to code a GARCH option pricing model in R. I am still new to R so this does seem a bit complicated. I want to estimate an asymmetric GARCH model as well as an EGARCH model. This I have ...
August's user avatar
  • 61
2 votes
0 answers
136 views

HNGARCH Option Pricing in R (How to loop)

I am having difficulties when using the HNGOption program in R. The program will only run for 1 specific option price, meaning that I would have to manually insert strike price etc. and this would ...
August's user avatar
  • 61
2 votes
0 answers
230 views

Implementing a Variance Swap Hedging in R

I am trying to compute a hedge for a variance swap, in a simulation. Fo that I am using the following equation:\begin{align*} E^Q\bigg(\sum_{i=1}^n \bigg(\frac{S_{t_{i}}-S_{t_{i-1}}}{S_{t_{i-1}}}\bigg)...
Pedro Gomes's user avatar
2 votes
1 answer
1k views

Is alpha vantage api for fundamental data reliable?

Can anyone speak to the reliability of the Alpha Vantage (AV) api for fundamental stock data? I have tried for a couple of stocks to get balance sheet data, and it seems close to accurate but I feel ...
Chris Kiniry's user avatar
2 votes
0 answers
195 views

Can genetic algorithm help in portfolio optimisation when convexity is not verifiable

I have the following portfolio cost function to maximise: $$ w^T\mu-\frac{1}{2}\gamma w^T\Sigma w+\frac{1}{6}\gamma^2 w^TM_3(w\otimes w), $$ which considers the co-skewness ($M_3$ tensor), $γ$ is the ...
Luigi87's user avatar
  • 326
2 votes
0 answers
178 views

Pricing American Options by Neural Networks

Has anyone read the paper 'Pricing of High-Dimensional American Options by Neural Networks' by M. Kohler et al. (2010) and tried to program the proposed method in Python? I have been trying that for ...
Peter's user avatar
  • 63
2 votes
0 answers
109 views

machine-learning method to predict PCA weights

I have been using certain linear-regression to extract the PCA (top 3) weights relating to a certain data-set. I was wondering, instead of using linear-regression to generate the weights, I can use ...
Kiann's user avatar
  • 622
2 votes
0 answers
172 views

Finding Jump Probability For Time Series Data

I'm relatively new here, so if it seems like I'm asking a bad question, go easy on me. So I was looking at the Merton Jump Diffusion Stochastic Model on Turing Finance's article. Instead of creating ...
Kivo360's user avatar
  • 121
2 votes
0 answers
279 views

Mixed-Frequency VAR -packages

My intention is to retrieve forecast error variance decomposition from a MF-VAR with no latent processes following Ghysels (2012) https://www.hec.ca/finance/seminaires/Ghysels.pdf I found the ...
femma's user avatar
  • 29
2 votes
0 answers
87 views

Backtesting :: Migration to Simulated / Real-Time Trading

I am relatively new to backtesting and I want to migrate my system to simulated trading via Amibrokers Interactive Broker's API. What I have been doing is setting trade delays such that when a Buy or ...
PiE's user avatar
  • 121
2 votes
0 answers
502 views

Binomial Model Implementation Trouble - American and European options come out equal

I'm Trying to implement the binomial option price model in python and get reasonable performance by using memoization. I checked the output against a black and scholes model and for European options ...
user38310's user avatar
2 votes
0 answers
310 views

QuantLib - Synthetic deposit/FRA rates in yield curve

In my flat forwards dollar curve implemented in QuantLib I would like to add the following instrument: Today is 12/28/2018 Pillar quote is 1% p.a. (ACT/360) Pillar start is 1/30/2019 (specific ...
Michael Lowenstein's user avatar
2 votes
0 answers
73 views

IBrokers: How to assign trail amount for order type 'TRAIL'?

I'm using R package IBrokers with IB TWS. I'm trying to create a twsOrder object using twsOrder function: twsOrder(...., orderType = 'TRAIL', ...) How can I ...
Deb's user avatar
  • 21
2 votes
0 answers
163 views

Generating Correlated Quasi Random Numbers

Hi I am trying to generate correlated quasi random numbers using a sobol sequence in matlab. My Problem is the Following: Using "standard" random numbers it is easy to generate the 6 correlated random ...
Vanity's user avatar
  • 165
2 votes
0 answers
612 views

Binary Options: convert from "Cash or Nothing" to "Asset or Nothing"

I have a formula that uses Black-Scholes to compute the implied pricing of a "Cash or Nothing" binary option on the price of a currency. The option is priced/traded in the same currency as S, K and ...
Snapula's user avatar
  • 113
2 votes
0 answers
58 views

Custom Frequency termstrc Package

Termstrc package in R by default uses yearly coupon frequencies. Dataset i am working with is semi-yearly coupon bonds. Here are the variables it takes into the model ...
Dhruv Mahajan's user avatar
2 votes
0 answers
75 views

Dividing H in the Hurst power law function to get the Hurst exponent?

For my own learning I have been following the guide here. It is highly instructive. Implementing this in R I was able to reproduce the authors results on the data sets provided within some ...
user avatar
2 votes
0 answers
292 views

Strange trading data coming from bitstamp

Through researching order execution algorithms I came upon something rather strange. My dev team wrote a program that captures live bitcoin trades on bitstamp through the WebSocket API for a single ...
xxen0nxx's user avatar
2 votes
0 answers
444 views

Quasi Monte Carlo method and Heston model

I want to run a quasi monte carlo simulation for Heston model in matlab. Obviously there exists a lot of literature regarding the theoretical aspects of the topic, for example by Baldeaux and Roberts, ...
Paul's user avatar
  • 21
2 votes
1 answer
196 views

Seeking data source for index constituents and changes

I need to find a definitive list of US and UK index constituents. I'm currently monitoring S&P100, S&P500, DJIA, FTSE100, FTSE350 etc. and curating the list manually, which is causing problems....
Simon's user avatar
  • 121
2 votes
0 answers
707 views

Estimating parameters of the Cox-Ingersoll-Ross model using CLS in R

I'm working on a project where I need to estimate the parameters of the CIR model. In the particular case, the CIR model is used to model cumulated capital calls for a private equity fund. The data ...
Kristian K Larsen's user avatar
2 votes
0 answers
66 views

Goodness of fit test for time varying copulas

I am looking for Matlab or R codes for goodness of fit test of time varying copulas. I am able to calculate AIC for them using the Patton copula toolbox, but i want to do goodness of fit test using ...
user28128's user avatar
2 votes
0 answers
209 views

python and quantlib - setting futures priority

In setting up a curve using deposit rates and futures in python, is there a trigger which allows one to set when the futures start? Looking for something similar to ...
jonmaestro's user avatar
2 votes
0 answers
479 views

VARMA GARCH modelling in R

I want to simulate a VARMA-GARCH process in R. Unfortunately, I found no package to help me with that. I tried modelling the MGARCH part on itw own and combine it with the VARMA simulation using MTS ...
user26989's user avatar
2 votes
0 answers
68 views

Spurious regression between two futures with the same underlying highly correlated (cor=0.9)

analyzing the correlation between soybean and soybean meal futures in ECBOT, and making a linear regression in R between them I check with an ADF Test that the residuals are not stationary, so ...
Gonzalo Federico's user avatar
2 votes
0 answers
869 views

Problem with R code, with option pricing

I have a problem with my R code not producing accurate results. I am trying to implement the Carr-Madan approach to option pricing, using the Black-Scholes model. The formula can be found in equation (...
user26604's user avatar
2 votes
0 answers
723 views

Optimal weights for portfolio optimisation (r)

The question is what R optimization could be applicable to find a vector of weights that when, multiplied by S matrix creates equal rows sums, and when set in the objective function returns the ...
user2948605's user avatar
2 votes
0 answers
161 views

How to reset indicators in quantstrat / quantmod?

I am currently trying to back test a strategy on a file which contains minutely data for the whole month. I would like to reset my indicators at 3:30 PM . Is there a way I can reset the indicators ...
Yatharth Narang's user avatar

1
2
3 4 5
9