因为你这里没有下单语句 所以隔夜单必须要用事件捕捉。
其余代码如下,写出了大致思路,仅供参考,需要微调 有问题可以继续咨询
dim aa
aa=99999
dim aa1
aa1=50000
dim aa2
aa1=25000
sub application_vbastart()
call marketdata.regreportnotify("if12","zj")
end sub
'public filltime
sub marketdata_reportnotify(reportdata)
dim i
dim BuyHold
dim BuyCost
dim SellHold
dim SellCost
dim CurCode
dim CurMarket
a1=order.Account(3)
call application.msgout(a1)
if a1<aa then
call application.msgout("可用资金小于了aa")
end if
if a1<aa1 then
call application.msgout("可用资金小于了aa1")
HoldingCount=Order.Holding2("88")
If HoldingCount>0 then
For i=0 to HoldingCount-1
Call Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,Code,Market,sAccount)
CurCode=Code
CurMarket=Market
BuyHold=BuyHolding
SellHold=SellHolding
if BuyHold>0 then
call order.Sell(1,BuyHold,0,CurCode,CurMarket,"88",0)
end if
if SellHold>0 then
call order.Sell(1,BuyHold,0,CurCode,CurMarket,"88",0)
end if
NEXT
end if
end if
end sub