ic: Function to compute impact cost.

Description Usage Arguments Value Author(s) Examples

View source: R/ic.R

Description

Function to compute impact cost for a security for a day.

Usage

1
ic(mbp, Q, d, partial = FALSE)

Arguments

mbp

a data.frame, containing best price/quantity pairs for buy and sell side with time stamps as row names. Units:

  • Price (bbp/bsp): Some currency (INR, USD, etc.)

  • Quantities (bbq/bsq): Number of shares

Q

an 'integer' vector containing the quantities for which to compute the Impact Cost.

d

Date

partial

a 'logical' scalar, telling whether to do partial executions

Value

A 'list' of matrices containing buy and sell IC. 'names' of the list are the Q values used. Each matrix will contain rows having

The function returns ‘NA’ values if “partial” is ‘FALSE’, or, if there were no orders (empty book) at a particular time.For the buy and sell ic measures the corresponding row name for that entry is its timestamp.

Author(s)

Chirag Anand

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Demonstration of IC functions using the market by price data
## of CINEMAX from the ic_CINEMAX dataset.
try(data(package="ifrogs", "ic_CINEMAX"))
mbp <- cbind(as.data.frame(CINEMAX[1]), 
             as.data.frame(CINEMAX[2]), 
             as.data.frame(CINEMAX[3]), 
             as.data.frame(CINEMAX[4]))
print(mbp)

ans1 <- ic( mbp, Q = 600, d, partial = FALSE)
head(ans1)

ans2 <- ic( mbp, Q = 600, d, partial = TRUE)
head(ans2)

igidrfrg/ifrogs documentation built on July 20, 2020, 2:02 p.m.