date: keep use uniform argument for methods

Change argument for setCurDate() to use uniform argument 'date'

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
test: add tests for date module

Add more validations for both isFirstDate() and isLastDate().

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy: add strategy super class.

Gneral strategy super class which defines the most common methods
used to interact with main framework. This is the topest class for
any futures or stocks strategy.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
strategy: add futures super class

Futures strategy super class which defines the most common methods
used to do futures business. Any futures strategy must inherit this
class so that the main framework could know how to interact with
a certain strategy.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
t_trade: change the call method of test_trade()

1) "if __name__ == '__main__':" This will make test_trade() only can be directly called, so remove this condition.
2) Make the test can be called from shell through "$ python test_trade.py"

Signed-off-by: GuofengLiu <lgf612@sina.com>
strategy:futures: add and remove methods

1) Remove openPosition() and closePosition().
2) Add closeShortPostion(), closeLongPostion() and run().

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
data: add two methods

1) lowestByDate(date, days) returns the 'lowest' in $days before $date.
2) highestByDate(date, days) return the 'highest' in $days before $date.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
test: add tests for data module

Add tests for both lowestByDate () and highestByDate().

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
db:mysqldb:Fix the UnboundLocalError

The code out of try/except peer will not be treated as part of the
block. Thus the return here didn't work with the function but ran
as a single command. 'res' was not a global variable, so the
reture would cause a UnboundLocalError.

Signed-off-by: GuofengLiu <lgf612@sina.com>