Learn R Programming

TickExec (version 1.1)

PortfolioWorth: Evaluate Market Worth of Given Protfolio

Description

The evaluation is done at time of a given date.

Usage

PortfolioWorth(dir = dir, df, date, time = 145900, market = 'SHSZ')

Arguments

dir
The directory containing the Tick data.
date
the date of evaluation.
time
the time of evaluation.
df
The dataframe containing the portfolio.
market
specifying the sub-function to call depending on the market.

Value

A number indicating the markrt worth.

Examples

Run this code
## locate tick data directory ##
dir <- system.file("extdata", '', package = "TickExec")

## establish a posiyion to sell ##
dfLog = LimitBuy(dir = dir, date = 20141013, ticker = 000001, capital = 1e6, 
                 limitPrice = NA, orderFrom = 94545, orderLast = 600, 
                 costIn = 0.001, market = 'SHSZ')

## sell ##
dfLogSold = MarketSell(dir = dir, date = 20141014, orderTime = 140001, 
                       dfLog = dfLog, costOut = 0.001, market = 'SHSZ')
                       
## market worth ##
PortfolioWorth(dir = dir, df = dfLogSold, date = 20141014, time = 145900, 
               market = 'SHSZ')

Run the code above in your browser using DataLab