等级: 超级版主
- 注册:
- 2021-5-24
- 曾用名:
|
Dim NewStockStatus '该标志用来标记属于VBA的查询,防止手工查询新股申购时自动申购
NewStockStatus = 0
Sub APPLICATION_Timer(ID)
If Id = 0 Then
If Time = "09:45:00" Then
'执行新股申购查询
NewStockStatus = 1
Order.ReqNewStockInfo ""
End If
If Time = "09:46:00" Then
'一分钟后停止标记
NewStockStatus = 0
End If
If Time = "09:50:00" Then
'查询是否中签
Order.ReqNewStockLotInfo ""
End If
End If
End Sub
Sub APPLICATION_VBAStart()
Application.SetTimer 0,1000
End Sub
Sub ORDER_ActionNotify(Types, Account, Data)
If Types = 2 And Data > 0 And NewStockStatus = 1 Then
'当新股申购查询返回直接处理申购事宜
NewStockPleaceOrder(Data)
End If
If Types = 3 And Data > 0 Then
'当查询到中签新股后,触发语音播报消息
SpkSound
End If
End Sub
'该过程对已经查询过的当日可申购新股做自动申购操作
Sub NewStockPleaceOrder(Count)
Dim Code
Dim Name
Dim Market
Dim Price
Dim Upperlimit
Dim Lowerlimit
NewSize = Count
For I = 0 To NewSize - 1
Ret = Order.GetNewStockInfo(i,"",Code,Name,Market,Price,Upperlimit,Lowerlimit)
If Ret = 1 Then
'满额申购新股
MaxVol = Order.GetNewStockMaxVol("",Market)
If MaxVol > 0 Then
call Order.PleaceOrderNewStock(Code,Market,Price,MaxVol,"")
Application.MsgOut "已经处理新股委托"&Code&"--"&Name
End If
Set Code = NoThing
Set Name = NoThing
Set Market = NoThing
End If
Next
End Sub
Sub SpkSound
Set Spk = CreateObject("SAPI.SpVoice")
Spk.Speak "恭喜您,新股中签啦"
Set Spk = nothing
Application.PlaySoundFile "OptimizeComplete.wav"
End Sub
|
|