Description Details Author(s) References Examples

This package uses market quotes to classify implicit buy and sell-initiated trades in OTC markets through the algorithm of Lee and Ready (1991). Based on information for trade initiation, the package computes the probability of informed trading of Easley and O'Hara (1987).

Package: | FinAsym |

Type: | Package |

Version: | 1.0 |

Date: | 2012-04-02 |

License: | GPL-3 |

LazyLoad: | yes |

The package consists of two R functions. The classification of implicit trade origination from quotes is produced by classify_quotes.R. This functions takes two inputs, namely a matrix with as many rows as the number of intraday quotes, and two columns. It also requires the user to specify which column numbers include the bid and ask prices. The likelihood function for the PIN model is coded in the function pin_likelihood.R. This takes as inputs the parameter values - in the order of epsilon, mu, alpha, delta - and the time series of daily data on number of no trades, buy- and sell-initiated trades.

Maintainer: Paolo Zagaglia <[email protected]>

D. Easley and M. O'Hara. Price, Trade Size, and Information in Securities Markets. Journal of Financial Economics, 19(1), 69-90, 1987.

C. M. C. Lee and M. J. Ready. Inferring Trade Direction from Intraday Data. Journal of Finance, 46(2), 733-746, 1991.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ```
#Sample data
mydata<-matrix(c(4.56, 4.7, 4.57, 4.64, 4.53,
4.65, 4.59, 4.66, 4.55, 4.65, 4.59, 4.66, 4.59,
4.66, 4.55, 4.65, 4.55, 4.65, 4.55, 4.65, 4.59,
4.66, 4.55, 4.65, 4.59, 4.66, 4.59, 4.66),
nrow=14, byrow=TRUE)
#Trading day
gname <- 'June 29 2006'
ind_bid <- c(1)
ind_ask <- c(2)
quotes_types <- classify_quotes(mydata, ind_bid,
ind_ask, gname)
#Again, sample data for 15 trading sessions
qdata <- matrix(0, 3 ,1)
qdata[1] <- 9
qdata[2] <- 6
qdata[3] <- 13
classified <- matrix(qdata,3,15)
#Make a starting guess at the solution
par0 <- c(0.5, 0.5, 0.5, 0.5)
param_optim <- optim(par0, pin_likelihood,
gr=NULL, classified)
alph <- c( param_optim$par[3] )
miu <- c( param_optim$par[2] )
delt <- c( param_optim$par[4] )
epsi <- c( param_optim$par[1] )
PSI <- c( ( 1-miu )*epsi + miu )
pin <- c( miu/PSI )
msg_pin <- paste("The average PIN over the
trading period is:", pin, sep=" ")
print( msg_pin )
``` |

FinAsym documentation built on May 29, 2017, 6:39 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.