# Option Strategy Analysis

get_option_strategy_analysis(combo_leg_list)

  • Description

    Perform P/L analysis on custom or multi-leg option combos and return P/L curves and related analytics.

  • Parameters

    Parameter Type Description
    combo_leg_list list Combo leg list
  • Return

    Parameter Type Description
    ret RET_CODE API call result
    data pd.DataFrame When ret == RET_OK, returns option strategy analysis result
    str When ret != RET_OK, returns error description
    • DataFrame fields:

      Field Type Description
      code str Strategy identifier code
      name str Strategy name
      option_strategy str Option strategy type
      bid1 float Combo bid price
      ask1 float Combo ask price
      max_profit float Max profit
      max_loss float Max loss
      breakeven_points list Breakeven points
      prob_of_profit float Probability of profit
      delta float Delta
      theta float Theta
  • Example

from futu import *

quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_strategy(code='HK.00700', option_strategy=OptionStrategyType.STRADDLE)
if ret == RET_OK:
    index=0
    print(data['legs'][index])
    ret2,data2 = quote_ctx.get_option_strategy_analysis(data['legs'][index])
    if ret2 == RET_OK:
        print(data2)
    else:
        print("get_analysis,error:",data2)
else:
    print('error:', data)

quote_ctx.close() # Remember to close the connection to avoid exhausting connection quota
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  • Output
[OptionStrategyLeg(code=HK.TCH260522P330000, action=BUY, quantity=1.0), OptionStrategyLeg(code=HK.TCH260522C330000, action=BUY, quantity=1.0)]
              code     name option_strategy  bid1    ask1    max_profit  max_loss  breakeven_points  prob_of_profit     delta     theta
0  TCH260522C/P330  Tencent Straddle        STRADDLE   0.0  130.44  1.000000e+15  -13044.0  [199.56, 460.44]        0.315492  0.974369 -0.785757
1
2
3

API Restrictions

  • Does not consume option subscription quota.
  • Maximum 30 requests per 30 seconds.