ctp:ctpParser: add '-b' option

Add '-b' option to support starting trading at a preset time.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc: add dateTime module

Add dateTime module as a general interface to get or transform datetime
in a given format.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
ctp:ctpParser: replace the datetime symbols using dateTime module

Update the procedures to handle beginTime and endTime using dateTime module.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:posmgr: add new method getPositionByNum

getPositionByNum() returns the position indexed by a passed parameter without
popping it from the management stack.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat: abstract the profit management into an independent class

Since RunStat cantains kinds of attributes, it brings confusions to sustaining
work. So separate profit-related attributes into a new class and manage it
independently.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy:futures/turtle: add framework to calculate max/min profit day by day

1, Update ProfitRegress to support updating the max/min profit in paralle
   environment.
2, Add doStatistics() method to calculate the profit for the current positions.
3, Enable moveToNextTick() to calculate the max/min profit for each trading day.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy:turt1: adjust to support calculate the max/min profit for each tick

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc: separate ProfitRegress and TradingCounter from runstat module

The framework will support a lots of complex statistics in the near future, so
we have to separate each of statistic functionalities into independent modules
to keep runstat as clear as possible so that it will be easy to extend runstat
to support other features.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy: fix bug that can not calculate max/min profit correctly

There was a bug that can not calculate max/min profit correctly, fix it.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy:turtle: fix tickBehindHook caused exception while getting data

If the passed time argument is not in the set of the dateSet made from a data
table, then an exception will be caused. In this case, we assume price being 0.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat: extend RunStat to use ProfitRegress flexibly

Extend RunStat to specify numInstruments argument so that ProfitRegress can
serve more instruments parallelly.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: fix max/min profit were affected by updateProfitByOrder

The max/min profit were not correct because they were possibly updated new
values while updateProfitByOrder() updating order profit.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: move bus profit from runstat to profit module

RunStat and MarketRunStat contained a lot of attributes which are not logically
clear to do statistics at runtime, and it makes hard to maintain runstat module.
As an enhancement to runstat, we keep runstat as a high level framework to do
statistics and separate each type of statistics into a new class and maintain it
independently in different modules.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: separate order statistics into an independent class

Separate order statistics from runstat as OrderRegress class to keep runstat
as clear as possible.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: rename busProfit to busWin

1, The old busProfit only works to calculate the max/min business win, so rename
   it to busWin to match its real role.
2, Update other affected symbols accordingly because of #1.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: optimise code according to symbols' functionnalities

Rename some symbols according to their functionalities. This aims to optimise
the code to reduce the confusions.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: rename BusinessProfitRegress to BusinessWin

Rename BusinessProfitRegress to BusinessWin and update related symbols since it
only works to count the business win statistics.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc:runstat/profit: rename OrderRegress to OrderWin

Rename OrderRegress to OrderWin and update related symbols since it only works
to count the order win statistics.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
misc: introduce debug module

Debug module helps control displaying the debugging messages.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
regress:regression: add method to parse attributes for strategies

Add parseAttributes() as uniform call to parse attributes for strategies.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>