本文整理汇总了Python中Simulator.Simulator.end_date方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.end_date方法的具体用法?Python Simulator.end_date怎么用?Python Simulator.end_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.end_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import end_date [as 别名]
def test():
'''
Unit test for Simulator
'''
from Simulator import Simulator
from Strategy import SimpleStrategy
from Market import Market
from User import User
# from Gui import Gui
from PriceSource import PriceSource
import datetime
from PyQt4 import QtGui
app = QtGui.QApplication([])
strategy = SimpleStrategy()
name = 'Weichao Qiu'
initial_money = 10000
user = User(name, initial_money, strategy)
# sz01 = PriceSource('000001.SZ')
market = Market()
# market.AddPriceSource(sz01) # Done by ctor of Market class
market.AddUser(user)
simulator = Simulator(market)
# simulator.gui = Gui()
simulator.start_date = datetime.datetime(2011, 1, 10)
simulator.end_date = datetime.datetime(2011, 3, 15)
# simulator.end_date = simulator.start_date + datetime.timedelta(180)
# simulate for 6 months
# simulator.end_date = datetime.datetime.now()
simulator.Simulate() # Begin simulation
print 'end of simulation'
app.exec_()