---
updatedAt: 2026-09-01T01:27:36.000Z
agentTools:
  projectIndex: https://apidocs.bct.host/llms.txt
---

# Retrieve Account Group Balance Snapshots

Query PI balance snapshot data for a specified date. Supports both JSON and CSV response formats (controlled via Accept header). Returns the latest snapshot data when no date is specified.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Balance and Position Snapshot",
    "description": "PI Balance Snapshot API service providing subscription management and daily historical account group balance snapshot queries.",
    "version": "3.0.0"
  },
  "servers": [
    {
      "url": "https://trade-hk.osl.com"
    }
  ],
  "paths": {
    "/api/3/accountGroup/getHistoricalAccountGroups": {
      "post": {
        "summary": "Retrieve Account Group Balance Snapshots",
        "description": "Query PI balance snapshot data for a specified date. Supports both JSON and CSV response formats (controlled via Accept header). Returns the latest snapshot data when no date is specified.",
        "operationId": "getHistoricalAccountGroups",
        "tags": [
          "PiBalanceSnapshot"
        ],
        "security": [
          {
            "apiKeyAuth": [],
            "hmacSignature": []
          }
        ],
        "parameters": [
          {
            "name": "Accept",
            "in": "header",
            "description": "Response format. application/json returns JSON, text/csv returns CSV file",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "application/json",
                "text/csv"
              ],
              "default": "application/json"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetHistoricalAccountGroupsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Query successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetHistoricalAccountGroupsResponse"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "description": "Balance snapshot data in CSV format"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalidDateFormat": {
                    "summary": "Invalid date format",
                    "value": {
                      "error": {
                        "name": "BadRequest",
                        "message": "Invalid date format. Expected: yyyy-MM-dd"
                      }
                    }
                  },
                  "dateTooOld": {
                    "summary": "Date exceeds retention period",
                    "value": {
                      "error": {
                        "name": "BadRequest",
                        "message": "Query date cannot be earlier than 2026-07-26. Historical data is only retained for 30 days."
                      }
                    }
                  },
                  "futureDate": {
                    "summary": "Future date not allowed",
                    "value": {
                      "error": {
                        "name": "BadRequest",
                        "message": "Query date cannot be in the future."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Rest-Key",
        "description": "API Key"
      },
      "hmacSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Rest-Sign",
        "description": "HMAC signature"
      }
    },
    "schemas": {
      "GetHistoricalAccountGroupsRequest": {
        "type": "object",
        "properties": {
          "queryDate": {
            "type": "string",
            "format": "date",
            "description": "Query date in yyyy-MM-dd format. If not provided, returns data for the user's latest snapshot date",
            "example": "2026-08-20"
          },
          "accountGroupUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Account group UUID. If not provided, returns data for all account groups of the user",
            "example": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
          }
        }
      },
      "GetHistoricalAccountGroupsResponse": {
        "type": "object",
        "properties": {
          "userUuid": {
            "type": "string",
            "format": "uuid",
            "description": "User UUID"
          },
          "queryDate": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Actual snapshot date queried",
            "example": "2026-08-20"
          },
          "snapshotTimestamp": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Snapshot timestamp (fixed at 23:00:00 UTC of the snapshot date)",
            "example": "2026-08-20T23:00:00Z"
          },
          "accountGroupUuid": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Account group UUID specified in the request (null if not specified)"
          },
          "accountGroupSummary": {
            "type": "array",
            "description": "Asset summary per account group",
            "items": {
              "$ref": "#/components/schemas/AccountGroupSummary"
            }
          },
          "histories": {
            "type": "array",
            "description": "Balance snapshot detail list",
            "items": {
              "$ref": "#/components/schemas/BalanceHistoryItem"
            }
          },
          "message": {
            "type": "string",
            "nullable": true,
            "description": "Additional message (e.g. when data exceeds retention period)"
          }
        }
      },
      "AccountGroupSummary": {
        "type": "object",
        "properties": {
          "accountGroupUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Account group UUID"
          },
          "accountGroupName": {
            "type": "string",
            "description": "Account group name"
          },
          "totalAssetInUsd": {
            "type": "string",
            "description": "Total asset value in USD for this account group (8 decimal places)",
            "example": "125678.12345678"
          }
        }
      },
      "BalanceHistoryItem": {
        "type": "object",
        "properties": {
          "accountGroupUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Account group UUID"
          },
          "accountGroupName": {
            "type": "string",
            "description": "Account group name"
          },
          "accountUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Account UUID"
          },
          "ccy": {
            "type": "string",
            "description": "Currency code",
            "example": "BTC"
          },
          "snapshotTimestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Snapshot timestamp",
            "example": "2026-08-20T23:00:00Z"
          },
          "priceInUsd": {
            "type": "string",
            "description": "USD price of the currency on the snapshot date (8 decimal places)",
            "example": "67234.56780000"
          },
          "valueInUsd": {
            "type": "string",
            "description": "Total holding value in USD (total * priceInUsd, 8 decimal places)",
            "example": "33617.28390000"
          },
          "balances": {
            "$ref": "#/components/schemas/BalanceDetail"
          }
        }
      },
      "BalanceDetail": {
        "type": "object",
        "description": "Balance breakdown (all amounts with 8 decimal places)",
        "properties": {
          "total": {
            "type": "string",
            "description": "Total balance",
            "example": "0.50000000"
          },
          "primaryAccount": {
            "type": "string",
            "description": "Available balance"
          },
          "exchangeAccount": {
            "type": "string",
            "description": "Exchange account balance"
          },
          "holdBalance": {
            "type": "string",
            "description": "Hold (frozen) balance"
          },
          "suspenseBalance": {
            "type": "string",
            "description": "Suspense balance"
          },
          "orderBalance": {
            "type": "string",
            "description": "Order locked balance"
          },
          "creditBalance": {
            "type": "string",
            "description": "Credit balance"
          },
          "pendingWithdrawalBalance": {
            "type": "string",
            "description": "Pending withdrawal balance"
          },
          "collateralBalance": {
            "type": "string",
            "description": "Collateral balance"
          },
          "brokerageBalance": {
            "type": "string",
            "description": "Brokerage balance"
          },
          "unprocessedDeposit": {
            "type": "string",
            "description": "Unprocessed deposit amount"
          },
          "unprocessedWithdrawal": {
            "type": "string",
            "description": "Unprocessed withdrawal amount"
          },
          "unsettledBuy": {
            "type": "string",
            "description": "Unsettled buy amount"
          },
          "unsettledSell": {
            "type": "string",
            "description": "Unsettled sell amount"
          },
          "unconfirmed": {
            "type": "string",
            "description": "Unconfirmed balance"
          },
          "leverageBalance": {
            "type": "string",
            "description": "Leverage balance"
          },
          "marginTradingBalance": {
            "type": "string",
            "description": "Margin trading balance"
          },
          "custody": {
            "type": "string",
            "description": "Custody balance"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Error name"
              },
              "message": {
                "type": "string",
                "description": "Error description"
              }
            }
          }
        }
      }
    }
  }
}
```