observation: contract id's can change
I'm just sharing an observation about behavior I recently observed (maybe just since this weekend's reset).
The context for this is that I have always considered contract id's to be the persistent thing. It is what you want to save overnight to be sure your stuff will load again correctly the next day if exchanges have decided to change a ticker symbol. I used to rely on this assumption in pre-OSI days when option symbols could change overnight, e.g. when leaps ceased to be leaps anymore.
So for example some months ago, RIMM changed to BBRY. But when that occurred the contract id stayed the same. So from my archives I originally had this association
RIMM 4817436
which subsequently became this
BBRY 4817436
which is what has been working for months and is what I had in effect a few days ago last time I looked at this stock via the API.
My logic relied on the contract id being persistent.
But the contract id for BBRY apparently changed in recent days with the new association being
BBRY 131217639
and I wonder why this is so. If there had been something like a merger I think the symbol would have changed. Maybe it is just IB working around some screw-up they made.
Not a big deal but I thought it worth mentioning.
-Kurt
|
implementation questions (starting out)
Hello everyone,
I am trying to make sense of the api so that I can write my own C++ code to work with IB. The goal of my project is to connect to IB, retrieve data and work with data to execute orders (all in console or background with no gui).
To me it seems that to connect to IB you use a pointer to a Eclient object.
eclient_ptr -> eConnect(parameters)
Is this all one needs to connect?
After connection I want to retrieve stock data (tick prices or minute resolution prices of a particular stock). Is the idea the same? I make a ptr to EWrapper class and call on methods?
Does the pointer contain the information to retrieve the data so that I can use it?
If someone can write a out pseudocode or some explanation on how this can be done... it would be much appreciated.
Thanks!
|
Re: TwsActivex.xls cannot "request account updates"??
OK,
If you want to force the account to be updated, What I do is to cancel the account updates first and then request it again. I did that behind a button to "force a refresh" of the account and the portfolio, I did it in this way
Public Sub Refresh_Click() Application.ScreenUpdating = False Call ThisWorkbook.Sheets(SHEET_NAME_ACCOUNT).CancelAccountDataSubscription Call ThisWorkbook.Sheets(SHEET_NAME_ACCOUNT).RequestAccountUpdates_Click Application.ScreenUpdating = True End Sub
I hope its useful,
JP
toggle quoted message
Show quoted text
--- In TWSAPI@..., virusnme <no_reply@...> wrote:
JP, I had figured out that I had to call that particular sub-routine to request updates but my problem is slightly different (which I realised I have not articulated correctly in my original post)
If I create a "button" on a sheet and assign a macro that calls that subroutine, it works perfectly when I click on the button. However, If I call the macro (that calls that subroutine) from within a VBA then the excel sheet does not get populated. I suspect that the excel sheet is not being updated even though the request has successfully been forwarded and the account data has been successfully transmitted from Gateway to Excel sheet. Any advice?
--- In TWSAPI@..., "jpgarciaa" <jpgarciaa@> wrote:
This is the method you should call to request account updates objTWSControl.m_TWSControl.reqAccountUpdates(True, accountName)
If you are managing more than one account, make sure to use the right one. Change to False if you want to cancel the updates.
JP
--- In TWSAPI@..., virusnme <no_reply@> wrote:
I use TwsActiveX.xls excel sheet to connect to IB Gateway. The connection between IB Gateway and TwsActiveX.xls is fairly stable. However, on occasions when IB Gateway loses connection to IB Server, TwsActiveX.xls loses connection to IB Gateway. Eventually, IB Gateway reinstates a connection to IB server. And I will have to ensure that TwsActivex.xls reconnects to IB Gateway (via VBA).
I have figured out how to re-connect the TwsActivex.xls to IB Gateway but I am not able to "request account updates" via VBA! If anyone has figured out how to do it please do let me know.
|
Re: TwsActivex.xls cannot "request account updates"??
JP, I had figured out that I had to call that particular sub-routine to request updates but my problem is slightly different (which I realised I have not articulated correctly in my original post)
If I create a "button" on a sheet and assign a macro that calls that subroutine, it works perfectly when I click on the button. However, If I call the macro (that calls that subroutine) from within a VBA then the excel sheet does not get populated. I suspect that the excel sheet is not being updated even though the request has successfully been forwarded and the account data has been successfully transmitted from Gateway to Excel sheet. Any advice?
toggle quoted message
Show quoted text
--- In TWSAPI@..., "jpgarciaa" <jpgarciaa@...> wrote: This is the method you should call to request account updates objTWSControl.m_TWSControl.reqAccountUpdates(True, accountName)
If you are managing more than one account, make sure to use the right one. Change to False if you want to cancel the updates.
JP
--- In TWSAPI@..., virusnme <no_reply@> wrote:
I use TwsActiveX.xls excel sheet to connect to IB Gateway. The connection between IB Gateway and TwsActiveX.xls is fairly stable. However, on occasions when IB Gateway loses connection to IB Server, TwsActiveX.xls loses connection to IB Gateway. Eventually, IB Gateway reinstates a connection to IB server. And I will have to ensure that TwsActivex.xls reconnects to IB Gateway (via VBA).
I have figured out how to re-connect the TwsActivex.xls to IB Gateway but I am not able to "request account updates" via VBA! If anyone has figured out how to do it please do let me know.
|
Re: OCA order types and place in order queue
It appears that the default behavior (if you don't specify ocaType) is non-blocking, reduce proportionally. If I don't specify ocaType, I get the behavior as you described. And if I set ocaType to 3 (non-blocking, reduce proportionally) it behaves exactly the same way as no value. The reason you are seeing cancels when one order fills is probably because the other would reduce to 0, so it gets cancelled.
I'll have to play a little with modifying the sizes of the orders to see that updating one doesn't update the other.
toggle quoted message
Show quoted text
--- In TWSAPI@..., Ed <news1000@...> wrote: I actually haven't researched scenarios with multiple contracts or more than 2 orders in the oca group. I use separate orders (and oca groups) for 1 contract each which allows separate prices for each leg and eliminates partial fill guessing games. I understand this would not be efficient for large numbers of contracts but that is not an issue for me - not quite up to trading 50 contracts at a time!
I send an empty field for the oca type and it has always canceled the other side when one of the sides executes.
I'm not sure of your usage needs but normally you would want the other side reduced proportionately rather than canceled. If you have a profit and stop exit for 5 contracts and 3 of your profit exits fill, you normally would want 2 contracts remaining on the stop. Otherwise you have no stop exit and a position of 2 contracts.
Doesn't seem like I'm helping much but this is what I have experienced with the oca's.
On 7/19/2013 12:48 PM, Davqe wrote:
The ocaType is in the C++ API documentation for the Order structure (also in IOrder for ActiveX and I assume similar for other languages). There are 2 blocking types, which guarantee that only 1 order will get filled out of the group (eliminating possible overfill issue), and 1 type that does not block. I imagine because I am using the blocking type, even native (LMT for example) orders get held on the server. But there doesn't appear to be an option to cancel the other orders without the blocking, only to reduce them.
Does your first fill order cancel all of the others, or does it just reduce the others by the same amount of the fill?
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com>, Ed <news1000@> wrote:
Hmm. I use oca all the time and the limit orders are on the exchange. I didn't know there were 'oca types' so maybe that changes how orders are handled. If you use the default oca type do you still have the issue?
I have been reading the TWS docs but haven't found a description of the oca types.
On 7/19/2013 11:25 AM, Davqe wrote:
When I mouse over the profit exit, it says the order is being held
and
monitored just like the stop order. The row for the order on TWS shows
the status column as dark blue, where if I place a single limit order with no OCA, mousing over states that it is at the exchange and the status color is green.
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com> <mailto:TWSAPI%40yahoogroups.com>, Ed
<news1000@> wrote:
Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
|
Re: OCA order types and place in order queue
I actually haven't researched scenarios with multiple contracts or more than 2 orders in the oca group. I use separate orders (and oca groups) for 1 contract each which allows separate prices for each leg and eliminates partial fill guessing games. I understand this would not be efficient for large numbers of contracts but that is not an issue for me - not quite up to trading 50 contracts at a time!
I send an empty field for the oca type and it has always canceled the other side when one of the sides executes.
I'm not sure of your usage needs but normally you would want the other side reduced proportionately rather than canceled. If you have a profit and stop exit for 5 contracts and 3 of your profit exits fill, you normally would want 2 contracts remaining on the stop. Otherwise you have no stop exit and a position of 2 contracts.
Doesn't seem like I'm helping much but this is what I have experienced with the oca's.
toggle quoted message
Show quoted text
On 7/19/2013 12:48 PM, Davqe wrote: The ocaType is in the C++ API documentation for the Order structure (also in IOrder for ActiveX and I assume similar for other languages). There are 2 blocking types, which guarantee that only 1 order will get filled out of the group (eliminating possible overfill issue), and 1 type that does not block. I imagine because I am using the blocking type, even native (LMT for example) orders get held on the server. But there doesn't appear to be an option to cancel the other orders without the blocking, only to reduce them.
Does your first fill order cancel all of the others, or does it just reduce the others by the same amount of the fill?
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com>, Ed <news1000@...> wrote:
Hmm. I use oca all the time and the limit orders are on the exchange. I didn't know there were 'oca types' so maybe that changes how orders are handled. If you use the default oca type do you still have the issue?
I have been reading the TWS docs but haven't found a description of the oca types.
On 7/19/2013 11:25 AM, Davqe wrote:
When I mouse over the profit exit, it says the order is being held
and
monitored just like the stop order. The row for the order on TWS shows
the status column as dark blue, where if I place a single limit order with no OCA, mousing over states that it is at the exchange and the status color is green.
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com> <mailto:TWSAPI%40yahoogroups.com>, Ed
<news1000@> wrote:
Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
|
Re: OCA order types and place in order queue
The ocaType is in the C++ API documentation for the Order structure (also in IOrder for ActiveX and I assume similar for other languages). There are 2 blocking types, which guarantee that only 1 order will get filled out of the group (eliminating possible overfill issue), and 1 type that does not block. I imagine because I am using the blocking type, even native (LMT for example) orders get held on the server. But there doesn't appear to be an option to cancel the other orders without the blocking, only to reduce them.
Does your first fill order cancel all of the others, or does it just reduce the others by the same amount of the fill?
toggle quoted message
Show quoted text
--- In TWSAPI@..., Ed <news1000@...> wrote: Hmm. I use oca all the time and the limit orders are on the exchange. I didn't know there were 'oca types' so maybe that changes how orders are handled. If you use the default oca type do you still have the issue?
I have been reading the TWS docs but haven't found a description of the oca types.
On 7/19/2013 11:25 AM, Davqe wrote:
When I mouse over the profit exit, it says the order is being held and monitored just like the stop order. The row for the order on TWS shows the status column as dark blue, where if I place a single limit order with no OCA, mousing over states that it is at the exchange and the status color is green.
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com>, Ed <news1000@> wrote:
Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
[Non-text portions of this message have been removed]
|
Re: OCA order types and place in order queue
Hmm. I use oca all the time and the limit orders are on the exchange. I didn't know there were 'oca types' so maybe that changes how orders are handled. If you use the default oca type do you still have the issue?
I have been reading the TWS docs but haven't found a description of the oca types.
toggle quoted message
Show quoted text
On 7/19/2013 11:25 AM, Davqe wrote: When I mouse over the profit exit, it says the order is being held and monitored just like the stop order. The row for the order on TWS shows the status column as dark blue, where if I place a single limit order with no OCA, mousing over states that it is at the exchange and the status color is green.
--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com>, Ed <news1000@...> wrote:
Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
|
Re: OCA order types and place in order queue
When I mouse over the profit exit, it says the order is being held and monitored just like the stop order. The row for the order on TWS shows the status column as dark blue, where if I place a single limit order with no OCA, mousing over states that it is at the exchange and the status color is green.
toggle quoted message
Show quoted text
--- In TWSAPI@..., Ed <news1000@...> wrote: Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
|
Re: OCA order types and place in order queue
Limit orders are native to globex so your profit exit will be at the exchange. This has nothing to do with oca.
The stop is not native so it must be simulated by ib.
If you mouse over the profit limit you should see a popup messsage saying the order is at the exchange.
toggle quoted message
Show quoted text
On 7/19/2013 11:05 AM, Davqe wrote: I'm working on using OCA for my profit and loss orders. It appears that once I set the orders up with an OCA group, they aren't actually sitting at the exchange but rather are on an IB server waiting to be triggered. I'm using ocaType of 1 (Cancel with Block). It is possible to get the orders actually sitting in the queue at the exchange? For futures contracts with a lot of market depth (S&P e-minis for example), I want my profit limit order in the queue as early as possible. If it waits until the price is touched, I'm at the back of the queue at my limit price.
Am I misunderstanding the manner in which this works? Or is there another way to specify the ocaType that will place the order at the exchange and still handle the cancel once one is triggered.
|
OCA order types and place in order queue
I'm working on using OCA for my profit and loss orders. It appears that once I set the orders up with an OCA group, they aren't actually sitting at the exchange but rather are on an IB server waiting to be triggered. I'm using ocaType of 1 (Cancel with Block). It is possible to get the orders actually sitting in the queue at the exchange? For futures contracts with a lot of market depth (S&P e-minis for example), I want my profit limit order in the queue as early as possible. If it waits until the price is touched, I'm at the back of the queue at my limit price.
Am I misunderstanding the manner in which this works? Or is there another way to specify the ocaType that will place the order at the exchange and still handle the cancel once one is triggered.
|
Re: TwsActivex.xls cannot "request account updates"??
This is the method you should call to request account updates objTWSControl.m_TWSControl.reqAccountUpdates(True, accountName)
If you are managing more than one account, make sure to use the right one. Change to False if you want to cancel the updates.
JP
toggle quoted message
Show quoted text
--- In TWSAPI@..., virusnme <no_reply@...> wrote: I use TwsActiveX.xls excel sheet to connect to IB Gateway. The connection between IB Gateway and TwsActiveX.xls is fairly stable. However, on occasions when IB Gateway loses connection to IB Server, TwsActiveX.xls loses connection to IB Gateway. Eventually, IB Gateway reinstates a connection to IB server. And I will have to ensure that TwsActivex.xls reconnects to IB Gateway (via VBA).
I have figured out how to re-connect the TwsActivex.xls to IB Gateway but I am not able to "request account updates" via VBA! If anyone has figured out how to do it please do let me know.
|
Re: Connect to TWS in main not in Thread (Java)
I mainly suggested you choose wisely for your own needs.
If synchronization *is* a bitch and you are using 2 threads and one handles incoming socket messages and the other is handling incoming GUI message, then you may already have some issues on your hands if your have a user interface that initiates socket events and displays results, if not for other reasons. That's why for my preferences use 1 thread rather than 2, knowing I can change this if it became a problem.
OTOH with Java's native threading support, if you know how to use it, maybe it is no issue at all.
ASIDE: If btw... is a problem for Brian then "twsapi" could be a confusing name for you to be using here (hint hint). It looks like you may both be using yahoo for posting (with "twsapi" also having the no_reply feature), or even as your email client. If you have an outside email client usually you can just set your name for the From field and yahoo seems to honor it in what it passes through. What you can do if you are fully inside yahoo, I don't know, but no surprise if it is crippled to f'ing hell. If you can't get a decent name through you can always name yourself in your signature. I think "twsapi" is still fully anonymous at this point.
-Kurt
toggle quoted message
Show quoted text
On 7/19/13 2:20 AM, "twsapi" <no_reply@...> wrote: Hi Brian :), Kurt,
Thanks so much for your help! I will limit myself to just two threads and actually based on also Kurt's comment synchronization can be a bitch so I rather have two open connections in each thread than fumbling around with thread concurrency :)
But guys, thanks so much you really helped me a lot!
Regards
Hi btw12342001, Call me brian :). I have no idea how to change that login name.
thanks so much for the tip! That actually helps me a lot. I still did not completely understood your earlier reply on how to handle returned data. In which method is the returned data handled? If you scroll down in Example1.java you will see the tickPrice method. This is overriding the method of the same name in ExampleBase. All data from the TWS socket gets sent to those methods in ExampleBase unless they are overridden.
If you want more than one symbol you have to assign an separate id in the request and then do something in tickPrice based on the returned tickerId.
I guess if the connection is not limited to just one thread you also run into synchronization issues between the threads. But as far as I understood you can initiate 6 or 8 connections but IB recommends to use as little as possible, is that correct? Yes, only use one connection. You don't even need the thread part, you could delete the "extends thread" part in ExampleBase and then just call run, however there's a thread.sleep in the run method and you would have to fix the logic. I don't know what your purpose is so it's hard to tell you what to do.
I wrote a very simple 1 file, console based program in the files section under java.
6HUqFRn6EiCrYFcRz7u586_0orlX1Ezv82Y5JDJk9dcO5jxROw/Java%20Code/SimpleTWSconso le.zip
Maybe that will be easier to understand, it's also a netbeans project.
|
Re: Connect to TWS in main not in Thread (Java)
Hi Brian :), Kurt,
Thanks so much for your help! I will limit myself to just two threads and actually based on also Kurt's comment synchronization can be a bitch so I rather have two open connections in each thread than fumbling around with thread concurrency :)
But guys, thanks so much you really helped me a lot!
Regards
toggle quoted message
Show quoted text
Hi btw12342001, Call me brian :). I have no idea how to change that login name.
thanks so much for the tip! That actually helps me a lot. I still did not completely understood your earlier reply on how to handle returned data. In which method is the returned data handled? If you scroll down in Example1.java you will see the tickPrice method. This is overriding the method of the same name in ExampleBase. All data from the TWS socket gets sent to those methods in ExampleBase unless they are overridden.
If you want more than one symbol you have to assign an separate id in the request and then do something in tickPrice based on the returned tickerId.
I guess if the connection is not limited to just one thread you also run into synchronization issues between the threads. But as far as I understood you can initiate 6 or 8 connections but IB recommends to use as little as possible, is that correct? Yes, only use one connection. You don't even need the thread part, you could delete the "extends thread" part in ExampleBase and then just call run, however there's a thread.sleep in the run method and you would have to fix the logic. I don't know what your purpose is so it's hard to tell you what to do.
I wrote a very simple 1 file, console based program in the files section under java.
Maybe that will be easier to understand, it's also a netbeans project.
|
Re: VB6 TWS ActiveX Vs. IB Gateway
I don't know VB, but think it doesn't matter.
1. In all fundamental ways, Gateway works the same as TWS in terms of connections. Since the Gateway has no purpose except to connect to API clients, there is no need to make it an option.
2. TWS.Connect I don't know but yes you have to set the port appropriately. The default port will be different in gateway than TWS, but if you've looked in API - Settings you should have seen and had the opportunity to set the port number and it should be no mystery. You can make the port number the same as TWS if you like, and your setting will be remembered.
3. I don't use ActiveX but it is all the same socket. The Gateway is no different from TWS in fundamental behavior. The system behavior is different in various well-known ways, such as the fact that the gateway lets you stay connected without your having to fight for it. There are probably also subtle differences owing to the fact that they are different executables and also are not necessarily released at the same time, so that bugs may be different.
-Kurt
toggle quoted message
Show quoted text
On 7/19/13 12:05 AM, "Edbar" <edbar@...> wrote: I haven't used the gateway yet, but was wondering a few things:
1. Is any pre-configuration required to connect to the gateway from the VB6 program? For instance with TWS you had to go into tws and check "enable activex and socket clients". But I notice that options isn't even there inte gateway configuaration.
2. Do I have to change the TWS.Connect line to connect to the gateway vs connecting to tws? My connect isn't working and I'm wondering if I have to change the port. I've already got the gateway logged in and running but the program doesn't connect to it.
3. Will all the tws activex methods and events work the same with the gateway as they did with tws?
Thanks,
Ed
|
VB6 TWS ActiveX Vs. IB Gateway
I haven't used the gateway yet, but was wondering a few things:
1. Is any pre-configuration required to connect to the gateway from the VB6 program? For instance with TWS you had to go into tws and check "enable activex and socket clients". But I notice that options isn't even there inte gateway configuaration.
2. Do I have to change the TWS.Connect line to connect to the gateway vs connecting to tws? My connect isn't working and I'm wondering if I have to change the port. I've already got the gateway logged in and running but the program doesn't connect to it.
3. Will all the tws activex methods and events work the same with the gateway as they did with tws?
Thanks,
Ed
|
Re: problem with contract details
It is 7/18, and I just noticed the recently slow contract details behavior seems to have reverted back to what it was previously.
-Kurt
toggle quoted message
Show quoted text
On 7/15/13 6:31 AM, "dairen62" <no_reply@...> wrote: Good news... the problem will be fixed on 7/18. We just need to include the full expiration in the format of YYYYMMDD when invoking the reqContractDeta ils( ) method.
--- In TWSAPI@..., dairen62 <no_reply@...> wrote:
i received exactly the same answer... hope for a quick solution :)
--- In TWSAPI@..., clove2hitch <no_reply@> wrote:
just got an answer from IB API support. 1 minute issue should be solved in near future(when???)
Unfortunately IB imposes limitations on the amount of contracts that can be returned when invoking the reqContractDetails( ) method. In this particular case it would be best to include additional contract parameters which will narrow your scope. Example if you include m_expiration and m_right then you can determine all the available strikes for that particular expiration. Alternatively if you include m_strike and m_right you can determine all the available expirations. But please note there are currently an issue that development is working on with respect to Option Contracts. It seems even though you include the m_expiry there still is a 1 minute buffer for additional requests. Once this has been resolved I will provide you a follow-up comment on this ticket with additional details, --- In TWSAPI@..., clove2hitch <no_reply@> wrote:
Hi, i experience same issues! the first request answers quickly then a second after 1 minute then nothing... :-(
I updated TWS and API to use latest stuff but even worse with the <>clients.exe crash (previous API clients versions don't crash).
I'm going to log the issue to IB. Regards CH
--- In TWSAPI@..., dairen62 <no_reply@> wrote:
Yes, when i try to take the options chain every call to reContractDetailsEx (with strike set to zero) lasts 1 minute instead the normal 6 seconds. I also notice that the demo program of the API (client3.exe) crash when you use "reqContractData". Can you try if you have the same problem?
thanks
--- In TWSAPI@..., "rwk2095" <r@...> wrote:
Is this still a problem? I just ran a program at 8:25 EST on 11 JUL, and everything appears normal on Globex (E6).
[rwk]
--- dairen62 <no_reply@> wrote:
hi everybody, i've a little program that that takes the chain of the options using the method reqContractDetailsEx (ActiveX). It worked fine till yesterday: every call to reqContractDetailsEx lasts 1 minute versus the 6 seconds of before yesterday. In this way the program is dramaticaly slow. Anyone experienced the same?
------------------------------------
Yahoo! Groups Links
|
Re: C# Option Contract Details
not sure of your problem but getting a full option chain for the underlying was never a problem for my code the biggest problem was getting all the details and it timing out. nick
toggle quoted message
Show quoted text
On 7/18/2013 8:45 PM, andrewcmeier wrote: Sorry, I've been away. That looks fine, I'm happy that I've got what I need now to download data, havn't been able to retrieve an option chain but I've come up with a workaround that is quicker. Basically I'm downloading the option details from Yahoo in advance, storing the details in a file, then reading this file to download 100 option prices at a time, works out quicker because I can filter it ahead of time and be downloading 100 options at a time rather than 1 stock at a time. The programming to split the 100 options into their stocks is a bit of a pain though.
Thanks for your input.
--- In TWSAPI@..., "t0ksik" <seventhpoint@...> wrote:
I am not sure if anyone has answered your question to your satisfaction yet but I wanted to give you what I have figured out for options.
using request market data you would have something like this in c#
client.RequestMarketData(i, new Option("BAC", "BAC130720C00012000", "", RightType.Undefined, 0), some collection, false, false);
--- In TWSAPI@..., "andrewcmeier" <andrewcmeier@> wrote:
I've tried both dates, no luck.
--- In TWSAPI@..., Peter Gum <petergum@> wrote:
Should '20130719' be '20130720'? I.e. 19 -> 20 to match the tws market line. (Although IB will expire the option on the 19th. Confusing.) Pete
On 07/14/13, andrewcmeier<andrewcmeier@> wrote:
Oops, Tester and A1 were meant to be the same variable in the options lines, change Tester to A1 and that is what I have.
--- In TWSAPI@..., "andrewcmeier" <andrewcmeier@> wrote:
Hi there, I've started using the Krs.Ats.IBNet software () to develop TWS software in C#.
Setting up equities is easy enough: Equity Google = new Equity("GOOG"); client.RequestMarketData(14, Google, null, true, false);
But when I try to adapt it to options, I can't get it to work. This is what I'm using: Option A1 = new Option("AA", "AA", "20130719", RightType.Call, 8.0m); client.RequestMarketData(15, Tester, null, false, false);
This is what it has in its class): public Option(string equitySymbol, string optionSymbol, string expiry, RightType right, decimal strike)
This is the error I get when I raise e.ErrorCode: "No security definition has been found for the request"
Does anyone know what I'm entering wrong, or just how to set up an option in C#? I also then wan't to be able to leave fields out to do things such as return all the contracts in a month, does anyone have any examples how to do this?
I'm finding that C# should be a good way to download and analyse data but don't have any documentation, I've only worked out what to do from searching through lots of the code.
Thanks for your help.
------------------------------------
Yahoo! Groups Links
|
C# Option Contract Details
Sorry, I've been away. That looks fine, I'm happy that I've got what I need now to download data, havn't been able to retrieve an option chain but I've come up with a workaround that is quicker. Basically I'm downloading the option details from Yahoo in advance, storing the details in a file, then reading this file to download 100 option prices at a time, works out quicker because I can filter it ahead of time and be downloading 100 options at a time rather than 1 stock at a time. The programming to split the 100 options into their stocks is a bit of a pain though.
Thanks for your input.
toggle quoted message
Show quoted text
--- In TWSAPI@..., "t0ksik" <seventhpoint@...> wrote:
I am not sure if anyone has answered your question to your satisfaction yet but I wanted to give you what I have figured out for options.
using request market data you would have something like this in c#
client.RequestMarketData(i, new Option("BAC", "BAC130720C00012000", "", RightType.Undefined, 0), some collection, false, false);
--- In TWSAPI@..., "andrewcmeier" <andrewcmeier@> wrote:
I've tried both dates, no luck.
--- In TWSAPI@..., Peter Gum <petergum@> wrote:
Should '20130719' be '20130720'? I.e. 19 -> 20 to match the tws market line. (Although IB will expire the option on the 19th. Confusing.) Pete
On 07/14/13, andrewcmeier<andrewcmeier@> wrote:
Oops, Tester and A1 were meant to be the same variable in the options lines, change Tester to A1 and that is what I have.
--- In TWSAPI@..., "andrewcmeier" <andrewcmeier@> wrote:
Hi there, I've started using the Krs.Ats.IBNet software () to develop TWS software in C#.
Setting up equities is easy enough: Equity Google = new Equity("GOOG"); client.RequestMarketData(14, Google, null, true, false);
But when I try to adapt it to options, I can't get it to work. This is what I'm using: Option A1 = new Option("AA", "AA", "20130719", RightType.Call, 8.0m); client.RequestMarketData(15, Tester, null, false, false);
This is what it has in its class): public Option(string equitySymbol, string optionSymbol, string expiry, RightType right, decimal strike)
This is the error I get when I raise e.ErrorCode: "No security definition has been found for the request"
Does anyone know what I'm entering wrong, or just how to set up an option in C#? I also then wan't to be able to leave fields out to do things such as return all the contracts in a month, does anyone have any examples how to do this?
I'm finding that C# should be a good way to download and analyse data but don't have any documentation, I've only worked out what to do from searching through lots of the code.
Thanks for your help.
|
Re: problem with contract details
This has indeed been fixed for live and paper trading accounts, but not for edemo
toggle quoted message
Show quoted text
--- In TWSAPI@..., dairen62 <no_reply@...> wrote:
Good news... the problem will be fixed on 7/18. We just need to include the full expiration in the format of YYYYMMDD when invoking the reqContractDeta ils( ) method.
--- In TWSAPI@..., dairen62 <no_reply@> wrote:
i received exactly the same answer... hope for a quick solution :)
--- In TWSAPI@..., clove2hitch <no_reply@> wrote:
just got an answer from IB API support. 1 minute issue should be solved in near future(when???)
Unfortunately IB imposes limitations on the amount of contracts that can be returned when invoking the reqContractDetails( ) method. In this particular case it would be best to include additional contract parameters which will narrow your scope. Example if you include m_expiration and m_right then you can determine all the available strikes for that particular expiration. Alternatively if you include m_strike and m_right you can determine all the available expirations. But please note there are currently an issue that development is working on with respect to Option Contracts. It seems even though you include the m_expiry there still is a 1 minute buffer for additional requests. Once this has been resolved I will provide you a follow-up comment on this ticket with additional details, --- In TWSAPI@..., clove2hitch <no_reply@> wrote:
Hi, i experience same issues! the first request answers quickly then a second after 1 minute then nothing... :-(
I updated TWS and API to use latest stuff but even worse with the <>clients.exe crash (previous API clients versions don't crash).
I'm going to log the issue to IB. Regards CH
--- In TWSAPI@..., dairen62 <no_reply@> wrote:
Yes, when i try to take the options chain every call to reContractDetailsEx (with strike set to zero) lasts 1 minute instead the normal 6 seconds. I also notice that the demo program of the API (client3.exe) crash when you use "reqContractData". Can you try if you have the same problem?
thanks
--- In TWSAPI@..., "rwk2095" <r@...> wrote:
Is this still a problem? I just ran a program at 8:25 EST on 11 JUL, and everything appears normal on Globex (E6).
[rwk]
--- dairen62 <no_reply@> wrote:
hi everybody, i've a little program that that takes the chain of the options using the method reqContractDetailsEx (ActiveX). It worked fine till yesterday: every call to reqContractDetailsEx lasts 1 minute versus the 6 seconds of before yesterday. In this way the program is dramaticaly slow. Anyone experienced the same?
|