Matlab 2018 IB TWS Sending Market Order Failure : cannot find method 'placeOrderEx' for class 'COM.TWS_TwsCtrl'
1 次查看(过去 30 天)
显示 更早的评论
Hi guys,
I am trying to send market order to purchase 1 ES contract, using Trading Tool box command, and encountered error message : cannot find method 'placeOrderEx' for class 'COM.TWS_TwsCtrl',
I'm using Matlab 2018a, the code can connect to TWS, any body has seen this before ?
ib = ibtws('',7496);
pause(0.2)
ibContract = ib.Handle.createContract;
ibContract.symbol = 'ES'; % 'SPXL';
ibContract.secType = 'FUT'; % 'STK';
ibContract.exchange = 'GLOBEX'; % 'SMART'; 'GLOBEX'; 'ECBOT' for YM contract
ibContract.currency = 'USD'; % 'USD';
ibContract.LastTradeDateOrContractMonth = '201903';
ibMktOrder = ib.Handle.createOrder;
ibMktOrder.action = 'BUY'; % 'BUY';
ibMktOrder.totalQuantity = 1; % 100;
ibMktOrder.orderType = 'MKT'; % 'MKT' or 'LMT'
%%% Send Order
id = orderid(ib);
result_send_order = createOrder(ib,ibContract,ibMktOrder,id);
Best regards
Terry
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Financial Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!