MarketSell: Execute Market Sell Order

Description Usage Arguments Value Examples

View source: R/MarketSell.R

Description

(Try) to sell a given instrument at given date and time, by market order. The function can at most penetrate 5 levels of bid prices. For large capital, the average executed price WILL be depressed. There is a possibility that the order will not be fully executed and some holding volumes will remain.

Usage

1
MarketSell(dir = dir, date, orderTime, dfLog, costOut = 0.001, market = 'SHSZ') 

Arguments

dir

The directory containing the Tick data.

date

the date for placing the order.

orderTime

Time of the day to place the market order.

dfLog

The dataframe generated by buy-orders.

costOut

transaction cost for selling.

market

specifying the sub-function to call depending on the market.

Value

The same dataframe dfLog, with corresponding entries updated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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')
                       
## see result ##
dfLogSold

TickExec documentation built on May 2, 2019, 9:58 a.m.