HFTsimulator: HFTsimulator

Description Usage Arguments Details Value See Also

View source: R/hftsimulator.r

Description

high-frequency trading simulator.

Usage

1
2
3
HFTsimulator(stg, ..., instrumentids, datalist, formatlist, tc = FALSE,
  Sleep = 1, DIGITSSECS = 3, septraded = FALSE, unclosed = TRUE,
  closed = TRUE, interdaily = FALSE, verboselimitpriors = TRUE)

Arguments

stg

function, strategy function.

...

parameters passed to stg.

instrumentids

character, spefifying instruments to be traded.

datalist

data.frame or list, specifying taq data used in the simulation. datalist must be a list of data.frame(s) or a data.frame.

formatlist

list, specifying taq data format, formatlist is either a list of data format specifycation or a list of lists of specifications.

tc

logical, indicating wehter to use a simulated tradecenter. when tc=TRUE, only lazysubmission can be used as submit function in stg. Defalut FALSE.

Sleep

numeric, idle time length of simulated tradecenter, measured in seconds, default 1.

DIGITSSECS

integer, specifying second digits, default 3.

septraded

logical, indicating wether to record traded orders separately.

unclosed

logical, indicating wether to track all unclosed orders, set unclosed=TRUE when you need to calculate mean open price and open profit. Default TRUE.

closed

logical, indicating wether to track all zero holding states, set closed=TRUE when you need to calculate close profit, default TRUE.

interdaily

logical, indicating wether to support interdaily strategies, most of the time MM strategies are appiled in intraday situations, set it to TRUE only when you know exactly what you are doing. Defalut FALSE.

verboselimitpriors

logical, indicating wether to record all prior limit orders' informations. if verboselimitpriors=TRUE, simulator will contatenate all limitpriors in a list named 'verbosepriors'. Default TRUE.

Details

Initialize simulator states, including simulation back ground functionalities and many ohter simulator related parameters. All states related variables are saved in an environment named '.tradingstates'. Queuing orders and capital state will be saved and kept updated in tradingstates during simulation. There are two improtant data.frames stored in this envrionment, 'orders' and 'capital'. All current queuing orders will be stored as one rows in orders during simulation. if there is no queuing order, orders will be a data.frame with 0 row. each instruments' capital state will be stored as one row in capital. capital has at least one row. queryorder() and qureycapital() can be used inside strategy function to fetch orders and capital from .tradingstates.

Value

a list containing all kinds of histories and current states.

See Also

lazysubmission cancelall queryorder querycapital meanopen holdingsprofit


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