开云体育

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

order IDs


Robert Carey
 

开云体育

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
?


marinindextrader
 

"I choose to use the Microsoft .mdb format and access it from VB with
DAO 3.6."

I am gonna put the screws to you when I get to this point...count on
it..

Excellent Tangent

Scott


kxlin99
 

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 <rcarey1@o...> 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