Account

Profit Analysis by Market

GEThttps://openapi.longbridge.com/v1/portfolio/profit-analysis/by-market

Authorization

Signed mode: every request is signed with your App Key/Secret. Header set:

NameTypeRequiredDescription
Authorizationstring · headerRequiredThe account Access Token from the OpenAPI dashboard — passed as the raw token (no Bearer prefix) and included in the signature calculation.
X-Api-Keystring · headerRequiredYour App Key.
X-Timestampstring · headerRequiredRequest timestamp in seconds (Unix epoch).
X-Api-Signaturestring · headerRequiredHMAC-SHA256 signature. Format: HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=.

Get P&L breakdown grouped by market (US, HK, CN, SG).

>_ CLI
longbridge profit-analysis --format json
longbridge profit-analysis --start 2026-01-01

Request

Query parameters

NameTypeRequiredDescription
start_datestringOptionalAnalysis start date in `YYYY-MM-DD` format
end_datestringOptionalAnalysis end date in `YYYY-MM-DD` format

Response

Response properties

NameTypeRequiredDescription
has_morebooleanOptionalWhether there are more pages
profitstringOptionalTotal profit/loss
stock_itemsobject[]OptionalP&L breakdown by stock
└ codestringOptionalStock code
└ marketstringOptionalMarket code
└ namestringOptionalStock name
└ profitstringOptionalProfit/loss for this stock

Response JSON example

{
  "code": 0,
  "message": "success",
  "data": {
    "has_more": false,
    "profit": "-16325.26",
    "stock_items": [
      {
        "code": "AAPL",
        "market": "US",
        "name": "Apple",
        "profit": "100.00"
      }
    ]
  }
}

Error code

See the Error Codes page for the full list of error codes.