<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://cslt.org/mediawiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-cn">
		<id>http://cslt.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Financial_document_platform2.0</id>
		<title>Financial document platform2.0 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://cslt.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Financial_document_platform2.0"/>
		<link rel="alternate" type="text/html" href="http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;action=history"/>
		<updated>2026-04-15T08:21:07Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.23.3</generator>

	<entry>
		<id>http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17835&amp;oldid=prev</id>
		<title>2015年12月1日 (二) 02:37 Tanghui</title>
		<link rel="alternate" type="text/html" href="http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17835&amp;oldid=prev"/>
				<updated>2015-12-01T02:37:47Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2015年12月1日 (二) 02:37的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第11行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第11行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##mian函数使用&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##mian函数使用&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;### 在main函数中，开发者可以选择起始日期（start），截止日期（end）。日期的格式为‘%Y-%m-%d’,比如：‘2014-01-01’，但不要出现错误日期如：'2014-02-30'。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;### 在main函数中，开发者可以选择起始日期（start），截止日期（end）。日期的格式为‘%Y-%m-%d’,比如：‘2014-01-01’，但不要出现错误日期如：'2014-02-30'。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###所选的股票（universe），可以选择自己所选的股票经行回测，比如 universe: = ['000001.XSHE'],&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;现在只能自己选股。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###所选的股票（universe），可以选择自己所选的股票经行回测，比如 universe: = ['000001.XSHE'],&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;现在只能自己选股，也能使用SetUniverse.set_universe(&amp;quot;HS300&amp;quot;)来调用hs300。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###起始资金（captial_base）是你的启动资金&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###起始资金（captial_base）是你的启动资金&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###交易方式freq = 'd',表示现在进行的是日间回测，这个结果展示不能改；refresh_rate = 1,表示一天之内handle_data的调用次数。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;###交易方式freq = 'd',表示现在进行的是日间回测，这个结果展示不能改；refresh_rate = 1,表示一天之内handle_data的调用次数。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tanghui</name></author>	</entry>

	<entry>
		<id>http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17291&amp;oldid=prev</id>
		<title>Tanghui：/* 测试Demo */</title>
		<link rel="alternate" type="text/html" href="http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17291&amp;oldid=prev"/>
				<updated>2015-10-20T05:20:27Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;测试Demo&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2015年10月20日 (二) 05:20的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第137行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第137行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; simulation(initData)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; simulation(initData)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;版本：1&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;3&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;版本：2&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;0&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tanghui</name></author>	</entry>

	<entry>
		<id>http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17290&amp;oldid=prev</id>
		<title>Tanghui：/* 修正的bug： */</title>
		<link rel="alternate" type="text/html" href="http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17290&amp;oldid=prev"/>
				<updated>2015-10-20T05:20:08Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;修正的bug：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2015年10月20日 (二) 05:20的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第56行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第56行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#修正了收益指数中的年华收益率，年华基准收益率，信息比率，最大回撤的运算规则。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#修正了收益指数中的年华收益率，年华基准收益率，信息比率，最大回撤的运算规则。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#修正了数据更新的错误&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#修正了数据更新的错误&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#修正了没有该股票对应的数据的情况&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=增加的功能：=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=增加的功能：=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tanghui</name></author>	</entry>

	<entry>
		<id>http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17289&amp;oldid=prev</id>
		<title>Tanghui：以“=虚拟交易平台使用手册= #创建平台 #:先到目录下/nfs/finhome/fin/platform，把main.py文件拷贝到自己的文件夹下。至此，我们的回测...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="http://cslt.org/mediawiki/index.php?title=Financial_document_platform2.0&amp;diff=17289&amp;oldid=prev"/>
				<updated>2015-10-20T04:55:34Z</updated>
		
		<summary type="html">&lt;p&gt;以“=虚拟交易平台使用手册= #创建平台 #:先到目录下/nfs/finhome/fin/platform，把main.py文件拷贝到自己的文件夹下。至此，我们的回测...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=虚拟交易平台使用手册=&lt;br /&gt;
#创建平台&lt;br /&gt;
#:先到目录下/nfs/finhome/fin/platform，把main.py文件拷贝到自己的文件夹下。至此，我们的回测系统已经创建好了。&lt;br /&gt;
#使用平台&lt;br /&gt;
##总体介绍  &lt;br /&gt;
##*首先导入了几个包,它主要是python库和使用这个平台所依赖的包。&lt;br /&gt;
##*然后有三个函数，分别是 'main','simulation','handle_data'：&lt;br /&gt;
###main包含需要使用的回测的基本信息。有起始日期（start），截止日期（end）,所用的股票（universe），起始资金（captial_base），一天交易次数（freq不可改），交易方式（refresh_rate不可改）。&lt;br /&gt;
###simulation主要是根据输入的信息，初始化account虚拟账户类和生成对应的json信息，并在网页上显示。&lt;br /&gt;
###handle_data是开发者需要编写程序的地方。这个里面有很有用的东西，我们接下来会慢慢介绍它。&lt;br /&gt;
##mian函数使用&lt;br /&gt;
### 在main函数中，开发者可以选择起始日期（start），截止日期（end）。日期的格式为‘%Y-%m-%d’,比如：‘2014-01-01’，但不要出现错误日期如：'2014-02-30'。&lt;br /&gt;
###所选的股票（universe），可以选择自己所选的股票经行回测，比如 universe: = ['000001.XSHE'],现在只能自己选股。&lt;br /&gt;
###起始资金（captial_base）是你的启动资金&lt;br /&gt;
###交易方式freq = 'd',表示现在进行的是日间回测，这个结果展示不能改；refresh_rate = 1,表示一天之内handle_data的调用次数。&lt;br /&gt;
##simulation函数使用&lt;br /&gt;
##*这个主要是初始化相关的类，每天调用handle_data类，计算出结果并将结果写到json中。特别的，如果是实盘测试，先初始化信息，然后再读取历史json信息，之后再执行调用handle_data等步骤。&lt;br /&gt;
###首先进行初始化信息。这个开发者不需要去改动。&lt;br /&gt;
###如果是实盘测试，这里有个地方需要开发者注意：读取json信息的位置。比如： read_json.get_data(account,result,'data2.json')。这个函数有三个参数，开发者只需关心第三个参数，这个是读取的json的位置，在这个例子中读取的本地文件夹下的‘data2.json’。&lt;br /&gt;
### 如果不是实盘测试，则不需要上面的步骤。接着就是每个有效日（一年大概250个有效日）去调用一下handle_data函数。这个地方不需要改动。&lt;br /&gt;
###然后将生成的信息写入到json文件中。 cj.convert(account,result,&amp;quot;data2.json&amp;quot;)。这个就是将对应的信息写入到json中，开发者只需注意第三个参数。这个参数是指明生成的信息存储的位置。&lt;br /&gt;
##得到分类列表&lt;br /&gt;
##;get_classify_stock（[str_num1,str_num2]）&lt;br /&gt;
##:;list_num = ['101001002009']  #注意：可以有多个值输入&lt;br /&gt;
##:;account.get_classify_stock(list_num)&lt;br /&gt;
##handle_date函数使用&lt;br /&gt;
##*这个里面主要使用的是account类，这个类中有很多信息供开发者去使用，接下来将会给大家来介绍如何去编写程序回测&lt;br /&gt;
###account.current_day:&lt;br /&gt;
###:该变量是模拟测试中今天的日期，string类型的。&lt;br /&gt;
###account.get_attribute_history(attribute, range) ：&lt;br /&gt;
###:这个函数是获取最近几天的信息，比如：&lt;br /&gt;
###:;his = account.get_attribute_history('closePrice',2)  &lt;br /&gt;
###:结果： his = array([11,12])&lt;br /&gt;
###:这个是获得最近2天的收盘价，返回的his是一个np.array数组，其中12表示是昨天的收盘价。注意：今天得到最新的信息是昨天的。&lt;br /&gt;
###:当然，还有其他的使用属性可以使用，比如：&lt;br /&gt;
###:;his = account.get_attribute_history('openPrice',2)  &lt;br /&gt;
###:;具体的信息还有'highPrice'(最高价),'lowPrice'（最低价）,'volume'(成交量),'value'（成交额）。&lt;br /&gt;
###:;注意：成交量和成交额返回的是list,其他的属性返回的是numpy.ndarray&lt;br /&gt;
###account.order(stock_code,num)&lt;br /&gt;
###:这个函数是指定某只股票的买，卖。&lt;br /&gt;
###:;account.order('000001.XSHE',300) 表示000001.XSHE股票买300只&lt;br /&gt;
###:;account.order('000001.XSHE',-300) 表示000001.XSHE股票卖300只&lt;br /&gt;
###account.order_to(stock_code,num)&lt;br /&gt;
###:这个函数是指定某只股票的买，卖到num(num &amp;gt;=0)支。&lt;br /&gt;
###:;account.order_to('000001.XSHE',0), 表示000001.XSHE股票卖到0，就是卖空&lt;br /&gt;
###:;account.order_to('000001.XSHE',300), 表示000001.XSHE股票买/卖到300，不管之前有多少只&lt;br /&gt;
&lt;br /&gt;
=程序交易规则：=&lt;br /&gt;
#程序的买和卖都是都是有手续费的。对于买手续费是千分之一，卖是千分之二&lt;br /&gt;
#程序的买和卖使用的都是昨天的信息，其中买用的是昨天的开盘价，卖用的是昨天的收盘价&lt;br /&gt;
#程序的交易没有使用滑点&lt;br /&gt;
#程序中，如果指定买500只股票，但是余额不足的时候，则剩下的钱能买多少就买多少&lt;br /&gt;
#如果一只股票要卖500只，但是现在没有这么多股票的时候，则把现在剩下的该只股票卖空&lt;br /&gt;
&lt;br /&gt;
=修正的bug：=&lt;br /&gt;
#修正了收益指数中的年华收益率，年华基准收益率，信息比率，最大回撤的运算规则。&lt;br /&gt;
#修正了数据更新的错误&lt;br /&gt;
&lt;br /&gt;
=增加的功能：=&lt;br /&gt;
#增加了开盘涨跌停，不能交易的功能&lt;br /&gt;
#增加了买卖量上限的功能，买卖的上限是当天的成交量&lt;br /&gt;
#增加了实盘模拟的功能&lt;br /&gt;
#增加了得到股票列表的功能&lt;br /&gt;
&lt;br /&gt;
=待修正的bug：=&lt;br /&gt;
#收益指数中波动率，Alpha，Beta三个指标的计算需要改进&lt;br /&gt;
&lt;br /&gt;
=潜在需要提高的地方：=&lt;br /&gt;
#在account类中，增加一个用户可以自己可以的属性&lt;br /&gt;
&lt;br /&gt;
=测试Demo=&lt;br /&gt;
&lt;br /&gt;
 import datetime,time&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import os,sys&lt;br /&gt;
 sys.path.append(&amp;quot;/nfs/finhome/fin/platform&amp;quot;)&lt;br /&gt;
 from Account import Account&lt;br /&gt;
 from InitData import InitData&lt;br /&gt;
 from Result import Result&lt;br /&gt;
 from ConvertJson  import ConvertJson&lt;br /&gt;
 from readJson import ReadJson&lt;br /&gt;
 from set_universe import SetUniverse&lt;br /&gt;
&lt;br /&gt;
 def handle_data(account):&lt;br /&gt;
    window = 2&lt;br /&gt;
    his = account.get_attribute_history('closePrice',window)&lt;br /&gt;
    if not his :&lt;br /&gt;
        return &lt;br /&gt;
    for stock_code in account.universe:&lt;br /&gt;
        if his.has_key(stock_code)==False:&lt;br /&gt;
            continue&lt;br /&gt;
        avr = np.mean(his[stock_code]) &lt;br /&gt;
        if avr &amp;gt;  his[stock_code][window-1]:&lt;br /&gt;
            account.order(stock_code,3000)&lt;br /&gt;
        else:&lt;br /&gt;
            account.order(stock_code,-3000)&lt;br /&gt;
    return  &lt;br /&gt;
&lt;br /&gt;
 def simulation(initData):&lt;br /&gt;
    account = Account()&lt;br /&gt;
    account.init(initData)&lt;br /&gt;
    result = Result()&lt;br /&gt;
    cj = ConvertJson()&lt;br /&gt;
    read_json = ReadJson()&lt;br /&gt;
    start_date = datetime.datetime.strptime(initData.start,'%Y-%m-%d')&lt;br /&gt;
    end_date = datetime.datetime.strptime(initData.end,'%Y-%m-%d')&lt;br /&gt;
    temp_date = start_date&lt;br /&gt;
    #list_num = ['101001002009']&lt;br /&gt;
    #print 'classify:',account.get_classify_stock(list_num)&lt;br /&gt;
    #print 'plate:',account.get_plate_stock('101001001005')&lt;br /&gt;
    while temp_date &amp;lt;= end_date:&lt;br /&gt;
        str_temp_date = temp_date.strftime('%Y-%m-%d')&lt;br /&gt;
        account.current_day = str_temp_date&lt;br /&gt;
        temp_date = temp_date + datetime.timedelta(days=1)&lt;br /&gt;
        if account.idxmap['datetime'][account.bench_code].has_key(account.current_day) == False&lt;br /&gt;
            continue&lt;br /&gt;
        handle_data(account)&lt;br /&gt;
        if account.time_range &amp;gt;= account.idxmap['datetime'][account.bench_code][account.current_day]: #这是2.X版本和1.X版本的区别，如果是从1.X版本转上来的，需要加上这行代码，其他的不需要考虑&lt;br /&gt;
            continue&lt;br /&gt;
        account.update_daily_account()&lt;br /&gt;
    result.calculate(account)&lt;br /&gt;
    #cj.convert(account,result,'/nfs/disk/work/users/tanghui/platform/data.json')  #放到你的位置下&lt;br /&gt;
    return &lt;br /&gt;
&lt;br /&gt;
 if __name__ == '__main__':&lt;br /&gt;
    start = '2010-05-01'&lt;br /&gt;
    end = '2012-01-01'&lt;br /&gt;
    universe = ['000001.ZICN']&lt;br /&gt;
    #universe = SetUniverse.set_universe(&amp;quot;HS300&amp;quot;)&lt;br /&gt;
    #print 'main_universe:',universe&lt;br /&gt;
    benchmark = 'HS300'&lt;br /&gt;
    captial_base = 100000&lt;br /&gt;
    freq = 'd'&lt;br /&gt;
    refresh_rate = 1&lt;br /&gt;
    initData = InitData(start,end,universe,benchmark,captial_base,freq,refresh_rate) &lt;br /&gt;
    simulation(initData)&lt;br /&gt;
&lt;br /&gt;
版本：1.3&lt;/div&gt;</summary>
		<author><name>Tanghui</name></author>	</entry>

	</feed>