Learn R Programming

PortfolioEffectHFT (version 1.6)

util_plot2df: Line plot of portfolio metric (for a dataframe)

Description

Draws a new line plot using a a dataframe with one or many metric values.

Usage

util_plot2df(formula, data, title=NULL, subtitle=NULL, font_size=10, line_size=1.2, bw=FALSE, axis.text.size=1.5, title.size=2)

Arguments

formula
Formula that describes data titles to be plotted.
data
Dataframe with metric data.
title
Plot title.
subtitle
Plot subtitle.
font_size
Baseline font size.
line_size
Line thickness.
bw
Black and white color scheme flag.
axis.text.size
Axis font size.
title.size
Title font size.

Value

Examples

Run this code
## Not run: 
# portfolio<-portfolio_create(fromTime="2014-10-02 09:30:00", toTime="2014-10-02 16:00:00")
# portfolio_settings(portfolio,resultsSamplingInterval='60s')
# portfolio_addPosition(portfolio,c('SPY','C'),c(500,600))
# metricSPY=position_return(portfolio,'SPY')
# n=NROW(metricSPY)
# metricSPY<-data.frame(metricSPY,legend=array("SPY return",dim=n))
# util_plot2df(value~time,metricSPY,title="Return, SPY")
# 
# metricC=position_return(portfolio,'C')
# n=NROW(metricC)
# metricC<-data.frame(metricC,legend=array("C return",dim=n))
# metric=rbind(metricSPY,metricC)
# util_plot2df(value~time,metric,title="Return")
# ## End(Not run)

Run the code above in your browser using DataLab