开云体育

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

twsapi: Re: order IDs


David
 

开云体育

I do not use that many orders but your idea, Marcus, is a fanatastic way to have a good, even though delayed, control of your orders.
Do you use any special db or just free dbjet engine?
well done.
David

----- Original Message -----
Sent: Sunday, June 30, 2002 5:05 PM
Subject: AW: twsapi: Re: order IDs

I store everything in a database, including the order details and the order
id.
When you have a Limit order which doesn?t get executed, and you disconnect,
close TWS, open TWS, and reconnect through the API to TWS, then TWS forget?s
the API order ID.

So I decided that I cancel all open orders manually in TWS and then send all
open orders again from my programm to TWS.

Marcus

-----Ursprungliche Nachricht-----
Von: kxlin99 [mailto:klin@...]
Gesendet: Sunday, June 30, 2002 1:49 AM
An: twsapi@...
Betreff: twsapi: Re: order IDs


Hi there -

I would like to know how you manage order ids from session to
session. I meant you place an order and store the order id in your
table, what if the TWS/Windows crashed, and you need reboot the
machine, how do you change/cancel your open orders? Thanks

--- In twsapi@y..., Robert Carey wrote:
> You have to keep track of your trading over time. You have to keep
track of what you or your Automated Trading System is doing. You need
to store what was done, when, and why.
> Besides, the IRS is coming on 4/15/2003 for sure, if not sooner.
> That means storage of your trading events on a hard drive and with
backup.
> I choose to use the Microsoft .mdb format and access it from VB
with DAO 3.6.
> There is a table of trades. It has an entry order number and an
exit order number in each record. There are lots of other fields to
keep track of when, where, and why.
> A recordset RS.TradesEnter is created indexed on the
openOrderNumber.
> A recordset RS.TradesExit is created indexed on the exitOrderNumber.
> They both point to the same table.
>
> Creating a unique entry order number is as follows.
> RS.TradesEnter.MoveLast
> thisEntryOrderNumber = RS.TradesEnter![openOrderNumber] + 2
> thisExitOrderNumber = thisEntryOrderNumber + 1
> Now create a new trade record.
> RS.TradesEnter.AddNew
>???? RS.TradesEnter![openOrderNumber] = thisEntryOrderNumber
>???? RS.TradesEnter![closeOrderNumber] = thisExitOrderNumber
> RS.TradesEnter.Update
>
> When a fill arrives, whether partial of full, RS.TradesEnter
updates the when,where,why fields.
> When you or your ATS decides to close a position,
RS.TradesExit "seeks" this ExitOrderNumber and updates the when,
where, why fields.
> That should keep you and the IRS happy.
> Comments?
> RCarey


Yahoo! Groups Sponsor
ADVERTISEMENT



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



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 .