www.gusucode.com > trading工具箱matlab源码程序 > trading/tradingdemos/IBHistoricalDataWorkflow.m

    %% Interactive Brokers Historical Data Workflow Example

% Connect to Interactive Brokers Trader Workstation
ib = ibtws('',7496);

% Create contract and request historical data
ibContract = ib.Handle.createContract;
ibContract.symbol = 'ELY';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.currency = 'USD';
d = ib.history(ibContract,floor(now)-5,floor(now));
close(ib)