MATLAB Answers

0

Why am I encountering unrecognized property 'expiry' error while accessing the contact data?

Why am I encountering unrecognized property 'expiry' error while accessing the contact data?
I am trying to create a contract and get the Interactive Brokers data, but I am encountering the following error messages for the below code snippet:
>> ibs = ibtws('',7496);
>> pause(1);
>> ibContractData = ibs.Handle.createContract;
>> ibContractData.symbol = 'EUR';
>> ibContractData.secType = 'FUT';
>> ibContractData.exchange = 'GLOBEX';
>> ibContractData.expiry='201806';
>> ibContractData.currency = 'USD';
>> rtd=getdata(ibs,ibContractData)
>> close(ibs);
Unrecognized property 'expiry' for class 'Interface.AE6A66F3_8FA9_4076_9C1F_3728B10A4CC7'.
Error in Untitled (line 9)
ibContractData.expiry='201806';

Products


Release

R2018a

2 Answers

Answer by MathWorks Support Team on 13 Jun 2018
 Accepted Answer

You are encountering the error messages because there is no "expiry" property for the "ibContractData".
To resolve this issue, you need to use the property "LastTradeDateOrContractMonth" as follows:
>> ibContractData.LastTradeDateOrContractMonth = '201806';

  1 Comment

well, I used the getdata function, and recieved error message : Unable to read beyond the end of the stream. Any problem with my code ??
ib = ibtws('',7496);
ibContract = ib.Handle.createContract;
ibContract.symbol = 'ES';
ibContract.secType = 'FUT';
ibContract.exchange = 'GLOBEX';
ibContract.currency = 'USD';
ibContract.LastTradeDateOrContractMonth = '201903';
temp = getdata(ib,ibContract); % this is the getdata formula

Sign in to comment.


Answer by Yair Altman on 29 Jun 2018

IB renamed the Expiry property to "LastTradingDay" or "LastTradeDateOrContractMonth" (depending on the specific use-case) in its API release 9.72 (use with TWS version 959 or higher): https://www.interactivebrokers.com/en/index.php?f=23565#972-10
Yair Altman

  0 Comments

Sign in to comment.