hikyuu2/hikyuu/extend.py

19 lines
663 B
C++
Raw Normal View History

2020-06-25 18:22:51 +08:00
#
2020-06-26 21:39:53 +08:00
# 对 C++ 引出类和函数进行扩展
2020-06-25 18:22:51 +08:00
#
from hikyuu.cpp.core import *
# ------------------------------------------------------------------
# 常量定义各种C++中Null值
# ------------------------------------------------------------------
constant = Constant()
# ------------------------------------------------------------------
# 增加Datetime、Stock的hash支持以便可做为dict的key
# ------------------------------------------------------------------
Datetime.__hash__ = lambda self: self.number * 1000000 + self.millisecond * 1000 + self.microsecond
TimeDelta.__hash__ = lambda self: self.ticks
Stock.__hash__ = lambda self: self.id