Looking for a complete guide/consultancy on setting up a conditional order
Hi guys,
I am a new IB user, a futures daytrader and have no idea on
programming. After looking the simple user guide from IB website, I
can do nothing with those sample spreadsheets. I post here to see if
any expert here could help me to set up a conditional order and to re-
organize TWS presentation. A reasonable amount of consultancy fee
will be given. (Price could be referred to similar projects on those
online auction website,like RentACoder). Here are the requirements:
Futures only, less than 10 symbols from different Exchanges, any type
of APIs is Ok (reliabity & speedy are the most important)
Within a SINGLE PAGE, in addition to general features as TWS, like
Order Status, Account Info, Execution Info, contract Description &
Market Data, the most important is,
allowing a Conditional order with 2 order types: a Buy/Sell market
order, Stop Order with aux. price which is based on avg. Buy/Sell
prices, default order sizes are allowed for different symbols.
My idea is, Single page to see all info I want, and single
click/hotkey to complete in/out, (of course, if cancel/modify, extra
key is needed)
Anyone interested, please reply here or email to me at
ibwin2k@.... Thanks in advance.
Regards,
Char.
|
VB and ActiveX....updateExtended() Method????
3
Anyone know if the updateExtended() method is still part of the
ActiveX/VB? If not, how does one implement the extended order
properties such as tif, oca, and transmit? I am new to programming
and just trying to work my way through this stuff. Any help is
appreciated.
|
twsapi: Looking for a complete guide/consultancy on setting up a conditional order
Hi there,
I have written a program that meets some of your
requirements.
http://bullhaven.tripod.com/TradeExecutor/TradeExecutor.htm
todd
--- ibwin2k <ibwin2k@...> wrote:
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
|
twsapi: Re: VB and ActiveX....updateExtended() Method????
As with many features, OCA functionality is parallel in the API and the GUI,
so reading the TWS docs on this would be a good idea.
The OCA string is an identifier assigned by you to group orders together. If
an order with an OCA string set is executed or cancelled, all other orders
with the same string will be cancelled.
-- Elliot
|
Java API
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
|
AW: twsapi: Java API
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
?
-----Ursprüngliche Nachricht-----
Von: usernew
[mailto:no_reply@...]
Gesendet: Tuesday, June 18, 2002
4:24 PM
An: twsapi@...
Betreff: twsapi: Java API
?
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
To unsubscribe from this
group, send an email to:
twsapi-unsubscribe@...
Your use of
Yahoo! Groups is subject to the Yahoo!
Terms of Service.
|
twsapi: Java API
10
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@...> wrote:
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
|
C# .NET + TWS ActiveX = 'Catastrophic failure' exception?
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
|
twsapi: Timing of events
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
|
twsapi: Re: Timing of events
2
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.
|
twsapi: Timing of events
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
|
updateExtended(), extended properties, etc, etc
4
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
|
OCA updateExtended(), extended properties, etc, etc
...thanks for keep us up to date......seriously
...post any and all peculiarities you find with the OCA process...
Scott
|
Why does IB API renumber order id's after internet disconnect?
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
|
Demo Server Question
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
|
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@...
|
Please, help
Please, will you overrite my code line to work ??
it is not working - market , limit..NONE
thanx David
Andrew
Service.
|
twsapi: Please, help
8
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
|
Please, help
DAVID
it's working
U R
LifeSAVER..
thank you so much
Andrew
Service.
|
Please help - VB code --- SEE command4_click
3
Option Explicit
' contract description vars
Dim id As Long
Dim symbol As String
Dim secType As String
Dim expiry As String
Dim strike As Long
Dim right As String
Dim exchange As String
Dim curency As String
Dim port As Long
Private Sub Command1_Click()
Tws1.reqMktData id, symbol, secType, expiry, strike, right, exchange,
curency
Label23.ForeColor = vbGreen
Label23.Caption = "connected"
End Sub
Private Sub Command2_Click()
Tws1.cancelMktData id
Label23.ForeColor = vbRed
Label23.Caption = "disconnected"
End Sub
**
BAD CODE
**
Private Sub Command4_Click()
Call Tws1.placeOrder(3030, "BUY",
1, "ES", "FUT", "200209", "", "", "GLOBEX", "", "LMT", 0, 0)
End Sub
Private Sub Form_Load()
'Here I have set all of the values as static constants for
demonstration purposes
port = 7496 'this is the port number you wrote down
id = 1 '
symbol = "ES"
secType = "FUT"
expiry = "200209"
strike = 0
right = ""
exchange = "GLOBEX"
curency = ""
Tws1.Connect "", port 'This must be the very first thing that is
called
End Sub
'------------------------------------------------------
' PRICES
'------------------------------------------------------
Private Sub Tws1_tickPrice(ByVal id As Long, ByVal tickType As Long,
ByVal price As Single)
'Dim oldprice
'Dim lastprice
'If tickType = LastPriceID Then
'If price > oldprice Then
'Label26.BackColor = vbRed
'End If
'oldprice = price
'End If
'End Sub
'*
'PRICE -last transaction
'*
Dim LastPrice
If id = 1 Then 'reference the reqMktData call by its id number
If tickType = 4 Then
LastPrice = price
Label1.Caption = Format(LastPrice, "0.00")
End If
End If
'*
'PRICE - BID
'*
Dim BIDPrice
If id = 1 Then 'reference the reqMktData call by its id number
If tickType = 1 Then
BIDPrice = price
Label3.Caption = Format(BIDPrice, "0.00")
End If
End If
'*
'PRICE - ASK
'*
Dim ASKPrice
If id = 1 Then 'reference the reqMktData call by its id number
If tickType = 2 Then
ASKPrice = price
Label4.Caption = Format(ASKPrice, "0.00")
End If
End If
End Sub
'------------------------------------------------------
' SIZES
'------------------------------------------------------
'*
'SIZE - LAST
'*
Private Sub Tws1_tickSize(ByVal id As Long, ByVal tickType As Long,
ByVal size As Long)
If id = 1 Then 'reference MUST BE 1
If tickType = 5 Then
'Label2.Caption = Format(size, "000000")
Label2.Caption = size
End If
End If
'*
'SIZE - BID
'*
If id = 1 Then 'reference MUST BE 1
If tickType = 0 Then
Label5.Caption = size
If size > 10 Then
Label7.Visible = True
Else
Label7.Visible = False
End If
If size > 20 Then
Label8.Visible = True
Else
Label8.Visible = False
End If
If size > 30 Then
Label9.Visible = True
Else
Label9.Visible = False
End If
If size > 40 Then
Label10.Visible = True
Else
Label10.Visible = False
End If
If size > 60 Then
Label11.Visible = True
Else
Label11.Visible = False
End If
If size > 100 Then
Label12.Visible = True
Else
Label12.Visible = False
End If
If size > 140 Then
Label13.Visible = True
Else
Label13.Visible = False
End If
If size > 180 Then
Label14.Visible = True
Else
Label14.Visible = False
End If
If size > 240 Then
Label15.Visible = True
Else
Label15.Visible = False
End If
If size > 320 Then
Label16.Visible = True
Else
Label16.Visible = False
End If
If size > 440 Then
Label17.Visible = True
Else
Label17.Visible = False
End If
If size > 560 Then
Label18.Visible = True
Else
Label18.Visible = False
End If
If size > 680 Then
Label19.Visible = True
Else
Label19.Visible = False
End If
If size > 800 Then
Label20.Visible = True
Else
Label20.Visible = False
End If
If size > 1200 Then
Label21.Visible = True
Else
Label21.Visible = False
End If
If size > 2000 Then
Label22.Visible = True
Else
Label22.Visible = False
End If
End If
End If
'*
'SIZE - ASK
'*
If id = 1 Then 'reference MUST BE 1
If tickType = 3 Then
Label6.Caption = size
End If
End If
End Sub
|