Skip to content

Get All Open Trades

GetAllOpenTrades

Retrieves all currently open trades from the system.

int GetAllOpenTrades(std::vector<TradeRecord>* trades);

Parameters

  • trades — pointer to a std::vector of TradeRecord structures where the retrieved open trades will be stored.

Return Value

  • RET_OK — open trades found and successfully retrieved.
  • RET_NOT_FOUND — no open trades found in the system.
  • RET_* — other error codes.
  • Return Codes

Example

std::vector<TradeRecord> openTrades;
if (GetAllOpenTrades(&openTrades) == RET_OK) {
    // Process openTrades
}

Warning

  • The trades pointer must point to a valid std::vector<TradeRecord> object.
  • If no open trades are found, the function will return RET_NOT_FOUND and leave trades unchanged.
  • Always check the return code before accessing trades.