Skip to content

openquant2014引用QuantBox.APIProvider和XAPI3的CSharp版本新手指南 #5

@zhuce2022

Description

@zhuce2022

经过请教伍侃老师,终于弄清楚怎么引用新版XAPI3和APIProvider,写在这里作为记录,也指导一下新手吧。

1、在sfit下载最新版ctp_api
V6.6.1_P1_20210407_tradeapi
http://www.sfit.com.cn/DocumentDown/api_3/5_2_2/v6.6.1_P1_tradeapi.zip

2、压缩包内的win64目录下各种c++源文件覆盖XAPI3/include/CTP_SE/目录下的同名文件。
3、压缩包内的dl和lib复制到XAPI3/include/CTP_SE/win64目录
4、设置Release64模式编译,把编译后的CTP_SE_Quote_x64.dll和CTP_SE_Trade_x64.dll以及压缩包内的thostmduserapi_se.dll、thosttraderapi_se.dll放到D:\XAPI\CTP_SE(该目录可以自定义)
5、用X64模式编译XAPI_CSharp、QuantBox.APIProvider、QuantBox.Extension,把三个编译后的dll放到openquant2014安装目录。
6、编辑“C:\Users\xxx\AppData\Roaming\SmartQuant Ltd\OpenQuant 2014\config\configuration.xml”文件,在相关地方加入

<Provider>
      <TypeName>QuantBox.APIProvider.ProviderHost, QuantBox.APIProvider</TypeName>
      <Id>0</Id>
      <X64>true</X64>
    </Provider>

7、启动运行oq2014,会自动在C:\Users\xxx\AppData\Roaming\SmartQuant Ltd\OpenQuant 2014\config\目录下创建API_Host.json文件,编辑该文件,内容为:

[
  {
    "Id": 55,
    "Name": "simnow"
  }
]

8、重新启动oq2014,会自动创建目录C:\Users\xxx\AppData\Roaming\SmartQuant Ltd\OpenQuant 2014\config\simnow,在该目录下会自动新建4个文件,其中三个文件需要手工修改,分别是:
ApiList.json

[
  {
    "DllPath": "d:\\XAPI\\CTP_SE\\CTP_SE_Quote_x64.dll",
    "TypeName": "XAPI.Callback.XApi, XAPI_CSharp",
    "Name": "CTP_SE",
    "Version": "0.4.0.20190417",
    "User": 0,
    "Server": 0,
    "LogPrefix": null,
    "Type": 10,
    "UseType": 10
  },
  {
    "DllPath": "d:\\XAPI\\CTP_SE\\CTP_SE_Trade_x64.dll",
    "TypeName": "XAPI.Callback.XApi, XAPI_CSharp",
    "Name": "CTP_SE",
    "Version": "0.4.0.20190418",
    "User": 0,
    "Server": 1,
    "LogPrefix": null,
    "Type": 97,
    "UseType": 97
  }
]

ServerList.json

[
  {
    "Label": "simnow_m",
    "Path": "d:\\XAPI\\CTP_SE\\server_m.json"
  },
  {
    "Label": "simnow_t",
    "Path": "d:\\XAPI\\CTP_SE\\server_t.json"
  }
]

UserList.json

[
  {
    "Label": "111111",
    "Path": "d:\\XAPI\\CTP_SE\\user.json"
  }
]

9、改好以上三个文件后,重新启动oq2014,会在D:\XAPI\CTP_SE目录自动创建三个文件,根据自己的实际情况填写文件内容。即可正常使用插件。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions