Skip to content

GetOpenTradesByGroup

Retrieves all open trades that belong to a specific group within a given time range.

int GetOpenTradesByGroup(const std::string& FilterGroup, time_t from, time_t to, std::vector<TradeRecord>* trades);

Parameters

  • FilterGroup — string containing the name of the group used to filter trades.
  • from — starting timestamp (time_t) of the search interval.
  • to — ending timestamp (time_t) of the search interval.
  • trades — pointer to a std::vector<TradeRecord> where resulting open trades will be stored.

Return Value

  • RET_OK — open trades found and successfully retrieved.
  • RET_NOT_FOUND — no open trades found matching the group and time range.
  • RET_* — other error codes depending on system state.
  • Return Codes

Example

std::vector<TradeRecord> trades;
time_t from = 1711920000; // range start (timestamp)
time_t to   = 1712006400; // range end   (timestamp)

if (GetOpenTradesByGroup("default", from, to, &trades) == RET_OK) {
    // Process retrieved trades
}

Warning

  • The trades pointer must reference a valid vector before calling the function.
  • If no trades match the filter, the function returns RET_NOT_FOUND and does not modify the vector.
  • Always check the return code before accessing trade data.

SEO Information

This method is part of the ScaleTrade Plugin API and is used to retrieve open trades filtered by group and time range.
It is essential for plugin systems that analyze trading activity, monitor strategy performance, or generate trade-based reports.

Target phrases:
- ScaleTrade plugin API open trades
- Get trades by group
- C++ trading platform API
- ScaleTrade automation plugins
- Filter open trades by time range
- TradeRecord API structure

Suitable for:
- Developers building custom trading plugins
- Reporting and analytics modules
- Risk monitoring tools
- Automated trade processors