开云体育

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

Re: OCA order types and place in order queue

Ed
 

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.

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

Davqe
 

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"??

jpgarciaa
 

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: 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

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)

twsapi
 

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.



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

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

Edbar
 

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

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

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

andrewcmeier
 

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.


Re: problem with contract details

 

This has indeed been fixed for live and paper trading accounts, but not for edemo

--- 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?


TwsActivex.xls cannot "request account updates"??

virusnme
 

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)

btw12342001
 

--- In TWSAPI@..., twsapi <no_reply@...> wrote:



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: Connect to TWS in main not in Thread (Java)

 

Hi,

Breaking in, I have a vague memory there may be people who said they open
multiple connections in order to have a dedicated thread for each, but it is
highly unusual and probably not necessary.

Bottom line is if you do not have specific reason to make your life
complicated, don't make your threading model more complex than it needs to
be for your well-understood purposes. This certainly does not require
multiple connections and you can still spawn threads to handle computations
that can be factored in that way, if you like. I suggest you start with a
fewest-thread-possible approach. Personally I choose 1 thread and do not
use a separate reader thread. Sometimes the environment may present you
with a separate reader thread and you can write some code to funnel the
results from that back to the main thread. There have been endless
arguments here about the incredible importance or incredible unnecessity of
having additional threads for this or that. It is a big topic and has been
discussed for weeks on end numerous times. If you want to learn about it I
suggest your read the archives, but in the meantime stick with 1 thread, or
2 if that comes naturally in your context and you can manage it.

A common suggestion is to use a single thread to dispatch data *quickly* to
other threads so the main thread is close enough to always available to
handle the next incoming message. Anything processed quickly can be handled
on that thread and anything not can be put in a queue and handled elsewhere.
(Meanwhile just start coding without worrying about that until you need to.)

Regarding returned data the easy solution is to always override ALL callback
methods and log the results from every callback. Then you have no doubt
what data is returned through which callback, in case the documentation is
vague about it (or non-existent).

-Kurt

On 7/16/13 12:45 AM, "twsapi" <no_reply@...> wrote:

Hi btw12342001,

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? 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?

Regards

--- In TWSAPI@..., "btw12342001" <newguy@...> wrote:


Not much of automation when I need to authorize it manually every time :)
To fix the authorizing part you just need to set trusted IP addresses in TWS.
Add 127.0.0.1 for the local machine.


Re: NKD data

jayfunandgames
 

Nice, that works. Thanks a lot for the tip.

--- In TWSAPI@..., Ed <news1000@...> wrote:

Try omitting local symbol and use expiration date of 201309 instead.

On 7/16/2013 10:06 PM, jayfunandgames wrote:

Trying to request NKD data, buy having a problem.

Using the following info
Symbol: NKD
Type: FUT
Exchange: GLOBEX
Local Symbol: NKD SEP 13

This is the format that I used when requesting YM futures, so I'm not
sure what I'm doing wrong.

Is there a good place that will show you the format needed for the
different types of requests?

Thanks,

Jay



[Non-text portions of this message have been removed]


Re: NKD data

Ed
 

Try omitting local symbol and use expiration date of 201309 instead.

On 7/16/2013 10:06 PM, jayfunandgames wrote:

Trying to request NKD data, buy having a problem.

Using the following info
Symbol: NKD
Type: FUT
Exchange: GLOBEX
Local Symbol: NKD SEP 13

This is the format that I used when requesting YM futures, so I'm not
sure what I'm doing wrong.

Is there a good place that will show you the format needed for the
different types of requests?

Thanks,

Jay


NKD data

jayfunandgames
 

Trying to request NKD data, buy having a problem.

Using the following info
Symbol: NKD
Type: FUT
Exchange: GLOBEX
Local Symbol: NKD SEP 13

This is the format that I used when requesting YM futures, so I'm not sure what I'm doing wrong.

Is there a good place that will show you the format needed for the different types of requests?

Thanks,

Jay


Re: Tick Encoding/Decoding

cf16r
 

--- In TWSAPI@..., Ed <news1000@...> wrote:

you'll have to research a bit to find the implications and gotcha's.
here for example:


Re: Tick Encoding/Decoding

Ed
 

I don't think there is a strict correlation between tick price/size
and RTV. They seem to be completely different streams to me, with
different sampling/aggregation.

Remember that IB does not send each tick and you get about 3 updates per
second.

On 7/16/2013 4:15 AM, unatnahs57 wrote:


Yes its java, your tools sound quite interesting..

The time lag was simply the local time when I get a IB response, in
milliseconds. The lag I meant was the time lag between when i get
tickPrice and RTVolume. Seems first I get "id=0
lastTimestamp=1373851042" response, then tickPrice/tickSize response
and then I get RTVolume. Also, appears that tickSize response can come
even after RTVolume, as if two threads are writing the callback response.

--- In TWSAPI@... <mailto:TWSAPI%40yahoogroups.com>,
"rwk2095" <r@...> wrote:



Your original post (OP) makes more sense now. I was unfamiliar with
TickUtils.jar because it appears to be Java, and I don't speak Java.

It sounds like I am doing something similar to TickUtils.jar. I
write quotes and trades into a file of fixed-length records, 20 bytes
each, which I refer to as a blob (binary large object). I then load
the blob into memory for detailed analysis at my leisure using a
single read command.

As Richard mentioned, a blob is not directly readable, but I have
tools that extract pieces and put them out in .csv format for analysis
in Excel. I also have a playback tool that can replay a segment of the
day at whatever speed I select.

If you're using the RTVolume generic, you might also specify the
"mdoff" flag to suppress quotes in the regular quote stream so that
you're seeing only trades. This saves bandwidth. If you need quotes
too, you can get them from reqMktDepthEx().

I don't understand the time lag you mentioned. How are you measuring
the lag? It's my understanding that Windows cannot accurately measure
time intervals shorter than about 65 msec. I believe the regular data
stream from reqMktDataEx() is unsuitable for understanding market
microstructure.

[rwk]



--- unatnahs57 <no_reply@> wrote:
1. I am making data request as: mClientSocket.reqMktData(id,
contract, "", false);
which returns the "last price and quantity in separate callbacks".

So, using the post #24461 that you suggested I made the request
as: mClientSocket.reqMktData(id, contract, "233", false);

which returns Last Trade tick as:
id=0 RTVolume=3066.00;4;1373851042866;1108;3065.15771661;false

I can now construct the LastTick object instance used in
TickUtils.jar.

(Not yet sure if BidTick, AskTick can be done this way, but I'll
investigate further, I wanted to reply at the earliest).

++++++
2a. I also noticed an interesting thing. Request made with only
"233" still gives me IB response for tickPrice, tickSize methods, so
I'm actually using more bandwidth.

2b. Also, please take a look at the data below (I tested $NQ_F)

2013.07.14 20:17:14:836,0,6.0
2013.07.14 20:17:15:759,0,7.0
2013.07.14 20:17:20:208,0,6.0
id=0 lastTimestamp=1373851042 <-tickString() response
2013.07.14 20:17:21:989,4,3066.0 <-TRADE_PRICE
2013.07.14 20:17:21:993,5,1.0 <-TRADE_SIZE
2013.07.14 20:17:21:999,8,1105.0 <-VOLUME
2013.07.14 20:17:22:004,1,3065.75
2013.07.14 20:17:22:014,0,4.0
2013.07.14 20:17:22:021,0,4.0
2013.07.14 20:17:22:025,3,6.0
id=0 RTVolume=3066.00;4;1373851042866;1108;3065.15771661;false
2013.07.14 20:17:23:132,5,3.0 <-TRADE_SIZE
2013.07.14 20:17:23:233,8,1108.0 <-VOLUME
2013.07.14 20:17:23:324,0,5.0
2013.07.14 20:17:23:328,3,7.0
2013.07.14 20:17:24:052,0,6.0

i) There is almost a 030ms (average seems to be like 040ms) lag
between when trade is executed and when we get RTVolume response.

ii) I get a tickString response timestamp, then I get a trade,
trade size, tickString Tick data, then trade size and then volume upto
that point. Seems 2nd trade_size is not preceded with TRADE_PRICE if
the price is same as last traded price.

iii) Seems we can construct TRADE ticks using tickPrice stream
ourselves, although VWAP might get messed up if data breaks in between.


Re: Upcoming stock earnings dates

souqmate
 

Thanks for the link, rwk and Robert.
Below are the one-liners to scrape Yahoo calendars on linux; cut 'n paste in your xterm (tcsh).
European stocks appear in earnings.csv (since 2011), confCalls.csv (since 2013), in surprises.csv (since 2011), not in splits.csv nor ipo.csv. No Japanese stocks, as ramdukof bemoans; any hint welcome!
Files with history (confCalls.csv, earnings.csv, ipo.csv, splits.csv, surprises.csv, marcro.csv) are readily available for 7 days at

Good luck
souqMate.

-----------------------

# Earnings: since 19990401 (old format prior 20001031); header: "# Company,Symbol,Time (NY, or Before/After Mkt)"
foreach d (19990401 19990402 ... 20130712)
wget -q -O - " | sed -n '/>Conference</,/^colspan/H; ${x;s,&#92;n, ,g; s,<td,&#92;n<td,g; p}' | awk 'NR>1 && !(/colspan/)' | sed 's,<[^>]*>,,g; s,&nbsp;, ,g; s,&amp;,&#92;&,g; s/,//g' | awk '{l=NR%4; if(l==1) printf "'$d',"; if(l>0 && l<3) printf $0","; if(l==3){t=""; if(/Before/) t="Before"; if(/After/) t="After"; if(/ET/){split($1,a,":"); if(/pm/) a[1]+=12; t=a[1]":"a[2]} print t}}' >>! earnings.csv
end

# Conf Calls: since 20111014; header: "# Date,Time (NY),Symbol(if several: separated by blanks),Event"
foreach d (20111014 20111015 ... 20130712)
wget -q -O - " | sed -n '/>Access</,/size=1/H; ${x;s,&#92;n, ,g; s,<td,&#92;n<td,g; p}' | awk 'NR>1' | sed 's,<[^>]*>,,g; s,&nbsp;, ,g; s,&amp;,&#92;&,g; s/,//g' | awk '{l=NR%4; if(l==1){split($1,a,":"); if(/pm/) a[1]+=12; t=sprintf("%02d:%02d",a[1],a[2]); printf '$d'","t","} if(l==2) printf $0","; if(l==3) print $0}' >>! confCalls.csv
end

# Surprises, since 20021209; header: "# Date,Company,Symbol,Surprise (%),Reported EPS,Consensus EPS"
foreach d (20021209 20021210 ... 20130712)
wget -q -O - " | sed 's,</tr><tr,</tr>&#92;n<tr,g; s,&amp;,&#92;&,g; s/,//g' | awk '/^<tr.*td><td$/,/^nowrap/{gsub(/^align/,"<align",$0); gsub(/td$/,"td>",$0); gsub(/<[^>]*>/,"",$0); print}' | awk '{l=NR%7; if(l==1) printf "'$d',"; if(l>0 && l<5) printf $0","; if(l==5) print $0}' >>! surprises.csv
end

# splits, since Jan 2000; header: "# Payable,Ex Date,Company,Symbol,Optionable?,Ratio,Announced"
foreach y (00 01 02 03 04 05 06 07 08 09 10 11 12 13)
foreach m (1 2 3 4 5 6 7 8 9 10 11 12)
wget -q -O - " | grep ^noshade | sed 's,</table.*,,g; s,<tr,&#92;n<tr,g; s,<td,&#92;n<td,g; s,<[^>]*>,,g; s/,//g; s,&amp;,&#92;&,g; s,&nbsp;*,,g' | grep -v ^noshade | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} {l=NR%9; if(l==2||l==3||l==8){y=2000+'$y'; if(l==3) M=m[$1]; if(l==8 && m[$1]>M) y--; if(NF>0) $0=sprintf("%s%02d%02d",y,m[$1],$2)} if(l>1 && l<8) printf $0","; if(l==8) print $0}' >>! splits.csv
end
end

# IPO pricings, since Jan 1998; header: "# OfferDate,Company,Symbol,SharesOffered[mln],ProposedPric[$],InitialPrice[$]"
foreach y (98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13)
foreach m (jan feb mar apr may jun jul aug sep oct nov dec)
wget -q -O - " | sed 's,</TR>,</TR>&#92;n,g' | grep '^<tr><td align' | sed 's,<td,&#92;n<td,g; s,>M<,><,g; s,<[^>]*>,,g; s/,//g; s,&#92;$,,g' | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} {l=NR%8; if(l==2){split($1,a,"-"); y=(a[3]>90? 1900:2000)+a[3]; $0=sprintf("%04d%02d%02d",y,m[a[2]],a[1])} if(l>1 && l<7) printf $0","; if(l==7) print $0}' >>! ipo.csv
end
end

# macro-economy, since 20010102; header: "# date,time(NY),indicator,For,Actual,BriefingForecast,Expect,Prior,RevisedFrom"
awk 'BEGIN{for(i=2001;i<2013;i++) for(j=1;j<53;j++) printf "%s%02d&#92;n",i,j}' > ! /tmp/i
foreach i ( `cat /tmp/i` )
wget -q -O - " | sed -n '/^From/,/^href/{s,<tr,&#92;n<tr,g; s,More in-depth.*$,,; s,<[^<]*>, ,g; s, bcf,bcf,g; p}' | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} !(/^From|^href/){yr=substr('$i',1,4); d=sprintf("%s%02d%02d",yr,m[$1],$2); split($3,a,":"); hr=a[1]; mi=a[2]; if($4=="PM") hr+=12; t=sprintf("%02d%02d",hr,mi); txt=$5; for(n=6;n<NF-5;n++) txt=txt" "$n; OFS=","; print d,t,txt,$(NF-5),$(NF-4),$(NF-3),$(NF-2),$(NF-1),$NF}' >> macro.csv
end

# caution: prior 20120323, times are wrong: apply UTC2EST twice and subtract 3 hrs to get NY time. Corrected in the uploaded file.
Corrections: 20090422 20090121 have Crude Oil at 1030 instead of 1035; and over 20080604-20081231 have it at 1035; over 2005-2010 can find Crude Oil on Wed and subsequent Thu (when holidays; discard Wed entry). Uploaded file is actually in tsv; change to csv: sed 's/,//g; s/&#92;t/,/g' macro.tsv > macro.csv

--- In TWSAPI@..., "rwk2095" <r@...> wrote:



I built a short term stock-trading app about ten years ago that excluded stocks with earning releases that day or the next. I used Yahoo!Finance via a screen scraper as my source of earnings release schedule, though it was not always complete. My scraper app was pretty primative, and whenever Yahoo changed the format of the web page, my program failed to deliver the desired data.

There are several other sites that also have earnings release schedules, and interestingly, their lists are usually quite different.

I ran the app for 8+ years, but I shelved it about a year and a half ago because the performance had deteriorated.


[rwk]



--- "ramdukof" <ramdukof@> wrote:
Is there any API request that returns upcoming stock earnings dates?
If not, do you use any other services to provide this?
I'm interested in both US and foreign exchanges.