File tree 2 files changed +51
-1
lines changed
2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change
1
+ %% ����C#�⣬�밴�Լ�Ŀ¼���е���
2
+ cd 'd:\wukan\Documents\GitHub\QuantBox_XAPI\Matlab\test'
3
+ NET.addAssembly(fullfile(cd,'QuantBox.XAPI.dll'));
4
+
5
+ import QuantBox.XAPI.Event.*;
6
+
7
+ %% ����
8
+ global md;
9
+ md = XApiWrapper('QuantBox_CTP_Quote.dll');
10
+ md.Server.BrokerID = '1017';
11
+ md.Server.Address = 'tcp://ctpmn1-front1.citicsf.com:51213;';
12
+
13
+ md.User.UserID = '00000015';
14
+ md.User.Password = '123456';
15
+
16
+ addlistener(md,'OnConnectionStatus',@OnMdConnectionStatus);
17
+ addlistener(md,'OnRtnDepthMarketData',@OnRtnDepthMarketData);
18
+
19
+ md.Connect();
20
+
21
+ %% ����
22
+ global td;
23
+ td = XApiWrapper('QuantBox_CTP_Trade.dll');
24
+ td.Server.BrokerID = '1017';
25
+ td.Server.Address = 'tcp://ctpmn1-front1.citicsf.com:51205;';
26
+
27
+ td.User.UserID = '00000015';
28
+ td.User.Password = '123456';
29
+
30
+ addlistener(td,'OnConnectionStatus',@OnTdConnectionStatus);
31
+ addlistener(td,'OnRtnOrder',@OnRtnOrder);
32
+
33
+ td.Connect();
34
+
35
+ %% �µ�
36
+ order1 = BuyLimit('IF1502',1,3000)
37
+ disp(order1)
38
+
39
+ %% ����
40
+ td.CancelOrder(order1);
41
+
42
+ %% �˳�
43
+ % md.Dispose() %�����˳�
44
+ % td.Dispose() %�����˳�
Original file line number Diff line number Diff line change 10
10
11
11
实现统一的结构体必然会有些API的特殊字段没法照顾到;调用方式统一则有些功能将不会实现,而有些功能需要几个请求,或本机模拟的方法来实现;加载方式以前C#层是用的P/Invoke,现在改用LoadLibraryEx/dlopen来实现。
12
12
13
- ## 如何使用
13
+ ## 如何使用C#版
14
14
编译QuantBox.XAPI,有两种输出方式
15
15
16
16
1 . 生成QuantBox.XAPI.dll,设置输出类型为类库,可以在其它项目中引用
38
38
39
39
4 . 将CTP的两个文件\* .so前面加lib复制到/usr/lib下
40
40
41
+ ## 如何使用C++版
42
+ 直接参考QuantBox_XAPI_TEST项目即可,简单的行情订阅,下单撤单
43
+
44
+ ## 如何使用C版
45
+ 参考QuantBox_XAPI这个项目中的CXApi与CXSpi是如何实现的
46
+
41
47
## 如何开发新的接口
42
48
1 . 模仿已经提供的几个项目即可
43
49
You can’t perform that action at this time.
0 commit comments