AP 模擬帳戶:submit_multileg 提交 Put Credit Spread 後被拒絕,請確認組合單撮合支援範圍

未关闭
#1,312 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
活跃
技术栈
python, typescript

调研方向

Start with the linked submit_multileg documentation and Trade FAQ Q9, then trace the repository’s pages for multileg orders and paper trading. Clarify whether AP paper trading supports opening and closing US options spreads, document any required parameters or limitations, and explain how users can obtain a more specific rejection reason. The issue provides no repository file paths or failing tests, so first locate the relevant documentation source and review its contribution guidance.

由索引模型根据 Issue 内容生成。

描述

問題概述

使用 Python SDK 的 TradeContext.submit_multileg(),向 AP 模擬帳戶提交美股 Put Credit Spread。

兩次請求均成功取得訂單編號,order_detail() 亦能返回完整組合及正確的兩腿方向,但隨後訂單狀態均變成 Rejected,成交數量為 0,只有通用錯誤訊息:

Order failed, please try again later.

客服回覆無法查詢模擬帳戶的訂單記錄,因此希望開發團隊協助確認功能支援範圍及排查方式。

環境

  • 帳戶:AP 模擬帳戶
  • 系統:Ubuntu 24.10,x86_64,DigitalOcean Droplet
  • Python:3.12.7
  • Python SDK:longbridge 5.3.0
  • 認證:App Key、App Secret、模擬帳戶 Access Token
  • 建立 Config 時明確使用 enable_papertrading=True
  • 查詢帳戶資產、持倉、訂單及期權行情正常
  • 下單時間:美股正常交易時段
  • 測試前查詢沒有持倉或未完成訂單

第一次提交的組合

  • 標的:QQQ
  • 到期日:2026-11-06
  • 策略:VerticalPutSpread
  • 組合方向:Sell
  • 訂單類型:LO
  • 組合數量:1
  • 淨收入限價:0.17 USD/股
  • 買入:QQQ261106P706000.US,比例 1
  • 賣出:QQQ261106P707000.US,比例 1
  • 提交時間:約 2026-10-28 16:09:11 UTC

相關下單呼叫如下,已省略憑證:

from decimal import Decimal
from longbridge.openapi import (
    OrderSide, OrderType, MultiLegStrategy,
)

response = ctx.submit_multileg(
    side=OrderSide.Sell,
    order_type=OrderType.LO,
    submitted_quantity=Decimal("1"),
    strategy=MultiLegStrategy.VerticalPutSpread,
    legs=[
        ("QQQ261106P706000.US", Decimal("1")),
        ("QQQ261106P707000.US", Decimal("1")),
    ],
    submitted_price=Decimal("0.17"),
    client_request_id=unique_request_id,
    remark="paper-ab-B",
)

ctx 使用以下方式連接模擬環境:

config = Config.from_apikey(
    app_key,
    app_secret,
    paper_access_token,
    enable_papertrading=True,
    enable_print_quote_packages=False,
)
ctx = TradeContext(config)

實際回傳

提交後取得訂單編號,再查詢詳情:

symbol: QQQ.US
price: 0.17
side: OrderSide.Sell
status: OrderStatus.Rejected
order_type: OrderType.LO
quantity: 1
executed_quantity: 0
msg: Order failed, please try again later.

multi_leg 正確顯示:

strategy: VerticalPutSpread
multileg_id: Spread_QQQ20261106P706/707

QQQ261106P706000.US:
  side: Buy
  position: Long
  ratio_quantity: 1

QQQ261106P707000.US:
  side: Sell
  position: Short
  ratio_quantity: 1

訂單歷史只有一筆 Rejected 記錄,沒有更具體的錯誤原因。

第二次測試

約十分鐘後,重新搜尋及核價,以新的 client_request_id 提交另一組:

  • 賣出 QQQ261106P706000.US
  • 買入 QQQ261106P705000.US
  • 同一到期日
  • 組合數量 1
  • 淨收入限價 0.17
  • 提交時間:約 2026-10-28 16:19:17 UTC

同樣取得訂單編號,隨後變成 Rejected。

兩次均未成交。目前已暫停新的自動開倉,沒有改用逐腿下單。訂單編號可按需要透過官方私下渠道提供。

希望確認

  1. AP 模擬帳戶目前是否支援 /v1/trade/order/multileg 的美股期權組合開倉及撮合?是否支援組合平倉?
  2. VerticalPutSpread、side=Sell、低行使價 Put 在前、正比例腿數及正數淨收入限價的用法是否正確?
  3. 是否需要額外權限、特定訂單參數,或有尚未記載的模擬環境限制?
  4. 如何取得比「Order failed, please try again later.」更具體的拒單原因?是否有可提供的錯誤碼、追蹤識別碼或安全的診斷方式?
  5. 如果模擬組合單已受支援,可否提供一個可用於 AP 模擬帳戶的最小 Python 範例?

文件釐清

組合下單文件已列出相關介面:

https://open.longbridge.com/docs/trade/order/submit_multileg

但交易 FAQ Q9 仍有多腿期權處於規劃中的措辭,而模擬交易說明沒有明確列出組合單撮合是否支援:

https://open.longbridge.com/docs/qa/trade

希望可以釐清「API 接受並建立訂單」與「AP 模擬環境實際撮合」的支援差異。謝謝。

主要语言
TypeScript
星标
61
派生
30
平均合并
7 小时 45 分钟
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

longbridge/developers 的其他 Issue

查看 longbridge/developers 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。