ordersubmission: ordersubmission

Description Usage Arguments Details Value See Also Examples

View source: R/hftsimulator.r

Description

take one of the following order actions: open, close, closetoday, closepreday and cancel.

Usage

1
2
3
4
ordersubmission(instrumentid = "TF1603", orderid = NULL, direction = 1,
  price = 0, hands = 1, action = "open", timeoutlist = FALSE,
  timeoutchase = FALSE, timeoutsleep = 1, chaselist = FALSE,
  chasesleep = 1)

Arguments

instrumentid

character, instrument identifier.

orderid

character, specifying an unique order id, can be generated by randomid().

direction

integer, specifying trading direction. 1 for long, -1 for short.

price

numeric, specifiying order pirce.NOTE: when price=0, ordersubmission() will submit a market order; when price=NULL, ordersubmission() will take the corresponding bid1 or ask1 price as submitted price.

hands

integer, specifying amount to be submitted.

action

character, specifying submit action, action can take value from one of "open","close","closetoday","closepreday" and "cancel". amount submitted in action='close' can not be greater than the sum of current holdings and queuing open hands.

timeoutlist

logical, indicating wether to give current order a timeout interval, the length of the interval is specified by timeoutsleep. if the order hasn't been executed after a time interval greater than timeoutsleep, the order will be canceled.

timeoutchase

logical, indicating whether to chase order when timeout.

timeoutsleep

numeric, specifying the timeout inverval in seconds.

chaselist

logical, indicating wether to put this order to auto-chase list. if the order hasn' been executed for a time inverval longer than chasesleep, the simulator will cancel this order(if needed), then submit a new one with the sampe hands and a price equal to the bid1/ask1 price. the simulator will repeat this action until the original submitted amount is executed.

chasesleep

numeric, specifying the time interval between each execution check. In seconds.

Details

ordersubmission submit an order specified by the user, it also take some additional actions after the submission. For example, if set timeoutlist=TRUE and timeoutsleep=1, the simulator will first submit an order and cancel it if the order is not executed in the next second.

Value

order status code.

See Also

multisubmission timeoutchasesubmission timeoutsubmission chasesubmission

Examples

1
2
3
4
5
6
7
## Not run: 
## submit an open order, buy 1 hand of TF1603 at price 99
## a length 5 random orderid is generated by randomid(5)
ordersubmission(instrumentid="TF1603",orderid=randomid(5),
                direction=1,price=99,hands=1,action="open")

## End(Not run)

chenhaotian/High-Frequency-Trading-Simulation-System documentation built on April 18, 2018, 9:24 p.m.