-
Notifications
You must be signed in to change notification settings - Fork 21
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
Defining Futures Contracts #16
Comments
Thanks for reaching out.
You should just be able to configure a contract any way you like and request data or place orders etc.
Create a contract object with
> contract = com.ib.client.Contract()
and then have a look at the fields of the object
> fields(contract)
ans =
18×1 cell array
'm_conId'
'm_symbol'
'm_secType'
'm_expiry'
'm_strike'
'm_right'
'm_multiplier'
'm_exchange'
'm_currency'
'm_localSymbol'
'm_tradingClass'
'm_primaryExch'
'm_includeExpired'
'm_secIdType'
'm_secId'
'm_comboLegsDescrip'
'm_comboLegs'
'm_underComp'
See link below for how to configure various contracts:
https://interactivebrokers.github.io/tws-api/basic_contracts.html#gsc.tab=1 <https://interactivebrokers.github.io/tws-api/basic_contracts.html#gsc.tab=1>
Don’t hesitate to reply if you need anything additional or have more questions.
… On Nov 27, 2017, at 6:39 PM, bginvestor ***@***.***> wrote:
Hi Abel,
Say, I need a little help with downloading historical FUTURES contract data. Can you please help?
Here's the equivalent commands in IB Trader Workstation format. Thank you!
PS Is there a disconnection command necessary to disconnect a TWS session using your code ? How does that work? Thank you!!!
Brian
symbol = 'ES';
ib = ibtws('',7496);
ibContract = ib.Handle.createContract;
ibContract.symbol=symbol;
ibContract.secType='FUT';
ibContract.expiry='201712';
ibContract.exchange='GLOBEX';
ibContract.currency='USD';
startdate = floor(now)-.5;
enddate = now;
barsize = '15 mins';
d = timeseries(ib,ibContract,startdate,enddate,barsize);
close(ib)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#16>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1CaWOPejQVofgSxHRfe68kOWj_ibks5s63JOgaJpZM4Qsmft>.
|
Thank you!
Sent from Mail for Windows 10
From: Abel Brown
Sent: Tuesday, November 28, 2017 5:42 PM
To: softwarespartan/IB4m
Cc: bginvestor; Author
Subject: Re: [softwarespartan/IB4m] Defining Futures Contracts (#16)
Thanks for reaching out.
You should just be able to configure a contract any way you like and request data or place orders etc.
Create a contract object with
> contract = com.ib.client.Contract()
and then have a look at the fields of the object
> fields(contract)
ans =
18×1 cell array
'm_conId'
'm_symbol'
'm_secType'
'm_expiry'
'm_strike'
'm_right'
'm_multiplier'
'm_exchange'
'm_currency'
'm_localSymbol'
'm_tradingClass'
'm_primaryExch'
'm_includeExpired'
'm_secIdType'
'm_secId'
'm_comboLegsDescrip'
'm_comboLegs'
'm_underComp'
See link below for how to configure various contracts:
https://interactivebrokers.github.io/tws-api/basic_contracts.html#gsc.tab=1 <https://interactivebrokers.github.io/tws-api/basic_contracts.html#gsc.tab=1>
Don’t hesitate to reply if you need anything additional or have more questions.
On Nov 27, 2017, at 6:39 PM, bginvestor ***@***.***> wrote:
Hi Abel,
Say, I need a little help with downloading historical FUTURES contract data. Can you please help?
Here's the equivalent commands in IB Trader Workstation format. Thank you!
PS Is there a disconnection command necessary to disconnect a TWS session using your code ? How does that work? Thank you!!!
Brian
symbol = 'ES';
ib = ibtws('',7496);
ibContract = ib.Handle.createContract;
ibContract.symbol=symbol;
ibContract.secType='FUT';
ibContract.expiry='201712';
ibContract.exchange='GLOBEX';
ibContract.currency='USD';
startdate = floor(now)-.5;
enddate = now;
barsize = '15 mins';
d = timeseries(ib,ibContract,startdate,enddate,barsize);
close(ib)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#16>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1CaWOPejQVofgSxHRfe68kOWj_ibks5s63JOgaJpZM4Qsmft>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Just a quick comment on this subject... In order to download expired futures contracts, you have to include m_includeExpired when setting up contracts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Abel,
Say, I need a little help with downloading historical FUTURES contract data. Can you please help?
Here's the equivalent commands in IB Trader Workstation format. Thank you!
PS Is there a disconnection command necessary to disconnect a TWS session using your code ? How does that work? Thank you!!!
Brian
symbol = 'ES';
ib = ibtws('',7496);
ibContract = ib.Handle.createContract;
ibContract.symbol=symbol;
ibContract.secType='FUT';
ibContract.expiry='201712';
ibContract.exchange='GLOBEX';
ibContract.currency='USD';
startdate = floor(now)-.5;
enddate = now;
barsize = '15 mins';
d = timeseries(ib,ibContract,startdate,enddate,barsize);
close(ib)
The text was updated successfully, but these errors were encountered: