当前位置: 首页>>代码示例>>Python>>正文


Python Simulator.start_date方法代码示例

本文整理汇总了Python中Simulator.Simulator.start_date方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.start_date方法的具体用法?Python Simulator.start_date怎么用?Python Simulator.start_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Simulator.Simulator的用法示例。


在下文中一共展示了Simulator.start_date方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import start_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_()
开发者ID:qiuwch,项目名称:StockAnalysisCn,代码行数:41,代码来源:Simulator.py

示例2: SimpleStrategy

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import start_date [as 别名]
#!/usr/bin/python
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

strategy = SimpleStrategy()

name = 'Weichao Qiu'
initial_money = 10000
user = User(name, initial_money, strategy)

sz01 = PriceSource('000001.SZ')

market = Market()
market.AddPriceSource(sz01)
market.AddUser(user)

simulator = Simulator(market)
# simulator.gui = Gui()

simulator.start_date = datetime.datetime(2011, 1, 10)
simulator.Simulate()  # Begin simulation
开发者ID:qiuwch,项目名称:StockAnalysisCn,代码行数:28,代码来源:Demo.py


注:本文中的Simulator.Simulator.start_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。