Skip to content

Get Open Trades By Login

GetOpenTradesByLogin

Retrieves all currently open trades for a given account login.

int GetOpenTradesByLogin(int login, std::vector<TradeRecord>* trades);

Parameters

  • login — integer representing the account login ID.
  • 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 for the specified login.
  • RET_* — other error codes.
  • Return Codes

Example

std::vector<TradeRecord> openTrades;
if (GetOpenTradesByLogin(1001, &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.