Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Historical data through ISIN #136

Open
achille1112 opened this issue Aug 20, 2021 · 0 comments
Open

Request Historical data through ISIN #136

achille1112 opened this issue Aug 20, 2021 · 0 comments

Comments

@achille1112
Copy link

achille1112 commented Aug 20, 2021

Hi,
I have a problem when I search for a stock through ISIN.
For example if I want to download historical data of the BAYN stock through ISIN:

clear all; close all; clc;

percorso = 'W:\Software\IB4m-master\IB4m-master';

addpath(percorso); addpath(percorso,fullfile(percorso,'docs'))
javaaddpath(fullfile(percorso,'Jar','TWS973.jar'))

% initialize session with TWS
session = TWS.Session.getInstance();

% create local buffer for historical data events 
[buf,lh] = TWS.initBufferForEvent({
    TWS.Events.HISTORICALDATA,...
    });

% connect to TWS
session.eClientSocket.eConnect('127.0.0.1',7496,0);

pause(1)

contract = com.ib.client.Contract();

% contract.symbol('BAYN')
% contract.exchange('SMART');
% contract.primaryExch('IBIS');
% contract.currency('EUR');
% contract.secType('STK');

contract.exchange('SMART');
contract.primaryExch('IBIS');
contract.currency('EUR');
contract.secType('STK');
contract.secId('DE000BAY0017');
contract.secIdType('ISIN');

tickerId = 1000001;
endDateTime = [datestr(today,'yyyymmdd') ' 00:00:00'];
durationString = '1 Y';
barSizeSetting = '1 day';
whatToShow = 'TRADES';
useRTH = 1;
formatDate = 1;
keepUpToDate = false;

% ix = 0; while(isEmpty(buf) && ix < 100); ix = ix+1; pause(0.1); end

% request historical data for our contract for a year w/ 1-day bars
session.eClientSocket.reqHistoricalData(1000001,contract,endDateTime,durationString,barSizeSetting,whatToShow,useRTH,formatDate,keepUpToDate,[]); pause(0.5);

I obtain the following error:

The symbol or the local-symbol or the security id must be entered

How come I get this error?

Best Regards
Domenico.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant