帳戶

按市場盈虧分析

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

鑑權

簽名方式:每個請求用 App Key / Secret 簽名。請求頭如下:

名稱類型必填說明
Authorizationstring · header必填OpenAPI 後台 上的賬戶 Access Token,作為原始 token 傳入(不帶 Bearer 前綴),並參與簽名計算。
X-Api-Keystring · header必填你的 App Key。
X-Timestampstring · header必填請求時間戳,單位秒(Unix 時間)。
X-Api-Signaturestring · header必填HMAC-SHA256 簽名。格式:HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=。

獲取按市場分組的盈虧分析(美股、港股、A 股、新加坡股)。

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

請求

查詢參數

名稱類型必填說明
start_datestring可選分析開始日期,格式 `YYYY-MM-DD`
end_datestring可選分析結束日期,格式 `YYYY-MM-DD`

響應

響應欄位

名稱類型必填說明
has_moreboolean可選是否有更多頁
profitstring可選總盈虧
stock_itemsobject[]可選按股票劃分的盈虧明細
└ codestring可選股票代碼
└ marketstring可選市場代碼
└ namestring可選股票名稱
└ profitstring可選該股票盈虧

響應 JSON 示例

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

錯誤碼

參見錯誤碼文檔。