Skip to content

Commit

Permalink
add OnOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
bwlee committed Nov 1, 2016
1 parent c52dc5c commit 36fe9ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions MA/matlab/OnOrder.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function [ ] = OnOrder( order )
msg = sprintf('order status changed to %d, filled volume = %d', order(1, 'status'), order(1, 'filled_volume'))
disp(msg);

end
3 changes: 3 additions & 0 deletions MA/matlab/test_bar.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
clear;
% 请注意修改成您的注册掘金用户名和密码
username = '[email protected]';
pwd = '123456';

Expand All @@ -7,6 +8,7 @@
global MA5;
global MA20;

% 请注意第五个参数strategy_id需要更改成您本地终端生成的ID,否则在终端上看不到策略的连接状态和下单。
ret = gm.Init(username,pwd,MDMode.MD_MODE_SIMULATED,'SZSE.000001.bar.60','110ca5d6-a8a1-11e5-a82d-bc855616490f','localhost:8001');

if ret ~= 0
Expand All @@ -18,5 +20,6 @@
gm.SetBarHandle(@OnBar);
gm.SetLoginHandle(@OnLogin);
gm.SetErrorHandle(@OnError);
gm.SetOrderHandle(@OnOrder);

gm.Run();

0 comments on commit 36fe9ca

Please sign in to comment.