Login Page - Create Account

Support Board


Date/Time: Tue, 30 Apr 2024 05:56:28 +0000



Post From: How to get ClosedProfitLoss of an order. in ACSIL, given the InternalOrderID

[2019-10-21 01:44:00]
User272786 - Posts: 13
Thanks for that.
Your reply helped me to refine my work-around I mentioned on my original post and solved the issue!

So the steps:
1) Keep the InternalOrderID (say orderID) when an order is created. The order
s_SCTradeOrder::EntryDateTime
will differ from the later updated s_SCOrderFillData::FillDateTime.
2) Use
sc.GetOrderFillEntry(fillIndex, s_SCOrderFillData)
to get s_SCOrderFillData::FillDateTime, using:
if (s_SCOrderFillData.InternalOrderID == orderID)
3) Use sc.GetTradeListEntry(Index, s_ACSTrade) to get s_ACSTrade::OpenDateTime
4) Choose the required Trade using:
if (s_ACSTrade::OpenDateTime.IsSameTimeToMilliSecond(s_SCOrderFillData::FillDateTime))
5) Read s_ACSTrade::ClosedProfitLoss

So basically, I am using
s_SCOrderFillData::FillDateTime
as the key|link, as this value is unique, for most purposes, if considered to the millisecond.

If you know a better way and can use InternalOrderID to query Trade data directly, please let us know, thanks.
Date Time Of Last Edit: 2019-10-21 02:42:32