www.gusucode.com > trading工具箱matlab源码程序 > trading/trading/@fixflyer/orderInfo.m
function orderData = orderInfo(f,varargin) %ORDERINFO FIX Flyer order status and information. % ORDERDATA = ORDERINFO(F) returns information for all orders % associated with the FIX Flyer connection object, F. % % ORDERDATA = ORDERINFO(F,REST) returns the information for the % orders defined by the rest command, REST. The valid values of REST are % % 'all' - (default) get information for all orders. % 'closed' - get information for closed orders. % 'open' - get information for open orders. % % ORDERDATA = ORDERINFO(F,REST,ID) returns information for the orders % described the input parameter ID. The valid values of REST in this % case are % % 'clientorderid' - returns information for orders associated with a given client id. % 'orderstatus' - returns information for orders with a given order status. % 'securityid' - returns information for orders with a given security id. % 'symbol' - returns information for orders with a given symbol. % % For example, % % orderData = orderInfo(f,'open') % % returns a MATLAB table with information for all open orders. % % orderData = orderInfo(f,'symbol','XYZ') % % returns information for all orders for the symbol XYZ. % % See also FIXFLYER, SENDMESSAGE. % Copyright 2016 The MathWorks, Inc. % Build url prefix given ipaddress and port urlPrefix = ['http://' f.Ipaddress ':' num2str(f.RestPort) '/rest/orders/']; % Default rest call is get all orders if nargin == 1 restCall = 'all'; else restCall = varargin{1}; end % Build url suffix switch lower(restCall) case 'all' urlSuffix = 'getAll'; case 'clientorderid' urlSuffix = ['getByClientOrderId?clientOrderId=' varargin{2}]; case 'closed' urlSuffix = 'getClosed'; case 'open' urlSuffix = 'getOpen'; case 'orderstatus' urlSuffix = ['getByOrderStatus?orderStatus=' varargin{2}]; case 'securityid' urlSuffix = ['getBySecurityId?securityId=' varargin{2}]; case 'symbol' urlSuffix = ['getBySymbol?symbol=' varargin{2}]; otherwise error(message('trading:fixflyer:invalidOrderInfo'),restCall) end % Request order information url = [urlPrefix urlSuffix]; orderData = webread(url);