¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: reqSecDefOptParams() hangs for some futures symbols but not others.


 

thanks?ray will start using immediately?
i was wondering if you have ibkr tws v 972 windows or mac available? for download?if so do you mind sharing it please

On Mon, Jul 26, 2021 at 6:07 AM Ray Racine <ray.racine@...> wrote:
I apologize ahead of time for the blurb.? One time happening out of respect for the list.? But since someone asked ...

This is the Interactive Brokers Reactive Engine, aka IBKRE.?
Found here:

It has a couple of examples here:

There is a brief, rough draft "tutorial" (with a bunch of typos), on how to use IBKRE.? Check it out!! :
Scroll down and at least read the description of the first code example.

Here is another example for some code invoking market data, getting con ids, option chains via Sec Def Parameters, etc found here:

Given a list of stocks and exchanges, get the con-id for each stock, for each stock/exchange combo get the possible strikes (the option chains via the infamous Sec Def Params API), and finally to verify the option chains invokes contract details for filter the possible option chain from Sef Def Params to the actual valid available options. Oh and all while this is going on it is also getting market data for open, close, last, volume, implied volatilities or whatever.

This is A LOT of API calls.? The key point of this example is to show how IBKRE is performing all of this stuff concurrently, all at the same time.? It will run through 100s even 1000s of option chains in a reasonable period of time (constrained by IBK's API rate limits).? CAVEAT: This example has an "api rate limiter" in the code that has a bug as I was in the middle of changing to another approach.?

About Racket:

While it is Lisp, it is in Racket (a variant) and not Common Lisp or Scheme.? Frankly it is probably one of the best languages out there.? It has been around for a long time and has a very stable core of maintainers, many of them professors, grad students, academics, hardcore developers.? One of the core leaders won the Turing Award from CS (the Nobel Prize of CS) a few years back partly for Racket. It is very stable, maintained and active.? It is not a one man fly-by-night hobby language by any means.

You can read all about Racket here:

Racket Highlights:

- AMAZINGLY well documented. See
- Native compilation like C or Java granting decent performance.
- High level like Python or Ruby.
- Cross platform.? Runs on Mac, Linux, Windows, ARM (Raspberry Pi).
- Pretty decent GUI set for graphical programs that runs cross platform as well.? i.e. Your graphics gui programs, plots etc will run on Mac, Linux and Windows.
- Bug reports are addressed very quickly with pretty much immediate turn around.
- Robust plotting library for graphs and charts.
- Batteries included core of libraries found here:

About the IBKRE Library.

My first iteration took a standard approach to concurrency using async code, futures, thread queues, CML constructs, condition variables etc.? And while it worked OK I found I was spending too much time dealing with machinery and not enough time with my stock trading logic. The IBKRE is a Actor based approach that personally I think has been the perfect fit for working with the IBK API and is MUCH easier to use.

Library Caveats:

- Alpha / Early Beta code.
- Some aspects of the library have not seen widespread code use so may have an issue here or there.
- I have deliberately NOT added any of the code for order placement at this time.? (Soon)? I did not want someone placing orders and having it go wrong for them on my karma balance until things were shaken down.

I do use it all the time and someone can expect a quick fix for any bug etc.

On Sun, Jul 25, 2021 at 9:10 PM mark M <write2mark1@...> wrote:
ray what library is this?

?(sec-def-opt-params-req (gen-rid) 'ES "GLOBEX" 'FUT 371749798))
?(sec-def-opt-params-req (gen-rid) 'ES "GLOBEX" 'FUT 383974339))

does not?look like python is it lisp? and if so how do ?you access twsapi via lisp?

On Tue, Sep 8, 2020 at 5:47 AM Ray Racine <ray.racine@...> wrote:
For both calls:

?(sec-def-opt-params-req (gen-rid) 'ES "GLOBEX" 'FUT 371749798))
?(sec-def-opt-params-req (gen-rid) 'ES "GLOBEX" 'FUT 383974339))

Seeing normal msg response in the sense of a series of 75 msg, followed by a 76.? The Sec Def Opt Param and Sec Def Opt Param End msgs.? No obvious difference in the data returned with regard to formatting.

Note I am not utilizing the Python lib, but invoking the API via a different library.? So from the API req/rsp msg layer seems ok on the surface as of time of writing.


On Mon, Sep 7, 2020 at 5:16 PM <dockertwsguy@...> wrote:
When calling reqSecDefOptParams() on ES futures, it's possible to see it inexplicably hang.

Given the call:

- reqSecDefOptParamsAsync(**{'underlyingSymbol': 'ES', 'futFopExchange': 'GLOBEX', 'underlyingSecType': 'FUT', 'underlyingConId': 371749798})

Where the conId is for ESU0, the call will hang, however given the call:

- reqSecDefOptParamsAsync(**{'underlyingSymbol': 'ES', 'futFopExchange': 'GLOBEX', 'underlyingSecType': 'FUT', 'underlyingConId': 383974339})

Where the conId is for ESZ0, the call returns data as expected.

I'm using ib_insync, but this doesn't appear to be a bug with that library

Additionally when calling it for ESZ0, only some expiries are not being returned. I can see dates in the TWS option chain that do not show up in the API response.

Has anyone played with this before?

I know about the reqContractDetails() approach, but that is good for 1 option chain call seemingly per minute. For ES it returns 11000 rows

Join [email protected] to automatically receive all group messages.