Closed / filled orders

Moderator: Moderator

Closed / filled orders

Postby Peter Zander » Mon Oct 14, 2013 7:37 am

Hi.

Is there any way to confirm that an order (OrderID) have existed and have been filled / closed / removed?

Using the logic "if not in the Orders table, it must have been removed" can give false positives in case of implementation bugs or other technical (communication and so on...) issues.

Thanks!
Peter
Peter Zander
 
Posts: 3
Joined: Mon Oct 14, 2013 7:30 am

Re: Closed / filled orders

Postby Gennadiy » Tue Oct 15, 2013 5:15 am

Hello Peter Zander,

The better way to confirm that an order (OrderID) has existed and has been filled/closed/removed is to monitor the transaction events by using the Orders Table:

Code: Select all
class IO2GTableListener : public IAddRef
{
 public:
    virtual void onAdded(const char *rowID, IO2GRow *rowData) = 0;
    virtual void onChanged(const char *rowID, IO2GRow *rowData) = 0;
    virtual void onDeleted(const char *rowID, IO2GRow *rowData) = 0;

    virtual void onStatusChanged(O2GTableStatus status) = 0;
};
Gennadiy
 

Re: Closed / filled orders

Postby Peter Zander » Tue Oct 15, 2013 6:14 am

Yes. As long as my system is running I can track what is happening with the orders.

The problem is synchronizing the local state with the current order state at start-up.

Limit orders might have been filled and stop orders might have been triggered while my system was not running.
Peter Zander
 
Posts: 3
Joined: Mon Oct 14, 2013 7:30 am

Re: Closed / filled orders

Postby Gennadiy » Wed Oct 16, 2013 5:51 am

Hello Peter Zander,

At the start-up your system will be synchronized with the server. The Orders table will be refreshed automatically and updated to the server state.
Please find the O2GTableStatus for more details (http://www.fxcorporate.com/help/CPlusPl ... tatus.html - how to get the status of the table).

If you would like to track which exactly orders have been executed/changed/removed while your system was not running, you can use the following solutions:

1) You can use the Get Last Order Update command (http://www.fxcorporate.com/help/DotNet/ ... pdate.html) to get the up-to-date order information from the server. You can find out whether the order was executed while your system was not running.

2) In case of the Order was the Open Order. You should find the trade position which was opened by this order. IO2GTradeRow.getOpenOrderID will contain the open Order ID. But note, that on the real market one Open Order can open more than one trade position (partial filling).

3) In case of the Order was the Close Order (for example Stop, Limit, ELS). You should find the trade position which was closed by this order. IO2GClosedTradeRow.getCloseOrderID will contain the Close Order ID. But note that on the real market the quantity of closed positions (closed by one Close Order) may be more than one (partial filling).

4) In case of positions were closed more than one day ago, you can get the CAS report for your account using GetReportUrl (C:\Program Files\Candleworks\ForexConnectAPIx64\samples\cs\dotnet40\SimpleSamples\NonTableManagerSamples\GetReportUrl\ to see how to request and get a CAS report). The cell close_order_id will contain the Order ID which close the position.
Gennadiy
 

Re: Closed / filled orders

Postby Peter Zander » Wed Oct 16, 2013 3:23 pm

Exactly what I was looking for. Thank you!
Peter Zander
 
Posts: 3
Joined: Mon Oct 14, 2013 7:30 am


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 9 guests