欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商教学与活动专区期货人生 → [原创]Snippet

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2958人关注过本帖树形打印复制链接

主题:[原创]Snippet

帅哥哟,离线,有人找我吗?
z7c9
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[原创]Snippet  发帖心情 Post By:2014/8/21 18:09:56 [显示全部帖子]

????????????????????????????????for?j=0?to?accountnumbers-1
????????????????????????????????????price=reportdata.buyprice1????????????????????????
????????????????????????????????????
????????????????????????????????????lots1=maxlots
????????????????????????????????????if?multiplier>0?then
????????????????????????????????????????lots2=floor((order.account2(6,accountids(j))*riskratio)/(atr*multiplier))
????????????????????????????????????????lots3=floor(order.account2(3,accountids(j))/(price*multiplier*marginratio))
????????????????????????????????????else?
????????????????????????????????????????lots2=0
????????????????????????????????????????lots3=0????
????????????????????????????????????end?if
????????????????????????????????????
????????????????????????????????????lots=fun.min(fun.min(lots1,lots2),lots3)
????????????????????????????????????
????????????????????????????????????if?lots>0?then
????????????????????????????????????????order.buy?0,lots,price,0,code,market,accountids(j),0????
????????????????????????????????????end?if
????????????????????????????????next
[此贴子已经被作者于2014/8/21 18:10:44编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
z7c9
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
  发帖心情 Post By:2014/8/21 18:12:18 [显示全部帖子]

Sub?sendreportforme()??????
????online=False
????
????msg="交易日报:"&vbCrLf
????msg=msg&"-----------------------------"&vbCrLf
????
????For?i=0?To?UBound(accountids)???
????????Dim?yield
????????Dim?yieldrate
????????Dim?aboutmsg
????????
????????getaccountstatus?accountids(i),accountnames(i),yield,yieldrate,aboutmsg
????????
????????If?aboutmsg<>""?Then
????????????online=True
????????????msg=msg&aboutmsg
????????End?If
????Next
????
????If?online?Then????????????
????????sendmail?"Dennis","88@88.com",Now&"【eqfund日报】",msg
????????print("发送交易日报_forme")
????End?If????
End?Sub

 回到顶部
帅哥哟,离线,有人找我吗?
z7c9
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
  发帖心情 Post By:2014/8/21 18:13:12 [显示全部帖子]

Sub?resetgbdata()??????
????For?i=0?To?UBound(accountids)
????????If?order.isaccount(accountids(i))=1?Then
????????????document.setextdata?accountids(i)&"_yieldrate",0
????????????document.setextdata?accountids(i)&"_capital",order.account2(6,accountids(i))
????????End?If
????Next????
????
????print("复位全局变量")
End?Sub

 回到顶部
帅哥哟,离线,有人找我吗?
z7c9
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
  发帖心情 Post By:2014/8/21 18:13:43 [显示全部帖子]

Sub?migrateposition()
????Dim?buyhoding
????Dim?buycost
????Dim?buytodayhoding
????Dim?sellhoding
????Dim?sellcost
????Dim?selltodayhoding
????Dim?pnl
????Dim?usemargin
????Dim?code
????Dim?market
????
????For?i=0?To?UBound(accountids)
????????For?j=0?To?order.holding2(accountids(i))-1
????????????order.holdinginfo2?j,buyholding,buycost,buytodayholding,sellholding,sellcost,selltodayholding,pnl,usemargin,code,market,accountids(i)
????????????Set?myreport=marketdata.getreportdata(code,market)
????????????
????????????If?myreport.ismaininstrument=0?Then?
????????????????order.orderqueue=1
????????????????code1=Left(code,Len(code)-2)&"00"
????????????????
????????????????Set?myreport1=marketdata.getreportdata(code1,market)
????????????????
????????????????If?buyholding>0?Then?
????????????????????order.sell?0,buyholding,myreport.lowerlimitprice,0,code,market,accountids(i),0
????????????????????order.buy?0,buyholding,myreport1.upperlimitprice,0,code1,market,accountids(i),0
????????????????????print(code&"移仓换月到"&code1)
????????????????End?If
????????????????
????????????????If?sellholding>0?Then
????????????????????order.sellshort?0,sellholding,myreport.upperlimitprice,0,code,market,accountids(i),0
????????????????????order.buyshort?0,sellholding,myreport1.lowerlimitprice,0,code1,market,accountids(i),0?
????????????????????print(code&"移仓换月到"&code1)
????????????????End?If?????????????????????
????????????End?If
????????Next
????Next????
End?Sub

 回到顶部
帅哥哟,离线,有人找我吗?
z7c9
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
  发帖心情 Post By:2014/9/9 10:39:42 [显示全部帖子]

sub?exportdata()??
????markets=array("sq","dq","zq","zj","sy")???
????
????set?block=createobject("stock.block")???
????set?fso?=?createobject("scripting.filesystemobject")???
????
????futureday=base&"\\futureday\\"
????futuremin=base&"\\futuremin\\"
????futuretick=base&"\\futuretick\\"
????
????createpath?fso,futureday
????createpath?fso,futuremin
????createpath?fso,futuretick
????
????for?i=0?to?ubound(markets)
????????for?j=0?to?marketdata.getreportcount(markets(i))-1
????????????set?myreport=marketdata.getreportdatabyindex(markets(i),j)
????????????code=myreport.label
????????????market=myreport.marketname
????????????
????????????set?myhistory?=?marketdata.gethistorydata(code,market,0)
????????????
????????????if?myhistory.count>0?then
????????????????set?file?=?fso.createtextfile(futuremin&code&"_min.csv",true)
????????????????for?n=0?to?myhistory.count?-?1
????????????????????file.writeline?myhistory.date(n)&","&myhistory.open(n)&","&myhistory.high(n)&","&myhistory.low(n)&","&myhistory.close(n)&","&myhistory.volume(n)&","&myhistory.openint(n)???
????????????????next????????????
????????????????file.close????????????
????????????end?if
????????????
????????????
????????????set?myhistory?=?marketdata.gethistorydata(code,market,5)
????????????
????????????if?myhistory.count>0?then
????????????????set?file?=?fso.createtextfile(futureday&code&"_day.csv",true)
????????????????for?n=0?to?myhistory.count?-?1
????????????????????file.writeline?myhistory.date(n)&","&myhistory.open(n)&","&myhistory.high(n)&","&myhistory.low(n)&","&myhistory.close(n)&","&myhistory.volume(n)&","&myhistory.openint(n)???????????
????????????????next????????????
????????????????file.close????????????????
????????????end?if
????????????
????????????set?minutedata?=?marketdata.getminutedata(code,market)
????????????
????????????if?minutedata.count>0?then????????
????????????????mydate=convertdate(minutedata.date(n))
????????????????set?file?=?fso.createtextfile(futuretick&code&"_tick_"&mydate&".csv",true)
????????????????for?n=0?to?minutedata.count?-?1
????????????????????file.writeline?minutedata.date(n)&","&minutedata.newprice(n)&","&minutedata.bidprice(n)&","&minutedata.askprice(n)&","&minutedata.volume(n)&","&minutedata.bidvol(n)&","&minutedata.askvol(n)&","&minutedata.openint(n)
????????????????next????????????
????????????????file.close????
????????????end?if????
????????next
????next
????print("导出数据")
end?sub

 回到顶部