以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 期货人生 (http://222.73.7.161/bbs/list.asp?boardid=7) ---- [原创]Snippet (http://222.73.7.161/bbs/dispbbs.asp?boardid=7&id=69089) |
-- 作者:z7c9 -- 发布时间:2014/8/21 18:09:56 -- [原创]Snippet ????????????????????????????????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 -- 发布时间: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 -- 发布时间: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 -- 发布时间: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 -- 发布时间: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 |
-- 作者:chacterchen -- 发布时间:2014/9/13 13:29:09 -- 似乎是好东西,但没有任何解释的代码段别人是无法看懂的,能写一下帮助文件吗? |