# 查詢最大可買可賣

acctradinginfo_query(order_type, code, price, order_id=None, adjust_limit=0, trd_env=TrdEnv.REAL, acc_id=0, acc_index=0, session=Session.NONE, jp_acc_type=SubAccType.JP_GENERAL, position_id=NONE)

  • 介紹

    查詢指定交易業務帳戶下的最大可買賣數量,亦可查詢指定交易業務帳戶下指定訂單的最大可改成的數量。

    現金帳戶請求期權不適用。

  • 參數

    參數 類型 說明
    order_type OrderType 訂單類型
    code str 證券代碼
    price float 報價
    order_id str 訂單號
    adjust_limit float 價格微調幅度
    trd_env TrdEnv 交易環境
    acc_id int 交易業務帳戶 ID
    acc_index int 交易業務帳戶列表中的帳戶序號
    session Session 美股交易時段
    jp_acc_type SubAccType 日本帳戶類型
    position_id int 持倉ID
  • 回傳

    參數 類型 說明
    ret RET_CODE 介面執行結果
    data pd.DataFrame 當 ret == RET_OK 時,回傳賬號列表
    str 當 ret != RET_OK 時,回傳錯誤描述
    • 賬號列表格式如下:
      欄位 類型 說明
      max_cash_buy float 現金可買
      max_cash_and_margin_buy float 最大可買
      max_position_sell float 持倉可賣
      max_sell_short float 可賣空
      max_buy_back float 平倉需買入
      long_required_im float 買 1 張合約所帶來的初始保證金變動
      short_required_im float 賣 1 張合約所帶來的初始保證金變動
      session Session 交易訂單時段(僅用於美股)
  • Example

from futu import *
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret, data = trd_ctx.acctradinginfo_query(order_type=OrderType.NORMAL, code='HK.00700', price=400)
if ret == RET_OK:
    print(data)
    print(data['max_cash_and_margin_buy'][0])  # 最大融資可買數量
else:
    print('acctradinginfo_query error: ', data)
trd_ctx.close()  # 關閉當條連接
1
2
3
4
5
6
7
8
9
  • Output
    max_cash_buy  max_cash_and_margin_buy  max_position_sell  max_sell_short  max_buy_back long_required_im short_required_im    session
0           0.0                   1500.0                0.0             0.0           0.0              N/A               N/A             N/A
1500.0
1
2
3

介面限制

  • 同一帳戶ID(acc_id) 每 30 秒內最多請求 10 次查詢最大可買可賣介面

提示

  • 現金業務帳戶不支援交易衍生品,因此不支援通過現金業務帳戶查詢期權的最大可買可賣。