Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
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
? |
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 keeptrack 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.backup. I choose to use the Microsoft .mdb format and access it from VBwith DAO 3.6. There is a table of trades. It has an entry order number and anexit 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 theopenOrderNumber. A recordset RS.TradesExit is created indexed on the exitOrderNumber.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. |
to navigate to use esc to dismiss