Excel股票自动生意业务VBA接口

股票自动生意业务--VB,VBA,Excel 下单接口

股票自动生意业务软件助手的 Order.dll 自动下单接口不只仅能在大伶俐,通达信,飞狐等软件公式里挪用,也可以在Excel 里通过VBA(Visiual basic for Application)措施里挪用,Excel 在数据统计和展示上都很强大,有些生意业务者喜欢用excel举办量化生意业务,股票自动生意业务助手可以辅佐你实此刻Excel里读取持仓数据,挪用股票生意业务接口举办生意业务下单。为量化生意业务打下基本。


C++需要的可参考C++ 和 C#挪用例子或 Python 例子。

Excel读取持仓和挪用生意业务下单接口 运行例子下载     

下载后压缩,有两个文件,StockOrderApiSample.xlsm , Order.dll, 用 Excel 打开 StockOrderApiSample.xlsm

留意:Excel要启动宏,不然不能正常运行,确保已经安装了 VBA。如果提示 “找不到 Order.dll” ,旅游,请把 Order.dll复制到 office 的安装目次。

运行功效如下

点击 下单按钮 ,旅游,调出下单测试界面


如果提示 “找不到 Order.dll” ,请把 Order.dll复制到 office 的安装目次。先运行excel,再从Excel菜单打开文件,不要直接双击打开文件

请把 Order.dll复制到 office 的安装目次。

VB - Excel 自动生意业务下单接口挪用源码

'一个Excel VBA 读取股票持仓并可挪用生意业务接口自动下单的例子 '需要 Order.dll ,并 共同股票自动生意业务助手利用 '买入股票函数 Public Declare Function Buy Lib "Order.dll" Alias "_Buy1@20" (ByVal stkCode As String, ByVal vol As Integer, ByVal price As Single, ByVal formulaNum As Integer, ByVal ZhuShouHao As Integer) As Integer '卖出股票函数 Public Declare Function Sell Lib "Order.dll" Alias "_Sell1@20" (ByVal stkCode As String, ByVal vol As Integer, ByVal price As Single, ByVal formulaNum As Integer, ByVal ZhuShouHao As Integer) As Integer '按照股票代码可能股票的持仓数据 Public Declare Function GetPosInfo Lib "Order.dll" Alias "_GetPosInfo@12" (ByVal stkCode As String, ByVal nType As Integer, ByVal ZhuShouHao As Integer) As Single '获取账户资金数据 Public Declare Function GetAccountInfo Lib "Order.dll" Alias "_GetAccountInfo@12" (ByVal stkCode As String, ByVal nType As Integer, ByVal ZhuShouHao As Integer) As Single Private Declare Sub GetAllPositionCodeA Lib "Order.dll" Alias "_GetAllPositionCodeA@12" (ByVal lpString As String, ByVal cch As Long, ByVal ZhuShouHao As Integer) '获取所有持仓股代码 Public Function GetAllPositionCode(ByVal ZhuShouHao As Integer) As String Dim lpString As String lpString = Space(8112) GetAllPositionCodeA lpString, 8112, ZhuShouHao GetAllPositionCode = lpString End Function Public Function ToUnicode(ByVal str As String) As String ToUnicode = StrConv(str, vbUnicode) End Function Public Function FromUnicode(ByVal str As String) As String FromUnicode = str ' StrConv(str, vbFromUnicode) End Function Public Sub RefreshPosition() Application.ScreenUpdating = False Dim she1 As Worksheet Set she1 = Sheets("Sheet1") she1.Range("A2:G500").Clear strAllCodes = GetAllPositionCode(0) Dim codeArray As Variant codeArray = Split(strAllCodes, ",") For i = 0 To UBound(codeArray) nrow = i + 2 she1.Cells(nrow, 1).NumberFormatLocal = "@" she1.Cells(nrow, 1) = codeArray(i) she1.Cells(nrow, 2).NumberFormatLocal = "@" she1.Cells(nrow, 2) = codeArray(i) she1.Cells(nrow, 3) = GetPosInfo(ToUnicode(codeArray(i)), 0, 0) she1.Cells(nrow, 4) = GetPosInfo(ToUnicode(codeArray(i)), 1, 0) she1.Cells(nrow, 5) = GetPosInfo(ToUnicode(codeArray(i)), 2, 0) profit = CInt(GetPosInfo(ToUnicode(codeArray(i)), 3, 0)) she1.Cells(nrow, 5).NumberFormat = "0.00" she1.Cells(nrow, 6) = profit If profit > 0 Then she1.Cells(nrow, 7).Interior.Color = RGB(255, 0, 0) she1.Cells(nrow, 6).Interior.Color = RGB(255, 0, 0) ElseIf profit < 0 Then she1.Cells(nrow, 7).Interior.Color = RGB(0, 255, 0) she1.Cells(nrow, 6).Interior.Color = RGB(0, 255, 0) Else she1.Cells(nrow, 7).Interior.Color = RGB(255, 255, 255) she1.Cells(nrow, 6).Interior.Color = RGB(255, 255, 255) End If 'she1.Cells(nRow, 7).NumberFormatLocal = "@" she1.Cells(nrow, 7) = str(GetPosInfo(ToUnicode(codeArray(i)), 4, 0)) + "%" she1.Cells(nrow, 8) = GetPosInfo(ToUnicode(codeArray(i)), 5, 0) Next Application.ScreenUpdating = True End Sub Public Sub StartTimer() RefreshPosition Application.OnTime Now + TimeValue("00:00:05"), "StartTimer" End Sub Public Sub EndTimer() Application.OnTime Now + TimeValue("00:00:01"), "StartTimer", False End Sub

支持VB开放接口也是 股票自动生意业务助手和机警股票自动生意业务软件, A打算自动生意业务软件,小闪客自动生意业务软件,SNB股票自动生意业务朋侪等软件的区别之一。

内容版权声明:内容均来自于网络,如有侵权行为请发送邮件至3530594566@qq.com,我们将在第一时间删除