开云体育

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

Re: twsapi: Please, help

multicen2002
 

Run-time Error 13




--- In twsapi@y..., "David" <kotomo@p...> wrote:
what errors do you get ?
----- Original Message -----
From: multicen2002
To: twsapi@y...
Sent: Saturday, June 22, 2002 12:50 PM
Subject: Re: twsapi: Please, help


Thank you for trying David.
But again it is not working.. everything else works fine.

Anybody know how to solve my 1 week long torture with this
line ??
Please, post a sample code line which really works for you and I
can
go from there.

WARM Thank you to You all.

Andrew
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-----------------------------------
bad code line start here
-----------------------------------

Private Sub Command4_Click()

Tws1.placeOrder 3030, "BUY",
1, "ES", "FUT", "200209", "", "", "GLOBEX", "", "LMT", 0, 0

End Sub






--- In twsapi@y..., "David" <kotomo@p...> wrote:
> First, your ORDERID - 1 could be a PROBLEM - generate a larger
number and increase by delta of 10 or more ( still first order
may
cause duplicate error - keep trying or increase first and then
place
an order)
> after Expire Date - the strike price use 0
> right use "" instead
> on the exchange not sure - use "GLOBEX" if after the other
changes
will not make it work(dont trade ES)
> again for currency use ""
> This should work
> David
> ----- Original Message -----
> From: multicen2002
> To: twsapi@y...
> Sent: Saturday, June 22, 2002 12:15 PM
> Subject: twsapi: Please, help
>
>
> Hi,
> I am working on my VB API for IB platform. Thanx to ppl like
you,
> everything starting to work just fine.
> BUT..
> I wasted 1 week trying to send limit order from my box.
> what is wrong with this code ??
>
> ----------------------------------------
> code
> ----------------------------------------
> Private Sub Command4_Click()
>
> Tws1.placeOrder 1, "BUY", 1, "ES", "FUT", "200209",_
> LastPrice, , "SMART", , "LMT", LastPrice, 0
>
> End Sub
>
> Please, help ..
> multicen2002@y...
>
>
>
> To unsubscribe from this group, send an email to:
> twsapi-unsubscribe@y...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Yahoo! Groups Sponsor
ADVERTISEMENT




To unsubscribe from this group, send an email to:
twsapi-unsubscribe@y...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Re: twsapi: Please, help

David
 

开云体育

what errors do you get ?

----- Original Message -----
Sent: Saturday, June 22, 2002 12:50 PM
Subject: Re: twsapi: Please, help

Thank you for trying David.
But again it is not working.. everything else works fine.

Anybody know how to solve my 1 week long torture with this line? ??
Please, post a sample code line which really works for you and? I can
go from there.

WARM Thank you to You all.

Andrew
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-----------------------------------
bad code line start here
-----------------------------------

Private Sub Command4_Click()

Tws1.placeOrder 3030, "BUY",
1, "ES", "FUT", "200209", "", "", "GLOBEX", "", "LMT", 0, 0

End Sub






--- In twsapi@y..., "David" wrote:
> First, your ORDERID - 1 could be a PROBLEM - generate a larger
number and increase by delta of 10 or more ( still first order may
cause duplicate error - keep trying or increase first and then place
an order)
> after Expire Date - the strike price use 0
> right? use "" instead
> on the exchange not sure - use "GLOBEX" if after the other changes
will not make it work(dont trade ES)
> again for currency use ""
> This should work
> David
>?? ----- Original Message -----
>?? From: multicen2002
>?? To: twsapi@y...
>?? Sent: Saturday, June 22, 2002 12:15 PM
>?? Subject: twsapi: Please, help
>
>
>?? Hi,
>?? I am working on my VB API for IB platform. Thanx to ppl like you,
>?? everything starting to work just fine.
>?? BUT..
>?? I wasted 1 week trying to send limit order from my box.
>?? what is wrong with this code ??
>
>?? ----------------------------------------
>?? code
>?? ----------------------------------------
>?? Private Sub Command4_Click()
>
>?? Tws1.placeOrder 1, "BUY", 1, "ES", "FUT", "200209",_
>?? LastPrice, , "SMART", , "LMT", LastPrice, 0
>
>?? End Sub
>
>?? Please, help ..
>?? multicen2002@y...
>
>
>
>?? To unsubscribe from this group, send an email to:
>?? twsapi-unsubscribe@y...
>
>
>
>?? Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Re: twsapi: Please, help

multicen2002
 

Thank you for trying David.
But again it is not working.. everything else works fine.

Anybody know how to solve my 1 week long torture with this line ??
Please, post a sample code line which really works for you and I can
go from there.

WARM Thank you to You all.

Andrew
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-----------------------------------
bad code line start here
-----------------------------------

Private Sub Command4_Click()

Tws1.placeOrder 3030, "BUY",
1, "ES", "FUT", "200209", "", "", "GLOBEX", "", "LMT", 0, 0

End Sub






--- In twsapi@y..., "David" <kotomo@p...> wrote:
First, your ORDERID - 1 could be a PROBLEM - generate a larger
number and increase by delta of 10 or more ( still first order may
cause duplicate error - keep trying or increase first and then place
an order)
after Expire Date - the strike price use 0
right use "" instead
on the exchange not sure - use "GLOBEX" if after the other changes
will not make it work(dont trade ES)
again for currency use ""
This should work
David
----- Original Message -----
From: multicen2002
To: twsapi@y...
Sent: Saturday, June 22, 2002 12:15 PM
Subject: twsapi: Please, help


Hi,
I am working on my VB API for IB platform. Thanx to ppl like you,
everything starting to work just fine.
BUT..
I wasted 1 week trying to send limit order from my box.
what is wrong with this code ??

----------------------------------------
code
----------------------------------------
Private Sub Command4_Click()

Tws1.placeOrder 1, "BUY", 1, "ES", "FUT", "200209",_
LastPrice, , "SMART", , "LMT", LastPrice, 0

End Sub

Please, help ..
multicen2002@y...



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@y...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Re: twsapi: Please, help

David
 

开云体育

First, your ORDERID - 1 could be a PROBLEM - generate a larger number and increase by delta of 10 or more ( still first order may cause duplicate error - keep trying or increase first and then place an order)
after Expire Date - the strike price use 0
right? use "" instead
on the exchange not sure - use "GLOBEX" if after the other changes will not make it work(dont trade ES)
again for currency use ""
This should work
David

----- Original Message -----
Sent: Saturday, June 22, 2002 12:15 PM
Subject: twsapi: Please, help

Hi,
I am working on my VB API for IB platform. Thanx to ppl like you,
everything starting to work just fine.
BUT..
I wasted 1 week trying to send limit order from my box.
what is wrong with this code ??

----------------------------------------
code
----------------------------------------
Private Sub Command4_Click()

Tws1.placeOrder 1, "BUY", 1, "ES", "FUT", "200209",_
LastPrice, , "SMART", , "LMT", LastPrice, 0

End Sub

Please, help ..
multicen2002@...



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Please, help

multicen2002
 

Hi,
I am working on my VB API for IB platform. Thanx to ppl like you,
everything starting to work just fine.
BUT..
I wasted 1 week trying to send limit order from my box.
what is wrong with this code ??

----------------------------------------
code
----------------------------------------
Private Sub Command4_Click()

Tws1.placeOrder 1, "BUY", 1, "ES", "FUT", "200209",_
LastPrice, , "SMART", , "LMT", LastPrice, 0

End Sub

Please, help ..
multicen2002@...


Demo Server Question

marinindextrader
 

To any and all...

I have never used the demo server.

I have always used my accounts...for testing

What is up with the demo server? When I fire up my client side TWS
what special user name and password are required to access the demo
server?

I have a suspicion that you need to log on through the web based Java
platform to access the demo server accounts...I hope I am wrong...

Thanks

Scott


Why does IB API renumber order id's after internet disconnect?

marinindextrader
 

This message was originally posted on IB's API forum. I Thought it
worthy of our archives and discussion.

Posted on Wednesday, June 19, 2002 - 06:26 am:

----------------------------------------------------------------------
----------
Dear IB,

There is a problem with the ActiveX API/TWS interface after a
disruption of the internet connection to IB. To demonstrate this
problem using the Excel sheet do this:
1 - Place a stop or limit oder (order status will change
to 'Submitted' or 'Presubmitted' depending on ordertype and
exchange). Write down the assigned order id. In this example I assume
it is 123.
2 - Fake a disruption of your internet connection by unplugging the
network cable from your PC till TWS show the grid.
3 - Plug in the cable again, the grid disappears and TWS shows quote
updates again. So far so good.
4 - Now try to cancel the order - You get an error "Can't find order
with id 123"
5 - If you request open orders you see the order Id has changed (in
our case from 123 to 124).


Questions:
What is the correct procedure to cancel the order?
Why does IB renumber order id's after a disruption of the internet
connection?


Note:
- This behaviour doesn't match the API documentation for cancelOrder
() which tells you to use the ID that was specified previously in the
call to placeOrder().
- This also explains the 'Duplicate order id' messages people have
been seeing lately.
- In the example above we used cancelOrder() but placeOrder() (when
changing orders) has the same problem.
- We used the most current Release of TWS and the API

Regards,
Pieter


Re: OCA updateExtended(), extended properties, etc, etc

marinindextrader
 

...thanks for keep us up to date......seriously

...post any and all peculiarities you find with the OCA process...

Scott




--- In twsapi@y..., "BrianL_98" <brianl_98@y...> wrote:
Hi,

If you are still wondering how to place an OCA in VB, I did some
testing today and was able to get it to work. Here's what you do:
The OCA property has a default value of null (""). Set this
property
to some other value. Successive order placements using placeOrder
()
will all be grouped together as OCA orders. When done, you should
reset the OCA property to null.

Here's a code snippet that sets two OCA stop orders:

Tws1.oca = "test2"
Tws1.placeOrder NextID, "BUY", 1, "ES", _
"FUT", "200209",
0, "", "GLOBEX", "", "STP", 0, 1035
NextID = NextID + 1
Tws1.placeOrder NextID, "SELL", 1, "ES", _
"FUT", "200209",
0, "", "GLOBEX", "", "STP", 0, 1000#
NextID = NextID + 1
Tws1.oca = ""


--Brian



--- In twsapi@y..., mickjenks <no_reply@y...> wrote:
Thanks Elliot,

However, I have read the TWS docs and understand the purpose of
OCA.
That was never the question. The placeOrder() method doesn't
include
in its declaration a variable for sending an OCA identifier, nor
does
it allow for TIF or Transmit to be sent with the individual
orders.
Could someone explain how to implement these properties on an
order
to order basis? Thanks


Re: updateExtended(), extended properties, etc, etc

BrianL_98
 

Hi,

If you are still wondering how to place an OCA in VB, I did some
testing today and was able to get it to work. Here's what you do:
The OCA property has a default value of null (""). Set this property
to some other value. Successive order placements using placeOrder()
will all be grouped together as OCA orders. When done, you should
reset the OCA property to null.

Here's a code snippet that sets two OCA stop orders:

Tws1.oca = "test2"
Tws1.placeOrder NextID, "BUY", 1, "ES", _
"FUT", "200209",
0, "", "GLOBEX", "", "STP", 0, 1035
NextID = NextID + 1
Tws1.placeOrder NextID, "SELL", 1, "ES", _
"FUT", "200209",
0, "", "GLOBEX", "", "STP", 0, 1000#
NextID = NextID + 1
Tws1.oca = ""


--Brian



--- In twsapi@y..., mickjenks <no_reply@y...> wrote:
Thanks Elliot,

However, I have read the TWS docs and understand the purpose of
OCA.
That was never the question. The placeOrder() method doesn't
include
in its declaration a variable for sending an OCA identifier, nor
does
it allow for TIF or Transmit to be sent with the individual orders.
Could someone explain how to implement these properties on an order
to order basis? Thanks


Re: twsapi: Timing of events

David
 

开云体育

Michael,
If you use a common function for both price and size, you will see that the price comes first but as one person stated correctly they would have to be independent events.
So when a new price? and a new size is traded the price comes first, otherwise they work separately.
All other comments are valid -? no hope for volume.
In my program I drive the whole program of displaying data in modified bar format on 5 different forms representing different time frames, calculating hundreds of different indicators that are created as objects,?and respond to my key events for orders - it works very well and very quickly.
However, I use only one instrument that I trade and don't use volume too seriously as I don't think it is so relevant in futures.
Hope it was of some help
David
?

----- Original Message -----
From: migurull
Sent: Thursday, June 20, 2002 2:55 AM
Subject: twsapi: Timing of events

Hello,

I'm evaluating TWS ActiveX component in Visual Basic and I have some
questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
using the web based Demo system for this evaluations):

1- When last price AND last size change at the same time(new
quotation), is there some guarantee about the order in which
tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
tickSize?)

2- When quotation repeats at the same price and the same size, it
seems that there is no tickPrice, nor tickSize events fired. In this
case, how to detect that a new quotation had taken place (for
example, in order to compute total traded volume by adding all last
sizes)?

Thanks for your help.

Michel.



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Re: twsapi: Re: Timing of events

Richard Foulk
 

Abandon the thought of computing volume from IB's data.

You will only get a small fraction of all ticks from IB. Okay for
some things, but not anywhere near a full data feed.


Richard

} Thanks Scott, this is as I understand it.
} So there is no way to detect various trades at the same price and size?
} This could be a very bad issue because it is important (at least for me, and
} I think for many people) to compute volume along the day.
}
} Michel.
} -----Mensaje original-----
} De: marinindextrader [mailto:marinindextrader@...]
} Enviado el: mi?rcoles, 19 de junio de 2002 19:38
} Para: twsapi@...
} Asunto: twsapi: Re: Timing of events
}
}
} Both tickPrice and tickSize are autonamous of one another. Further
} they only fire when there is a change.
}
} An example would be 10 trades going off at the same price at
} different volumes would fire zero price events, and 10 size events.
}
} and vice versa
}
} 10 trades at different price but the same size would fire 10 price
} events and zero size events.
}
} and ten trades going off the same price and size would have the same
} effect as if no trade had occured at all.
}
} That is my understanding and experience with tickPrice and tickSize.
}
} Scott
}
}
} --- In twsapi@y..., "migurull" <migurull@t...> wrote:
} > Hello,
} >
} > I'm evaluating TWS ActiveX component in Visual Basic and I have
} some
} > questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
} > using the web based Demo system for this evaluations):
} >
} > 1- When last price AND last size change at the same time(new
} > quotation), is there some guarantee about the order in which
} > tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
} > tickSize?)
} >
} > 2- When quotation repeats at the same price and the same size, it
} > seems that there is no tickPrice, nor tickSize events fired. In
} this
} > case, how to detect that a new quotation had taken place (for
} > example, in order to compute total traded volume by adding all last
} > sizes)?
} >
} > Thanks for your help.
} >
} > Michel.


Re: twsapi: Timing of events

Robert Carey
 

开云体育

When I started working with TWS ActiveX with VB I explored tickPrice and tickSize first.
My observation was that either event occurred once a second and only if a number changed.
You could build a set of one second bars of price, or any multiple of it (say 60 seconds), that would be reasonably accurate for trades, bids, and asks.
You could develop a concept of the depth of the market by averaging out all the ask sizes for a minute. Ditto for bid sizes.
No way can you get anything resembling the tick stream from this data. I don't think IB wants to get into the datafeed business.
RCarey

----- Original Message -----
From: migurull
Sent: Wednesday, June 19, 2002 12:55 PM
Subject: twsapi: Timing of events

Hello,

I'm evaluating TWS ActiveX component in Visual Basic and I have some
questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
using the web based Demo system for this evaluations):

1- When last price AND last size change at the same time(new
quotation), is there some guarantee about the order in which
tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
tickSize?)

2- When quotation repeats at the same price and the same size, it
seems that there is no tickPrice, nor tickSize events fired. In this
case, how to detect that a new quotation had taken place (for
example, in order to compute total traded volume by adding all last
sizes)?

Thanks for your help.

Michel.



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Re: twsapi: Re: Timing of events

Michel
 

开云体育

Thanks Scott, this is as I understand it.
So there is no way to detect various trades at the same price and size?
This could be a very bad issue because it is important (at least for me, and I think for many people) to compute volume along the day.
?
Michel.

-----Mensaje original-----
De: marinindextrader [mailto:marinindextrader@...]
Enviado el: miércoles, 19 de junio de 2002 19:38
Para: twsapi@...
Asunto: twsapi: Re: Timing of events

Both tickPrice and tickSize are autonamous of one another. Further
they only fire when there is a change.

An example would be 10 trades going off at the same price at
different volumes would fire zero price events, and 10 size events.

and vice versa

10 trades at different price but the same size would fire 10 price
events and zero size events.

and ten trades going off the same price and size would have the same
effect as if no trade had occured at all.

That is my understanding and experience with tickPrice and tickSize.

Scott


--- In twsapi@y..., "migurull" wrote:
> Hello,
>
> I'm evaluating TWS ActiveX component in Visual Basic and I have
some
> questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
> using the web based Demo system for this evaluations):
>
> 1- When last price AND last size change at the same time(new
> quotation), is there some guarantee about the order in which
> tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
> tickSize?)
>
> 2- When quotation repeats at the same price and the same size, it
> seems that there is no tickPrice, nor tickSize events fired. In
this
> case, how to detect that a new quotation had taken place (for
> example, in order to compute total traded volume by adding all last
> sizes)?
>
> Thanks for your help.
>
> Michel.



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Re: Timing of events

marinindextrader
 

Both tickPrice and tickSize are autonamous of one another. Further
they only fire when there is a change.

An example would be 10 trades going off at the same price at
different volumes would fire zero price events, and 10 size events.

and vice versa

10 trades at different price but the same size would fire 10 price
events and zero size events.

and ten trades going off the same price and size would have the same
effect as if no trade had occured at all.

That is my understanding and experience with tickPrice and tickSize.

Scott


--- In twsapi@y..., "migurull" <migurull@t...> wrote:
Hello,

I'm evaluating TWS ActiveX component in Visual Basic and I have
some
questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
using the web based Demo system for this evaluations):

1- When last price AND last size change at the same time(new
quotation), is there some guarantee about the order in which
tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
tickSize?)

2- When quotation repeats at the same price and the same size, it
seems that there is no tickPrice, nor tickSize events fired. In
this
case, how to detect that a new quotation had taken place (for
example, in order to compute total traded volume by adding all last
sizes)?

Thanks for your help.

Michel.


Timing of events

migurull
 

Hello,

I'm evaluating TWS ActiveX component in Visual Basic and I have some
questions/problems regarding 'tickPrice' and 'tickSize' events (I'm
using the web based Demo system for this evaluations):

1- When last price AND last size change at the same time(new
quotation), is there some guarantee about the order in which
tickPrice and tickSize events are rised? (ALWAYS tickPrice BEFORE
tickSize?)

2- When quotation repeats at the same price and the same size, it
seems that there is no tickPrice, nor tickSize events fired. In this
case, how to detect that a new quotation had taken place (for
example, in order to compute total traded volume by adding all last
sizes)?

Thanks for your help.

Michel.


C# .NET + TWS ActiveX = 'Catastrophic failure' exception?

pjslim99
 

I have connected fine using Java and C++ API to TWS, however using
Visual Studio.NET and C#,
I get

'An unhandled exception of type:
System.Runtime.InteropServices.COMException
occured in mscorlib.dll: Catastrophic failure'

I am doing the following

- Start TWS running locally.
- TWS: Settings->Enable ActiveX and Socket Clients
- Create new C# project
- Solution Explorer: Add Reference: Tws ActiveX Control module
(Tws.ocx)
- Add Button with handler and code:

using TWSLib;

.
.

TwsClass myTws = new TwsClass();
myTws.connect("", 7496);

.
.

- and run the program.

If I call any function or retrieve a property from the ActiveX
control I get the same exception.

Any thoughts? Anyone succesfully got C# + TWS API working?

thanks,
PJ


Re: twsapi: Java API

gu6526
 

There are basically two methods to do this:

1. wait() / notifyAll() communication

In your main program use wait() to go to sleep without polling.
Catch the interruptedException and go on.

In the wrapper functions that receive the data do some checking that
all your requested data have arrived and reactivate your main with
notifyAll(). The wrapper functions are called asynchronously by the
reader thread that was spawned from your main with the connect() call.

2. If you use a GUI, e.g. some Swing objects you can use the
appropriate event handling to update your presentation objects with
the asynchrounously received ticket data. The TestJavaClient
application from IB is an example.

Gernot

In twsapi@y..., usernew <no_reply@y...> wrote:

I need to get info on n tickers, so this is what I do at the moment:

tws.connect();
for(i=0; i<n; i++){
tws.requestdata(...)
}
tws.wait_trans(); // to make sure all the prices have arrived
tws.disconnect();

// prices have arrived
// so do stuff here

Looking at the docs for request data, because I need info on n
tickers, seems I would have to call requestdata n times

My concern was making tws.wait_trans() not consume cycles.


Re: twsapi: Java API

usernew
 

I need to get info on n tickers, so this is what I do at the moment:

tws.connect();
for(i=0; i<n; i++){
tws.requestdata(...)
}
tws.wait_trans(); // to make sure all the prices have arrived
tws.disconnect();

// prices have arrived
// so do stuff here

Looking at the docs for request data, because I need info on n
tickers, seems I would have to call requestdata n times

My concern was making tws.wait_trans() not consume cycles.

--- In twsapi@y..., "David" <kotomo@p...> wrote:
usernew,
maybe i do not know what you want or misunderstand TWS control but
you need to send requestData() only once - you can do it before the
session.
David
----- Original Message -----
From: usernew
To: twsapi@y...
Sent: Wednesday, June 19, 2002 3:56 AM
Subject: Re: twsapi: Java API


So you are saying tickPrice, tickSize etc. are guaranteed to
happen
by the time requestData() returns ? I thought tickPrice etc. were
completely asynchronous.

--- In twsapi@y..., Todd Turner <todd_a_turner@y...> wrote:
> I believe that the callbacks only occur during a call
> to requestData().
>
> In my initial testing I used Sleep with no problem. I
> now have Windows sending a WM_TIMER message to my apps
> message queue every 250 msecs now.
> --- usernew <no_reply@y...> wrote:
> > Yeah, I tried that and got exceptions. The problem
> > might be that when
> > you sleep the whole thread is put to sleep, so the
> > event tickprice
> > etc. callbacks can't happen. So, a regular sleep
> > might not work well
> > in this case.
> >
> > --- In twsapi@y..., Todd Turner <todd_a_turner@y...>
> > wrote:
> > > I am not familiar with Java, but you need some
> > sort of
> > > system call Sleep(int timeout_msecs), so that the
> > > process blocks until the timeout occurs. This
> > > functionality is provided by the OS.
> > >
> > >
> > > --- usernew <no_reply@y...> wrote:
> > > > My program currently is structured as follows:
> > > >
> > > > class TWS implements EWrapper {
> > > > public void requestdata(...)
> > > > public void tickPrice(...)
> > > > public void tickSize(...)
> > > > ...
> > > > public void wait_trans() {
> > > > for(i=0; i < xxxxx; i++);
> > > > }
> > > > }
> > > >
> > > > public class Main {
> > > > tws.connect();
> > > > for(i=0; i<n; i++)
> > > > tws.requestdata(...)
> > > > tws.wait_trans();
> > > > tws.disconnect();
> > > > }
> > > >
> > > > Is there a better way to structure this program
> > ?
> > > >
> > > > My concern is wait_trans(). It is continuously
> > > > eating up cycles. My
> > > > program does not need to do anything while it is
> > > > waiting for the
> > > > arrays to be populated, but I would still like
> > to
> > > > wait without
> > > > consuming cycles.
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! - Official partner of 2002 FIFA World Cup
> > >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
>


Yahoo! Groups Sponsor
ADVERTISEMENT




To unsubscribe from this group, send an email to:
twsapi-unsubscribe@y...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Re: twsapi: Java API

David
 

开云体育

usernew,
maybe i do not know what you want or misunderstand TWS control but you need to send requestData() only once - you can do it before the session.
David

----- Original Message -----
From: usernew
Sent: Wednesday, June 19, 2002 3:56 AM
Subject: Re: twsapi: Java API

So you are saying tickPrice, tickSize etc. are guaranteed to happen
by the time requestData() returns ? I thought tickPrice etc. were
completely asynchronous.

--- In twsapi@y..., Todd Turner <todd_a_turner@y...> wrote:
> I believe that the callbacks only occur during a call
> to requestData().
>
> In my initial testing I used Sleep with no problem.? I
> now have Windows sending a WM_TIMER message to my apps
> message queue every 250 msecs now.
> --- usernew wrote:
> > Yeah, I tried that and got exceptions. The problem
> > might be that when
> > you sleep the whole thread is put to sleep, so the
> > event tickprice
> > etc. callbacks can't happen. So, a regular sleep
> > might not work well
> > in this case.
> >
> > --- In twsapi@y..., Todd Turner > > wrote:
> > > I am not familiar with Java, but you need some
> > sort of
> > > system call Sleep(int timeout_msecs), so that the
> > > process blocks until the timeout occurs.? This
> > > functionality is provided by the OS.
> > >
> > >
> > > --- usernew wrote:
> > > > My program currently is structured as follows:
> > > >
> > > > class TWS implements EWrapper {
> > > >?? public void requestdata(...)
> > > >?? public void tickPrice(...)
> > > >?? public void tickSize(...)
> > > >?? ...
> > > >?? public void wait_trans() {
> > > >???? for(i=0; i < xxxxx; i++);
> > > >?? }
> > > > }
> > > >
> > > > public class Main {
> > > >??? tws.connect();
> > > >??? for(i=0; i> > > >?????? tws.requestdata(...)
> > > >??? tws.wait_trans();
> > > >??? tws.disconnect();
> > > > }
> > > >
> > > > Is there a better way to structure this program
> > ?
> > > >
> > > > My concern is wait_trans(). It is continuously
> > > > eating up cycles. My
> > > > program does not need to do anything while it is
> > > > waiting for the
> > > > arrays to be populated, but I would still like
> > to
> > > > wait without
> > > > consuming cycles.
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! - Official partner of 2002 FIFA World Cup
> > >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
>



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@...



Your use of Yahoo! Groups is subject to the .


Re: twsapi: Java API

gu6526
 

You should look at EClientSocket.java:
It spawns an asynchronous thread with

tm_reader = new EReader( this, dis);

The wrapper functions are called from this thread whenever a message
is received by the client. So there is no need to wait! It's done
all asynchronously.

Gernot

--- In twsapi@y..., Todd Turner <todd_a_turner@y...> wrote:
I believe that the callbacks only occur during a call
to requestData().

In my initial testing I used Sleep with no problem. I
now have Windows sending a WM_TIMER message to my apps
message queue every 250 msecs now.
--- usernew <no_reply@y...> wrote:
Yeah, I tried that and got exceptions. The problem
might be that when
you sleep the whole thread is put to sleep, so the
event tickprice
etc. callbacks can't happen. So, a regular sleep
might not work well
in this case.

--- In twsapi@y..., Todd Turner <todd_a_turner@y...>
wrote:
I am not familiar with Java, but you need some
sort of
system call Sleep(int timeout_msecs), so that the
process blocks until the timeout occurs. This
functionality is provided by the OS.


--- usernew <no_reply@y...> wrote:
My program currently is structured as follows:

class TWS implements EWrapper {
public void requestdata(...)
public void tickPrice(...)
public void tickSize(...)
...
public void wait_trans() {
for(i=0; i < xxxxx; i++);
}
}

public class Main {
tws.connect();
for(i=0; i<n; i++)
tws.requestdata(...)
tws.wait_trans();
tws.disconnect();
}

Is there a better way to structure this program
?

My concern is wait_trans(). It is continuously
eating up cycles. My
program does not need to do anything while it is
waiting for the
arrays to be populated, but I would still like
to
wait without
consuming cycles.

Thanks in advance


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup