开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

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

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



Join twsapi@groups.io to automatically receive all group messages.