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.

8
votes
3answers
2k views

Automated 10-K XBRL data grab using the SEC file structure

I would like to write a program that takes as input a list of CIK/year/quarter entries. The program should iterate through the list and, for each entry, grab XBRL financial data from the SEC website ...
5
votes
1answer
693 views

Vasicek yield curve

Term structure is determined by a two-factor affine model (Vasicek). Using the monthly swap market data, we fit the model to match exactly the one-year and ten-year points along the swap curve ...
-2
votes
1answer
232 views

Is R suited for a Quantitative Finance executable application

I wonder if a R-Shiny application works well for a production environment or the only option is C++. I make this question taking in account that R and C++ have a widely set of quant libraries that ...
1
vote
1answer
292 views

Looking for most current Financial API that is fast and accurate for NYSE NASDAQ AMEX OTC and PINKs

Looking to build a real time data feed, stock monitor window. Pretty much the same as equityfeed.com market viewer window, just with a few addedfeatures and or different filter columns with more up ...
4
votes
3answers
807 views

Online courses or C++ books combined with Finance (alternatives to Duffy and Joshi)

I am trying to find a book for our study group that teaches the bare minimum C++ needed for financial applications. I am trying to teach it in a project based manner. In case, I don't settle on one ...
4
votes
1answer
300 views

What's a good book to learn computational finance topics?

I know continuous finance theory roughly equivalent to what's in Bjork's Arbitrage Theory In Continuous Time (most chapters). I'd like to supplement that knowledge with a more hands-on practical ...
2
votes
0answers
407 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 ...
1
vote
2answers
105 views

Paper recommendation with examples

Could you please advise me some papers/working documents with applications mainly focused on Fixed Income/Financial Engineering (Numerical Methods) as the one in the link below? Preferably on Matlab, ...
3
votes
2answers
1k views

Implementation of one-factor Hull-White short interest rate model

I am looking for implementation in R, VBA, C++, Python (or in any other programming language) of one-factor Hull-White short rate interest model according to the following article: Hull J. and White ...
0
votes
1answer
98 views

time step choice impact in Vasicek model simulations

I am trying to make some computations using Vasicek short rate model. Especially I a trying to compare exact expectation(obtained with the formula) and the expectation from Monte Carlo simulation. ...
61
votes
8answers
24k views

Is R being replaced by Python at quant desks?

I know the title sounds a little extreme but I wonder whether R is phased out by a lot of quant desks at sell side banks as well as hedge funds in favor of Python. I get the impression that with ...
0
votes
1answer
1k views

3rd party API like IBPy for Interactive Brokers python API?

I've read some tutorial of the Interactive Brokers API's TWS and it seems very low level and requires so much work just to place a simple market order. I've come across IBPy and just wondering how ...
0
votes
1answer
166 views

R: backtesting with path dependencies

I have a historical PMwR journal of trades (one for each side of position open/close) in R. I wish to backtest trade sizing algorithms, one of the inputs to which calculation will be, on-the-day ...
2
votes
2answers
86 views

Multi Period Return Table

For performance presentation a multi period (or multi horizon) table is needed. What I mean is a table showing the trailing month, quarter, YTD, and other sub periods up to since inception. So I ...
1
vote
0answers
43 views

Issue with chart.RiskReturnScatter in performance analytics, need finite 'ylim' values error

I am currently trying to create a Risk Return Scatter plot using the following code ...
0
votes
2answers
73 views

Imputation of missing returns

I'm trying to calculate a historical VaR for a portfolio of futures, however there are certain days for which some assets are missing prices. Since the portfolio consists of many spread positions, the ...
0
votes
1answer
81 views

bds with field in R returning error

I am using Rblpapi and trying to query the following: bds("FN1 Comdty","FUT_CHAIN", overrides = "CHAIN_DATE=20170101") However, I am getting the following error:...
2
votes
2answers
4k views

Calculating the efficient frontier from expected returns and SD

I'm trying to calculate the efficient frontier (and the optimal portfolio at the Sharpe ratio) given two vectors for a portfolio: (1) expected returns and (2) historical standard deviations. I would ...
1
vote
1answer
63 views

Finite difference: move forwards or backwards?

In finite differences for the black scholes method, you move backwards in time, since of course you know the prices at time $t = T$, and then you iterate until you get to time $t = 0$. However, why ...
0
votes
1answer
195 views

Bloomberg's Open Market Data Initiative

I am reading about OMDI: https://www.bloomberg.com/company/announcements/bloomberg-opens-its-data-distribution-technology/ After reading that, I am still not sure: Is it free? If so, what kind of ...
1
vote
3answers
521 views

Normal Inverse Gaussian distribution - any consensus on an accurate quantile function?

I am making use of the Normal Inverse Gaussian distribution in my work to model underlying interest rate implied volatility risk drivers. What is particularly nice about this distribution for my ...
2
votes
1answer
416 views

How to perform batch-trading using Interactive Broker API?

My definition of batch-trading: Given $N$ BUY orders, $M$ SELL orders and $O$ ($O < N$) as the max number of open positions to be held. Batch-trading should monitor the orders and when $O$ BUY ...
3
votes
1answer
377 views

Why my implementation of CRR model does not converge?

Recall that CRR (Cox-Ross-Rubinstein) model for option pricing is the usual binomial tree model with $u$ (up-factor) and $p$ (one of the risk-neutral probabilities) defined as follows: $$u = e^{\sigma\...
1
vote
0answers
92 views

Convertible bonds pricer - implementation

Where I can find numerical implementation (in any programming language) of convertible bonds pricer based on the following article: E. Ayache, P. A. Forsyth, K. R. Vetzal, "The Valuation of ...
16
votes
7answers
6k views

What C++ math libraries are typically used by quants?

Before you mark question as off-topic, please read it - it is, actually, quant-related. Basically, I'm working on an app that spits out a lot of C++ math. When it comes to simple things like ...
0
votes
0answers
60 views

Simulation VaR and CVar assuming Normal Distribution

Am I missing something? Currently implementing a VaR and CVaR measure assuming normality of wealth value. after executing the following script, VaR is always greater than CVaR, as expected, but ...
1
vote
0answers
38 views

VaR calculation using excel gives different value than VaR using R at all c values except at c=0.5

This is VaR calculation in excel using variance-covariance method. This is VaR calculation in R. ...
-1
votes
1answer
640 views

Choosing programming language for the next generation of a pricing library [closed]

If I were to start development of a pricing library, which programming language would be most suitable to satisfy the following needs: Implement highly parallelizable pricing models using GPU or any ...
2
votes
0answers
42 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 ...
17
votes
5answers
46k views

How to fit ARMA+GARCH Model In R?

I am currently working on ARMA+GARCH model using R. I am looking out for example which explain step by step explanation for fitting this model in R. I have time series which is stationary and I am ...
3
votes
2answers
1k views

Getting data of sub-sector indexes of an S&P 500 index sector using QuantMod in R

Using the quantmod package in R, one can download the S&P500 index using the following command: ...
5
votes
2answers
276 views

Create Tick Bars with R

How do I get OHLC bars with tick count (i.e. 500 ticks) instead of time? I prefer quantmod. Currently I have tick data and can already convert to minute bars using xts. ...
3
votes
3answers
4k views

What is the Most Efficient Way to Calculate the Internal Rate of Return IRR?

I have built a program that prices financial assets and it does this in part by calculating the IRR. The problem is that it does not run as quickly as I would like it to. I currently use the Newton-...
2
votes
1answer
778 views

Backtesting C++ Algorithms

What software is available for backtesting trading algorithms written in the C++ programming language? I would not like to use an online service such as Quantopian or Quantconnect (they don’t offer C+...
2
votes
0answers
893 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 ...
1
vote
1answer
231 views

Modelling interest rate

Hi I want to model two stochastic integrals in Matlab, which is given by $ x(t) = x(s) e^{-a(t-s)} + \sigma \int_s^t e^{-a(t-u)} dW_1(u)$ $y(t) = y(s) e^{-b(t-s)} + \eta \int_s^t e^{-b(t-u)} dW_2(...
1
vote
0answers
30 views

Finding the distribution and moments of returns with GARCH models (in R if possible)

I understand the GARCH type models and I know how to fit a model to a time series. But, there is a paper which calculates the moments of the distribution of returns (Variance, Skewness, and Kurtosis) ...
2
votes
1answer
6k views

Did Google Finance API Go Away or Just Change Signature? [closed]

I have been using Google finance for many months to pull intraday and daily data. Today I tried to use it and got redirected. For example, the following URIs returned text data that could be parsed: ...
15
votes
4answers
11k views

Trading C++ Libraries

Are there any free c++ libraries that would have some of the functions that would be used in developing a trading strategy. For instance, calculating drawdown, Volatility Forecasting, MAE, MFE....etc. ...
8
votes
3answers
1k views

Using QuickFIX in a C project

QuickFIX is a well-known open-source implementation of the FIX protocol. This library has been ported to numerous languages, though for the moment I am concentrating the on C/C++ implementation. ...
5
votes
1answer
205 views

OpenGamma's Strata - Computational Overhead

I've been looking at the open-source library Strata (maintained by OpenGamma), which is written in Java. Now, upon inspection of the FX Forward Pricer and Payment Pricer I noticed two things: All ...
1
vote
1answer
201 views

Interpretation of PCA for commodity futures

I've done some PCA analysis of a portfolio consisting of futures on certain commodities. However, I am unsure of how to interpret the output as most of the information found online deals with fixed ...
2
votes
3answers
2k views

Portfolio Optimization - Zero beta portfolio

I am trying to solve a optimization portfolio in R in which I do the following constraints: Set weight sum to within a boundary Set return to a certain value Set portfolio beta to 0 The purpose is ...
2
votes
1answer
34 views

Deriving the long-horizon predictive regression and hypothesis testing

I am working on the long-horizon regression, $$y_{t,K}=\mu+\beta_1x_{1,t-1}+...+\beta_nx_{n,t-1}+e_{t} $$, where $$y_{t,K}=y_{t}+y_{t+1}+...+y_{t+K-1}$$ and there can be multiple x's. So I am ...
0
votes
3answers
7k views

Symbols for DAX from Alpha Vantage

I found the website https://www.alphavantage.co as an alternative for yahoo finance stock API. I am interested in the top 30 DAX symbols, but I seem to cannot find them on Alpha Vantage. Is there a ...
4
votes
0answers
158 views

Implementing Hanson`s LMSR with Limit Orderbooks

I am trying to integrate Hanson's LMSR (see (see logarithmic market scoring rule)into an order-book with traditional bid/ask-limit orders (in KDB+/Q). The following functions define the basic LMSR ...
3
votes
0answers
162 views

Simulation of a DCC-GARCH

I want to simulate some exchange rates with a DCC GARCH. I know the package rmgarch but I want to code the simulation my self. The following are the main equations ...
2
votes
1answer
122 views

How to use Kelly Criterion to place an order in financial market

I tried to write a real-time trading system, however do not know how to fit a Kelly model into the system. The system will automatically calculate everyday 12AM while I want to add another function ...
1
vote
1answer
611 views

Automatically get iShares ETF holdings

I heard that ETF's must publicly report their holdings all the time. I have seen that for example on the iShares website I can download the list of holdings as a csv file: https://www.ishares.com/us/...
1
vote
2answers
306 views

R: optimize timeseries to minimize “integral”

What I am looking to do is: for a given time-series $P_t$ (which will be constructed from different timeseries itself): $P_t$ = $\beta_1$$I_t^1$+$\beta_2$$I_t^2$+$\beta_3$$I_t^3$ $\qquad$ ($I_t^i$ ...