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
1
vote
1answer
44 views

Useful Book for starting to programming quantative Finance

Could anyone recommend me a good book for an introduction to start programming quantative finance (preferably in R)? I found a lot of different ones, but unfortunately without any reviews.
0
votes
0answers
15 views

Performance Analytics SnailTrail Chart subscript out of bounds error

I am running the chart.SnailTrail function from the PerformanceAnalytics package in r. I get the following subscript out of bounds error. Error in chart.SnailTrail(z, Rf = 0.009261, main = "", : ...
0
votes
0answers
29 views

Why do these Monthly vs. daily plots differ?

I got my data from Thomson Reuters Datastream. As an Input for my plot i calculated daily Returns based on the Return-Index provided by datastream. Then i plotted the Monthly and the daily Returns.(...
0
votes
0answers
34 views

Create Random Portfolio Loop [on hold]

I have semi annuals returns for 303 different stocks. What I want to do in R is create a portfolio of 1, then 1-2, 1-2-3 etc. untill 100 securities is reached. Now the problem is that whenever a ...
3
votes
1answer
9k views

Duration of a floating rate note

I have the following C# code for calculating the modified duration of fixed coupon bonds: ...
0
votes
0answers
38 views

Doubt about metrics in the Performance analytics package of R [on hold]

I have a large database of daily returns on investment funds. I would like to know if to apply the performance evaluation metrics, such as Sharpe ratio, Information Ratio, etc., of the "Performance ...
-2
votes
0answers
18 views

How can i insert a if condition in my loop to create returns for my formation period [closed]

I'm trying to implement a momentum strategy. To do this i need to sort my stocks based on their return in the previous 11 mths. My current code works quite well: ...
0
votes
0answers
90 views

Where can I get alerts for future delisting of stocks/ETFs?

I scan / trade a universe of 1500 different European and US stocks and ETFs trading on many different exchanges. I would like to get notified before any of the tickers are delisted, so I can sell ...
24
votes
3answers
3k views

Tools in R for estimating time-varying copulas?

Are there libraries in R for estimating time-varying joint distributions via copulas? Hedibert Lopes has an excellent paper on the topic here. I know there is an existing packaged called copula but ...
2
votes
2answers
936 views

Portfolio Management in R

I’ve been looking around for a R-package that will allow me to track my stock portfolio - basically I would like to enter stocks that I own, track the trades I make, calculate my open position & ...
0
votes
0answers
30 views

Is this the right way to compute "realized daily market return variance, annualized, over the preceding 126 trading days”?

Realized.Variance<-rollapply((log(Fama.French.daily$Mkt+1)^2) ,126,sum,by=1) So Fama.French.dail$Mkt is my daily Market return. To calculate the realized ...
1
vote
1answer
67 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
1answer
44 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
28 views

How can i fit the following regression in R? Why is the coefficient [second Columns] for R so low?

'Rwml' is the monthly log return So the first column is clear, I got nearly the same values, at least the same magnitude. But: If I regress on the variance, my input values are way too low to get a ...
0
votes
1answer
50 views

Don't know if it is obvious, but how do I fit the following model in R?

From the Paper "momentum crashes", Daniel and Moskowitz $I_B$ is a dummy Variable which could be either one or zero Is it possible to regress on two intercepts? or do i get something wrong ? Are ...
0
votes
0answers
43 views

Free dividend data API for non-US stocks

Is there are any free API for dividend data that does also include non-US stocks? I know of this question from three years ago. However, the situation has changed since then apparently, as there are ...
6
votes
1answer
2k views

GARCH volatility modeling, squared returns, and convergence

After reading some more of Volatility Trading, I decided to try to make a simple volatility model using daily log returns of an ETF I follow. It turns out "simple" is sort of relative. Unfortunately, ...
0
votes
0answers
16 views

How to forecast monthly volatility with daily gjrGarch estimates

I'm currently writing a paper and need to regress the 22 days realized volatility of the following month on its GARCH estimate and the 126days realized volatility up to t=1 The paper im referring to ...
1
vote
1answer
2k views

Finding ETF Symbols for alpha vantange

I'd like to use the api of https://www.alphavantage.co/ which is pretty well documented, in terms of avaliable functions (but not parameters). However, in order to get an API response, one needs to ...
3
votes
1answer
565 views

Forecasting conditional returns in DCC-GARCH-copula approach in R

anyone who could help me interpreting and modifying this code? I have a dataset and want to reserve the last 100 returns for out-of-sample analysis. After specifying and fitting the garch-spd-copula, ...
0
votes
0answers
38 views

Gatheral's SVI implementation in Java/Scala

I am trying to fit equity option implied vols using SVI model in Java, and I am using apache math commons library. Some of the option expiries fit very well, but others are completely off, and I am ...
0
votes
1answer
51 views

How to find sector/industry and market cap for securities in my portfolio using R?

I am working on a project where I need sector/industry classification and market cap for some securities, many of them are not in SP500, but are part of US market. I am using R for this. I don't have ...
1
vote
0answers
39 views

Alternatives to irr function in Matlab to calculate internal rate of return

I am trying to calculate an IRR with several dimensions in Matlab 2019a. My formula below works in theory (ignoring the "multiple rates of return" warning for now), but the problem is that for bigger ...
1
vote
0answers
65 views

Small difference in IRR, big difference in NPV?

I calculated the following in Matlab 2019a, see code below. I was surprised about the big difference in present values (DiffPV, DiffPVpercentage) for only a small difference (DiffIRR, ...
2
votes
1answer
35 views

Backtesting EGARCH-NIG CVaR in R

I fitted an EGARCH model with a NIG distribution to a series of returns. Using the following link I tried got how I should calculate the CVaR of the model http://r.789695.n4.nabble.com/CVaR-with-NIG-...
0
votes
0answers
37 views

How to work with vine copula in R?

I have returns of 4 stocks: stock1, stock2, stock3, stock4. And I use R and library(VineCopula) to do: ...
0
votes
0answers
31 views

Extreme Value Simulation from Copulas with Monte Carlo

I'm trying to simulate the tail values from a multivariate distribution using copulas. I'm using Vine Copula package of R to derive the suitable copula for my data and I generate random samples out of ...
0
votes
0answers
49 views

API returning company tickers found in provided news article

I'm looking for a REST API (paid or free) that accepts a string containing a news article (example below) as payload and returns an array of company tickers (eg TSLA for Tesla) mentioned in the ...
0
votes
0answers
36 views

Problem in copula fitting

I have returns of 2 stocks: stock1 and stock2. And I want to fit pair copula. I use this libraries library(VineCopula) library(copula) then I select an ...
37
votes
15answers
36k views

Is there any thing out there as a substitute for KDB?

thanks a lot for your discussions on the original post. following your suggestions, let me re-phrase a bit : kdb is known for its efficiency, and such efficiency comes at a terrible price. However, ...
1
vote
1answer
175 views

Monte Carlo simulations in Python using quasi random standard normal numbers using sobol sequences gives erroneous values

I am trying to perform Monte Carlo Simulations using quasi random standard normal numbers. I understand that we can use sobol sequences to generate uniform numbers, and then use probability integral ...
2
votes
1answer
418 views

Rblpapi millisecond resolution

I'm using Rblapi to get tick data, using the nice getTicks function. Much to my dismay the index is rounded to the second, while milliseconds time stamp could be provided. Tried returnsAs xts, fts(?) ...
0
votes
0answers
41 views

What is the model behind Heston-Nandi functions in the fOptions R package?

I am dealing with Heston model in R and for this purpose I am using the package fOptions from RMetrics. The calibration formula requires the specification of some parameters (omega, lamda, alpha, ...
0
votes
0answers
38 views

Tangency portfolio with constraints

Hello to everyone I am trying to implement a version of MV optimization with constraints as UB and LB, it seems to work fine but now i was trying to figure out a simple way to derive a CML in the same ...
0
votes
0answers
38 views

Fit a copula model in R

I want to accomplish the task of creating an optimal portfolio of stocks, the yield between which is modeled using kopulas. And I have data: return of 4 stocks: ...
1
vote
1answer
80 views

Is there a straightforward way to get a “family tree” for a stock?

I would like to find a way to generate what might be called a "family tree" for a stock. Given a stock symbol and a future date, I'd like a graph (either literally or represented in list or other ...
1
vote
2answers
124 views

How to calculate the Maximum Drawdown for a portfolio in MATLAB?

I would like to verify my approach of calculating the Maximum Drawdown for a portfolio in MATLAB. I've got a vector of returns for the portfolio, to which I add 1 for every return. Afterwards I ...
0
votes
1answer
880 views

Calculating Discount Margin on a floating rate bond using QuantLib

Going off Luigi's hint on this answer: Setting up Schedule for an amortizing floater in QuantLib I was able to cobble something together but I'm unable to verify if it's correct. TLDR: I was able to ...
3
votes
1answer
882 views

How to backtest strategy in portfolio of stocks using SIT R?

I am creating and testing strategies in R code and using systemic investor toolbox(SIT) package as the backtesting tool. I copied a SIT backtesting code from a website and made small changes to make ...
1
vote
0answers
30 views

Why can't I take the Value at Risk “VaR” as a a risk objective in PerformanceAnalytics? (it does work for "ES)

I am currently playing around with PortfolioAnalytics package in R and some data and I am aiming to create different portfolios with different VaR. However, I am struggling first of all, add.objective(...
1
vote
0answers
27 views

fPortfolio specify our constraints for efficientPortfolio [closed]

I am working on the library fPortfolio in R and I have a question. How can we fix for a portfolio the sum of weights equal to 1 ? When I study the code, I see that we cannot choose which constraints ...
1
vote
0answers
38 views

How to migrate Octave Levenberg-Marquardt algorithm to Accord.Net (C#)

I am trying to migrate Matlab (Octave) Levenberg-Marquardt algorithm to Accord.Net (C#) but struggling to match input parameters For example this simple example available in the documentation here: ...
0
votes
1answer
330 views

API for fundamentals for NSE and BSE

I want APIs for accessing fundamental data of all stocks in NSE and BSE India. I have searched a lot But no luck. Any such services available please guide me. I'm looking for specifically quarterly ...
2
votes
1answer
544 views

Trader Workstation on Ubuntu cannot be connected to via the API

I am using ibPy to connect to TWS on a fairly fresh ubuntu machine. I have been successful in logging into the paper trading account and submitting buy and sell orders programatically via the ibPy ...
1
vote
1answer
75 views
2
votes
1answer
147 views

How to interpret and define statistics of GBM output

I am trying to model the future prices of a number of commodities. For this, I am applying geometric Brownian motion, writing a Monte Carlo code in Python. Given that I want to estimate tommorows ...
3
votes
1answer
271 views

VAR-aDCC full ARCH and GARCH parameter matrices in R

I am working with the rmgarch package in R and I estimated a VAR-aDCC model. Is there any way to extract the extended version of estimates (allowing for volatility ...
1
vote
1answer
454 views

(Reproducible example) Conditional returns in GARCH-EVT-Copula context (with R)

I'm estimating a time-varying correlation matrix for the normal copula using the rmgarch package from R. I've found this code in the rmgarch.tests folder. I use the ...
9
votes
1answer
361 views

Block bootstrap to synthesize asset prices

I have a few basic questions on block bootstrapping on a financial time series ('TS'). Assuming my trade universe consists of 10 stocks, I would like to create a set of synthetic prices for all 10 ...