找回密码
 加入
搜索
查看: 3544|回复: 0

[网络通信] [已解决]怎么获取期货的实时行情数据,我找了VB的代码。帮我看看吧!

[复制链接]
发表于 2015-1-19 16:09:15 | 显示全部楼层 |阅读模式
本帖最后由 zhouhaijin 于 2015-1-20 22:41 编辑

我搞错了!!!!



刚测试了下超版afan说的新浪的http://hq.sinajs.cn/list=CFF_RE_IF1502速度是很快,不过数据不实时,15秒刷新一次,有点慢。

各位老师请指点下。谢谢!!!

下面是VB的代码,au3怎么获取OnMarketData事件的消息,ObjEvent 的参数我不知道该怎么填。不知道对象是哪个。
Dim WithEvents ctp As ICTPClientAPI

Private Sub Login_Click()

    Dim errorID As Long
    Dim succ As Long
    
    Set ctp = New CTPCOMLib.ICTPClientAPI
    
    Call ctp.Login("config.xml", "00100", "888888", errorID)
    If errorID = 0 Then
       MsgBox "登录ok"
    Else
        MsgBox "登录错误:" & errorID
    End If

End Sub

Private Sub Buy_Click()
    Dim OrderID As Long
    Dim index As Integer
    Dim tm1, tm2 As Date
    
    Call ctp.Buy("IF1008", 1, 0, OrderID)

End Sub

Private SubMD_Click()
    Call ctp.SubscribeMD("IF1008")
End Sub

Private Sub Close_Click()
    Set ctp = Nothing
    
End Sub

Private Sub Sell_Click()
    Dim OrderID As Long
    
    Call ctp.Sell("IF1008", 1, 0, OrderID)
End Sub

Private Sub ctp_OnAccount(ByVal PreBalance As Double, ByVal Balance As Double, ByVal Available As Long, ByVal Commission As Double, ByVal FrozenCommission As Double, ByVal Margin As Double, ByVal FrozenMargin As Double, ByVal CloseProfit As Double, ByVal PositionProfit As Double)
    Label1.Caption = Available
End Sub

Private Sub ctp_OnMarketData(ByVal InstrumentID As String, ByVal BidPrice1 As Double, ByVal BidVolume1 As Long, ByVal AskPrice1 As Double, ByVal AskVolume1 As Long, ByVal OpenPrice As Double, ByVal HighestPrice As Double, ByVal LowestPrice As Double, ByVal LastPrice As Double, ByVal OpenInterest As Long, ByVal Volume As Long, ByVal UpperLimitPrice As Double, ByVal LowerLimitPrice As Double, ByVal PreSettlementPrice As Double, ByVal AveragePriceAs Double,ByVal UpdateTime As String, ByVal UpdateMilliSecond As Long)
        
End Sub

Private Sub ctp_OnPosition(ByVal InstrumentID As String, ByVal IsLong As Long, ByVal Volume As Long, ByVal CloseProfit As Double, ByVal PositionProfit As Double, ByVal TotalClosable As Long, ByVal TodayClosable As Long)
    Label2.Caption = Volume
  
End Sub
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-26 21:25 , Processed in 0.079364 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表