Skip to content

OnTradeAddOpen

OnTradeAddOpen

Event handler triggered when a new trade is added to DB.

virtual void OnTradeAddOpen(const TradeRecord& trade);

Parameters

  • trade — constant reference to a TradeRecord structure containing the details of the newly opened trade.

Description

This event is called automatically by the system whenever a new trade is successfully opened.
It can be overridden in a derived class to implement custom logic when trades are added.


Example

class MyPlugin : public EventTrade {
public:
    void OnTradeAddOpen(const TradeRecord& trade) override {
        // Custom processing when a new trade is opened
    }
};

Warning

  • This method is event-driven and should not be called manually.
  • Avoid long-running operations inside the handler to prevent blocking the event loop.
  • The provided trade data is valid for the scope of the handler call — copy it if needed for later use.