An open source programming language and software environment for statistical computing and graphics.

learn more… | top users | synonyms

0
votes
0answers
9 views

Is it possible to download stock-data countrywise with quantmod package for R?

Is it possible to download stock-data countrywise with quantmod package for R ? Hi, I'm wondering if it's possible to download equities countrywise. Let's say i want all data from the Finnish ...
0
votes
0answers
14 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
17 views

VEC GARCH (1,1) for 4 time series

I have to estimate a VEC GARCH(1,1) model in R. I already tried rmgarch, fGarch, ccgarch, mgarch, tsDyn. Has somebody estimated a model like that? ...
6
votes
1answer
167 views

R Backtesters: Quantstrat vs SIT

I am learning R, and want to start using a backtester. I have spent about a day reading all I can about R backtesters, and it seems there are 2 main contenders: quantstrat, which uses the packages ...
2
votes
0answers
58 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 ...
0
votes
0answers
38 views

Need to know What is not available in RQuantlib

If we explore CRAN RQuantlib package it says The 'RQuantLib' package makes parts of 'QuantLib' accessible from R. When I tried the package I have found vanilla/some exotic options, fixed income ...
1
vote
0answers
86 views

Generating financial data

I am trying to generate monthly stock data using a one-factor model: $$R_{a,t} = \alpha + BR_{b,t}+\epsilon_{t}$$ The description says: $R_{a,t}$ is the excess asset returns vector, $\alpha$ is the ...
4
votes
1answer
80 views

Calculate mean variance portfolio

I am trying to calculate the mean variance portfolio using the plug-in approach. First I generate some artificial data: x <- replicate(10,rnorm(1000)) Then I ...
0
votes
0answers
28 views

How to form Decile Portfolios based on Liquidity measure with missing data in R

I have a dataframe with over 4000 companies data (as column) and have calculted their daily Quoted spread measure ( measures liquidity for each stock) for 15 years. And then from the daily have ...
0
votes
0answers
35 views

Forecasting conditional variance using fGARCH

I am forecasting the conditional standard deviation using ARMA(1,0)-GJRGARCH(1,1) in R using the fGarch package. Here is a sample code: ...
2
votes
2answers
91 views

Augmented Dickey-Fuller Test/ Unit Root test on multiple time series dataframe in R

I have a dataset/dataframe in which I have calculated the daily log returns of five thousand companies and these companies are as column as well. I want carry out ADF test on this dataframe. I have ...
0
votes
0answers
30 views

In what situations would cross validations scores be inaccurate?

I'm trying to fit a SVM model on times series stock return data, predicting a buy, hold, or sell signal of the stock. I'm using 10-fold cross validation (using the R package ...
0
votes
1answer
66 views

Log daily returns of multiple securities for multiple time period in R

I have dataset containing daily closing prices of 5413 companies from 2000 to 2014. I want to calculate daily log returns for the stocks as according to dates as log(Price today/Price yesterday). I ...
1
vote
1answer
51 views

GARCH alpha equal to 0

I am estimating a GJR-GARCH(1,1) model with variance targeting in R. As data I am using returns on some stock indices. While calculating the GARCH models I obtain $\alpha=0$ for some indices. From ...
2
votes
2answers
51 views

Problem with obtaining densities

For my research I need to obtain a series of densities, however, I am encountering some problems. The first problem is perhaps very simple, but the answer eludes me. Let's say I have an observation ...
9
votes
3answers
246 views

Is there a website that lists replication code of financial papers?

There are lot of questions on this website related to the replication of the empirical part of financial papers. I noticed that some (honest) authors provide on their personal website some ...
1
vote
0answers
53 views

Skewed Generalized Error Distribution's (SGED) pdf

I want to use the SGED distribution of Theodossiou for GARCH estimation, however, I am struggling to understand which is the correct pdf function of the distribution. Let me just say that the ...
0
votes
0answers
51 views

Forecasting conditional mean in ARMA-GARCH model (R/Matlab)

I am trying to forecast the conditional mean from a ARMA(1,0)-GARCH(1,1) model. The mean equation in my model is: $x_t = \mu + \delta x_{t-1} + h_t \epsilon_t$ where x is the variable (a return ...
1
vote
1answer
134 views

ARMA+GARCH prediction with package rugarch (R)

I am analyzing FTSE 100 series, from 2007-01-01 to 2010-12-31 (university exam homework). I have to use the data 'til 2010-11-30 as sample, and the remaining (23) observations as in-sample forecast ...
0
votes
1answer
96 views

Transforming daily simple returns into weekly

I am trying to transform daily simple returns into weekly returns. I am using the following R code: ...
2
votes
1answer
109 views

Portfolio Analytics Optimization

I have a large dataset, 10,000 investments I am trying to create an optimized portfolio for. The portfolio has 3 restrictions. Long Only, Only 50 assets can be selected and every invested asset has ...
0
votes
0answers
16 views

Download DGS3MO from FRED with getSymbols - error

I follow the course "Mathematical topics in finance" from MIT courseware. I opened R and rendered Dr. Kempthorne's Case Study 3: Time Series from September 30, 2013 I am able to render the code and ...
1
vote
0answers
41 views

Portfolio Optimization with equal weight for assets selected

I have a data frame of bets, with 1 being a win and 0 being a loss. These bets are correlated so I cannot just pick the highest winning percentage. Goal is to get 2 optimizations, 1 for max sharpe ...
0
votes
0answers
30 views

Solving inequality constraint

I am trying to solve the following inequality constraint: Given time-series data for N stocks, I am trying to construct a portfolio weight vector to minimize the variance of the returns. the ...
0
votes
2answers
102 views

Stochastic process theory question

*S follows a process $dS= mSdt + oSdz$ where m and o are constant. What is the probability followed by $ Y=(Se)^{(r-t)} $. If S follows a process $ dS= k (b-S) dt + oSdz $ where k, b, o are ...
2
votes
1answer
45 views

Estimating Carma(2,1) parameters (using yuima package)

I am very new to R, and particularly to the yuima package, so I was hoping someone would be able to help me. I have some data (daily prices) that I wish to fit to ...
1
vote
1answer
50 views

MSRV estimation in R

What are the R packages that let you estimate Multi Scale Realized Volatility (MSRV)? So far I've only found highfrequency (which comes with Realized Kernel as well), but from what I understand it ...
1
vote
1answer
49 views

Anomaly or feature from Quantmod in R regarding getFX - currency data

I am using R to analyse stock data, using the quantmod package to get all sorts of data, but here specifically FX data using the function ...
0
votes
0answers
31 views

CCC-Garch predict

So I'm trying to measure the VaR of 2 stock with a multivariate GARCH model, so im using the CCC model. I need to predict the standard-diviation and the mean but the ...
2
votes
0answers
46 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 ...
3
votes
2answers
85 views

Sobol numbers in monte Carlo simulation

I wanted to figure how how much faster the Sobol quasi random numbers convergence to the B&S call price compared with pseudo random numbers. To generate the Sobol numbers I used the randtoolbox in ...
1
vote
1answer
192 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 & ...
2
votes
0answers
71 views

Imposing Restrictions on Cointegrating Vectors, R example

The code given below estimates a VEC model with 4 cointegrating vectors. It is a reproducible code, so just copy and paste into your R console (or script editor). ...
2
votes
0answers
61 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 ...
1
vote
1answer
163 views

Is there a good backtesting package in R?

My model exports a vector that have for each day b-buy s-sell or h- hold it's look like this: sig [1] b b s s b b b s s b s b s s b s b s s s s b b s s b b b b b b s b b b b b b b I want to ...
2
votes
0answers
34 views

Rollapply: what does by.column do? [closed]

I have read the description of by.column for rollapply in the manual but i couldn't understand how to use it. see below: x=matrix(1:60,nrow=10) ...
2
votes
2answers
131 views

What are the advantages of financial modelling in R? [closed]

Recently I've found out that quantitative department in my company uses mostly R software for modeling in general. What is the advantage of modeling financial data in R instead of Excel, or some ...
1
vote
0answers
33 views

RQuantLib FixedRateBondPriceByYield() Non-tradable error

How do I use FixedRateBondPriceByYield() function on maturity date that is earlier than today? I get "non tradable error" when applying on date older than today. ...
0
votes
0answers
25 views

Luis Torgo - Case Study, Function creates high leverage

I am doing Luis Torgo Case study - Predicting Stock Market Returns and I have a problem when I use the function trading.simulator in the package DMwR ...
0
votes
1answer
64 views

Binary Option valuation problem in R using RQuantLib; also result validation aspect

When I am trying to value Binary Option using RQuantLib I am not getting all the greeks for exctype "american" wheras "european" exctype is fine. What is the problem here ? ...
2
votes
2answers
86 views

What do you do with low r-squared when calculating high-frequency beta

I am calculating a high-frequency beta. For example I have 90 days of data of the S&P and GOOGLE and I have 10-minute percent returns for each instrument. Each day has 34 10-minute percent returns ...
1
vote
0answers
108 views

Automated Import of 10-Q and 10-K Statements in XBRL Format from SEC.gov

I want to read financial statements in XBRL Format from the SEC site automatically. For instance the 10-Q File from Apple: ...
1
vote
1answer
77 views

Original Fundamental Accounting Data (Not Ratios)

Where do I get original fundamental accounting data from income statement, balance sheet and cash flow statement, like Sales/Revenue, Gross Income, EBIT, Operating Income, Cash & Short Term ...
9
votes
4answers
535 views

Thesis using Momentum strategies in R, tips on good books, guidelines etc on how to do the programming?

I am quite new to R and will be doing an empirical analysis of momentum strategies in R using a dataset from the index OSEAX from 1980 to 2014. The momentum strategy will for the most part resemble ...
2
votes
0answers
81 views

R quantstrat backtest with dollar based position sizing

I am attempting to tweak a quantstrat based backtest but have run into an issue. The maxPos limits are share based, and I would rather use a fixed dollar amount instead. So I've tried generating a ...
5
votes
2answers
431 views

Change periodicity on Rblpapi

So Dirk Eddelbuettel, Whit Armstrong, and John Laing released Rblpapi to CRAN recently, and it is awesome. I'm having some difficulty understanding how the overrides work though, hopefully someone can ...
1
vote
0answers
42 views

ROC — Output from Calculating Stock Returns Producing Lower Numbers Than Actual

I tried this on stack exchange, but think it is a better question here. I am beginning user and I need help with an error / bad output I am getting when calculating returns (using ROC) on stock ...
2
votes
0answers
46 views

Return.portfolio error from PerformanceAnalytics package

When using the PerformanceAnalytics package of R, I am getting an error from the Return.portfolio function whenever I ask it to rebalance_on any frequency. If the rebalance parameter is removed, the ...
1
vote
1answer
133 views

What is the logic behind this backtesting code in R

I am new to R and I have found this simple backtesting code and can you explain me what is happening here. ...
6
votes
1answer
267 views

Calculate turnover for portfolio

I am trying to calculate the turnover for a portfolio strategy. First I generate some random data and assign it dates: ...