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

Aperta
#1,312 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

問題概述

使用 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 模擬環境實際撮合」的支援差異。謝謝。

Lingua principale
TypeScript
Stelle
61
Fork
30
Merge medio
7h 45m
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di longbridge/developers

Tutte le issue di longbridge/developers

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.