开云体育

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

Tick Encoding/Decoding

 

Hi All,

I'm trying to encode tick data from IB, and wanted to use TickUtils.jar contributed here. But it seems to work with standard tick formats for example a Trade tick would have format (%time %price %trade size).

IB data shows up as (%time %tick type %value), so IB would send two tick responses for a trade tick, instead of one.

I was wondering if anyone was using the encoding utility for IB and if they would have a converter for IB tick data into the the format the encoder needs and are willing to share it.

Thanks

S


Re: C# Option Contract Details

 

In the file section of this group
I wrote a option chain getter
I included the source.it in vb
and conversion is easy to c#
i had very little problems with it
it get the chain of any stock ticker
gets all the quotes
and draws vertical spread graphs

nick

On 7/14/2013 6:23 AM, 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




Re: C# Option Contract Details

Peter Gum
 

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: C# Option Contract Details

 

You're running an older version of ib-csharp.

The latest code is now hosted here:

Download that and give it a try.

Shane

On Sunday, July 14, 2013, 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@... <javascript:;>, "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




Re: C# Option Contract Details

andrewcmeier
 

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.


C# Option Contract Details

andrewcmeier
 

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.


TWS API child order questions

cf16r
 

nothing is reliable in demo account.
you cannot assume anything by induction from your experience with edemo/demouser: this is my opinion after doing initial tests on demo account.


Re: TWS API child order questions

Ray Salem
 

IN the demo account it was minutes, not sure if this would be true with real account


thanks ray



________________________________
From: cf16r <piter@...>
To: TWSAPI@...
Sent: Friday, July 12, 2013 11:23 AM
Subject: [TWS API] Re: TWS API child order questions



?
@raysalem619 did you really mean "minutes"?
can somebody tell this is not true in a real account?
I would like to see rather something less than second.


Re: Upcoming stock earnings dates

Robert
 

I use
"
Let me know if anyone is interested in the VB.Net code that parses the downloaded html. It works well for me.

r4

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


Re: Upcoming stock earnings dates

rwk2095
 

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.


The following jar files is missing from the classpath: hsqldb.jar

 

Thanks everyone for your help with this. I tried some older versions of TWS and IBController and have come up with a working pair. I think I'll just stick with that until I'm forced to upgrade.

Thanks again.
David


Upcoming stock earnings dates

ramdukof
 

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.


Re: The following jar files is missing from the classpath: hsqldb.jar

 

If you were typing that command in a terminal window it will not work
unless you first make the default directory C:&#92;Jts. Doing that allows you
to specify the jar files without specifying the entire path. So to make a
long story short, what if you try using the whole path for the jars in your
command line.

Instead of specifying the jar files like this:

-cp jts.jar;total.2012.jar

Do this:

-cp C:&#92;&#92;Jts&#92;jts.jar;C:&#92;&#92;Jts&#92;total.2012.jar


On Fri, Jul 12, 2013 at 6:56 PM, DavidP <af402469@...> wrote:

**


The defaults classpath in the TWS 938.1h shortcut is
C:&#92;Windows&#92;system32&#92;javaw.exe -cp jts.jar;total.2012.jar
-Dsun.java2d.noddraw=true -Dswing.boldMetal=false
-Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M
jclient/LoginFrame C:&#92;Jts

I tried replacing that classpath with this one from earlier in the thread,
C:&#92;WINDOWS&#92;system32&#92;javaw.exe -cp jts.jar;total.2012.jar
-Dsun.java2d.noddraw=true -Dswing.boldMetal=false
-Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M
jclient/LoginFrame C:&#92;Jts
I was unable to get the shorcut to work after that so I put it back to the
default classpath.

I did also add -hsqldb.jar into the classpath to see what would happen,
but it would not run like that.



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


The following jar files is missing from the classpath: hsqldb.jar

 

The defaults classpath in the TWS 938.1h shortcut is C:&#92;Windows&#92;system32&#92;javaw.exe -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame C:&#92;Jts

I tried replacing that classpath with this one from earlier in the thread,
C:&#92;WINDOWS&#92;system32&#92;javaw.exe -cp jts.jar;total.2012.jar
-Dsun.java2d.noddraw=true -Dswing.boldMetal=false
-Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M
jclient/LoginFrame C:&#92;Jts
I was unable to get the shorcut to work after that so I put it back to the default classpath.

I did also add -hsqldb.jar into the classpath to see what would happen, but it would not run like that.


Re: Connect to TWS in main not in Thread (Java)

btw12342001
 

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

btw12342001
 

It's just an example so don't expect it to do something else. Your problem isn't really with the threads but the run method (called with .start). That method connects and requests data. If you want more data with the same connection you will have to write it yourself somehow.

You could simply add more lines like

Contract contract = createContract.....
eClientSocket.reqMktData....

but then you'd have to redo the way it handles returned data.

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

Hi board,

I have a question regarding the thread programming in Java with the IB API. In the example application (Example 1) you see that first the main class is called and within that class a new thread is called e.g. new Example1(args[0]).start();
If I move the connect call to TWS e.g. connectToTWS(); into the main class the thread will not see/be able to access the open connection to TWS.

My question is now, why is the thread not able to use the opened connection within main but need its own connection call? And can I actually use just one connection call in main to be used by multiple threads?

What I want to achieve is that the main class opens the initial call to TWS and holds this open while different threads can use this open connection. As every call of connectToTWS(); requires me to allow access in the TWS client I only want to authorize my program once not every time a thread actually opens the connection. Not much of automation when I need to authorize it manually every time :)

Thanks so much for your help!

Regards


Connect to TWS in main not in Thread (Java)

twsapi
 

Hi board,

I have a question regarding the thread programming in Java with the IB API. In the example application (Example 1) you see that first the main class is called and within that class a new thread is called e.g. new Example1(args[0]).start();
If I move the connect call to TWS e.g. connectToTWS(); into the main class the thread will not see/be able to access the open connection to TWS.

My question is now, why is the thread not able to use the opened connection within main but need its own connection call? And can I actually use just one connection call in main to be used by multiple threads?

What I want to achieve is that the main class opens the initial call to TWS and holds this open while different threads can use this open connection. As every call of connectToTWS(); requires me to allow access in the TWS client I only want to authorize my program once not every time a thread actually opens the connection. Not much of automation when I need to authorize it manually every time :)

Thanks so much for your help!

Regards


Re: The following jar files is missing from the classpath: hsqldb.jar

BeeJay (GMX)
 

I'm using TWS 938.1 which starts and runs flawlessly if I open it by
using the TWS icon on the desktop. I'm also using IBControllerV2-9-0
with the default command line. I must admit I don't even know where
the command line can be found. I opened various files and did not see
anything which looks like what has been posted in this thread. Which
file contains the command line?
Sorry, I dont use IBController. But there are a lot of users here which can help you how to change the classpath for the TWS in IBController.

I do see the total.2012.jar file in C:&#92;jts directory.

Thanks David

--- In TWSAPI@..., "BeeJay (GMX)" <bee_jay61@...> wrote:

If you post the the command you use to start the TWS, you should
also mention the TWS version number, cause this command is for
older TWS versions.

Most JAR files are now stored in one single JAR file:
"total.2012.jar".

A more recent command is:

C:&#92;WINDOWS&#92;system32&#92;javaw.exe -cp jts.jar;total.2012.jar
-Dsun.java2d.noddraw=true -Dswing.boldMetal=false
-Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M
jclient/LoginFrame C:&#92;Jts


Can you start TWS normally without using IBController? I don't
use that so am not sure how it works. The command I use to start
TWS is the default from the installation script.

C:&#92;WINDOWS&#92;system32&#92;javaw.exe -cp
jts.jar;hsqldb.jar;jcommon-1.0.12.jar;jfreechart-1.0.9.jar;jhall.jar;other.jar;rss.jar

-Dsun.java2d.noddraw=true -Xmx512M -XX:MaxPermSize=128M
jclient/LoginFrame C:&#92;jts

--- In TWSAPI@..., "DavidP" <af402469@> wrote:

Thanks for the reply, yes the file is in C:&#92;jts. The file I am
using is hsqldb-1.7.3.3 I also have the folder hsqldb-2.3.0
with its contents as downloaded off the web. I run
sampleIBControllerStart and then it brings up the error
message.

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

You don't mention if you actually have the file. The
default location in in the &#92;jts directory.

--- In TWSAPI@..., "DavidP" <af402469@> wrote:

Hi,

I'm just setting up on a new PC and I'm encountering the
following error message.

Fatal Error: one of the following jar files is missing from
the classpath: hsqldb.jar Please make sure you run the
application from the shortcut that was installed on your
desktop or on the Start menu when you upgraded.

I've not come across these before but I also got some
regarding jfreechart and jcommon which I seemed to overcome
by downloading and pasting into the appropriate folder. I
cant seem to get this one sorted though. Any ideas?

Thanks David



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

Yahoo! Groups Links




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

Yahoo! Groups Links


Re: TWS API child order questions

Ed
 

If I remember right he was talking about a limit order which of course
will sit until the price is met. Market orders in liquid markets are
essentially instantaneous.

On 7/12/2013 2:23 PM, cf16r wrote:

@raysalem619 did you really mean "minutes"?
can somebody tell this is not true in a real account?
I would like to see rather something less than second.


Re: Compiling TestSocketClient

bbbvvgtm
 

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

I just downloaded the latest versions from IB. I wanted to compile/run/modify TestSocketClient, but ran into a couple of minor gotchas. So, I decided to document it in case someone else finds it useful.

I started with IB's Getting Started document:
I had some troubles in a couple of areas, so this is my getting started HowTo.

Download and install the standalone desktop version of IB's Trader Workstation
Start Trader Workstation
Click on Edit-Global Configuration
Make sure "Enable ActiveX and Socket Clients" checkbox is checked
Note the number in "Socket port." (Here I will assume it's 7499.)
Click "OK" to save the settings

Download and install the IB API
Create a new folder for your program. (Here I will assume it's C:&#92;MyTestProgram.)
Copy the following folders (and sub-folders) from IB's API location:
Shared
SocketClient
TestSocketClient
Launch Microsoft Visual Studio 2010 Professional Edition
Hopefully 2008 and 2012 also work.
I don't believe the Express Edition includes MFC and therefore will not work.
Click on File - New - Project From Existing Code...
What type of project would you like to create? &#8594; Visual C++
Click on "Next"
Project file location: Browse to your folder (here C:&#92;MyTestProgram).
Project Name: MyTestProgram
Click on "Next"
Check the checkbox "Add support for MFC"
Click on "Finish"
Wait until your program is setup
Click on Project – Properties (or you can right click on MyTestProgram in the Solution Explorer and choose Properties)
Under Configuration Properties – C/C++ - General
For "Additional Include Directories", enter "./Shared;./SocketClient/src"
Do this for both "Debug" and "Release" (Configuration: at top)
Under Configuration Properties – C/C++ - Code Generation
For "Runtime Libraries", choose "Multi-Threaded DLL (/MD)"
Do this for both "Debug" and "Release" (Configuration: at top)
You should now be able to Build both the Debug and Release versions
Run the program, (in the debugger or C:&#92;MyTestProgram&#92;Release&#92;MyTestProgram.exe)
Click on "Connect..."
Change "Port" to the Socket Port noted above (7499).
Click on "Req Mkt Data..."
Change "Symbol" to "IBM" (or whatever)
Click on "OK"
You should now see IBM data being displayed
You can a lot of what is happening in the file "client2Dlg.cpp"
Whoops. Forgot one thing you need to do if you want to disable the "Accept incoming connection attempt" message TWS gives you when you try to connect. (This makes full automation easier.) In Trader Workstation, click on Edit-Global Configuration, then click on "General". Under "Trusted IP Addresses", click "Create" and add "127.0.0.1" then click on "OK" to save it.