帳戶

盈虧分析匯總

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

鑑權

簽名方式:每個請求用 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=。

獲取賬戶盈虧匯總,包含總資產、總盈虧和收益率指標。

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

請求

查詢參數

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

響應

響應欄位

名稱類型必填說明
updated_atstring可選最後更新時間戳
sum_profitstring可選總盈虧
sum_profit_ratestring可選總盈虧率
profitsobject可選按類型分解的盈虧
└ stockstring可選股票基本信息
└ fundstring可選資金標誌/金額。
└ mmfstring可選維持保證金系數。
└ otherstring可選其他值/數量。
└ summary_infoobject[]可選摘要信息。
└ ∟ profit_maxstring可選最大盈利金額。
└ ∟ loss_maxstring可選最大虧損金額。
└ ∟ profit_max_namestring可選最大盈利標的名稱。
└ ∟ loss_max_namestring可選最大虧損標的名稱。
└ ∟ asset_typestring可選本組的元素類型(持倉 / 地區 / 資產類別 / 行業)
└ ipo_subscriptioninteger可選IPO 認購次數。
└ ipo_hitinteger可選IPO 中籤次數。
└ cumulative_transaction_amountstring可選累計成交額。
└ cryptostring可選加密貨幣標誌。
└ trade_order_numstring可選交易訂單數。
└ trade_stock_numstring可選交易標的數。
is_tradedboolean可選是否有交易紀錄
currencystring可選貨幣
total_simple_earning_yieldstring可選總簡單收益率。
total_time_earning_yieldstring可選總時間加權收益率。
invest_amountstring可選總投入金額
initial_asset_valuestring可選初始資產價值
ending_asset_valuestring可選期末資產價值
current_total_assetstring可選當前總資產
start_timestring可選統計開始時間戳
end_timestring可選統計結束時間戳
trade_update_timestring可選交易數據更新時間。
updated_datestring可選最後更新日期
start_datestring可選統計開始日期
end_datestring可選統計結束日期
trade_update_datestring可選交易數據更新日期。
trade_stock_numstring可選交易標的數。

響應 JSON 示例

{
  "code": 0,
  "message": "success",
  "data": {
    "summary": {
      "currency": "USD",
      "sum_profit": "62905.97",
      "sum_profit_rate": "0.6128",
      "invest_amount": "102659.74",
      "current_total_asset": "165565.71",
      "initial_asset_value": "0.00",
      "ending_asset_value": "165565.71",
      "is_traded": true,
      "start_date": "2025-10-17",
      "start_time": "1760659200",
      "end_date": "2026-05-14",
      "end_time": "1778731947",
      "profits": {
        "stock": "66370.84",
        "crypto": "0",
        "fund": null,
        "ipo": null,
        "mmf": null,
        "other": null,
        "cumulative_transaction_amount": "1244920.28"
      }
    },
    "sublist": {
      "start": "2025-10-17",
      "start_date": "2025-10-17",
      "end": "2026-05-14",
      "end_date": "2026-05-14",
      "updated_at": "1778731947",
      "updated_date": "2026-05-14",
      "items": [
        {
          "symbol": "AAPL.US",
          "name": "Apple",
          "market": "US",
          "currency": "USD",
          "profit": "100.00",
          "profit_rate": "0.05",
          "holding_period": "180",
          "clearance_times": 0,
          "is_holding": true,
          "item_type": "Stock",
          "isin": "",
          "security_code": "AAPL",
          "underlying_profit": "100.00",
          "derivatives_profit": "0.00",
          "order_profit": null
        }
      ]
    }
  }
}

錯誤碼

參見錯誤碼文檔。