# Get Adjustment Factor

get_rehab(code)

  • Description

    Get the stock adjustment factor

  • Parameters

    Parameter Type Description
    code str Stock code.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, data for adjustment is returned.
    str If ret != RET_OK, error description is returned.
    • Data for adjustment format as follows:

      Field Type Description
      ex_div_date str Ex-dividend date.
      split_base float Split numerator.
      split_ert float Split dominator.
      join_base float Joint numerator.
      join_ert float Joint dominator.
      split_ratio float Split ratio.
      per_cash_div float Dividend per share.
      bounce_base float Bounce numerator.
      bounce_ert float Bounce dominator.
      per_share_div_ratio float Bounce ratio.
      transfer_base float Conversion numerator.
      transfer_ert float Conversion dominator.
      per_share_trans_ratio float Conversion ratio.
      allot_base float Allotment numerator.
      allot_ert float Allotment dominator.
      allotment_ratio float Allotment ratio.
      allotment_price float Issuance price.
      add_base float Additional issuance numerator.
      add_ert float Additional issuance dominator.
      stk_spo_ratio float Additional issuance ratio.
      stk_spo_price float Additional issuance price.
      forward_adj_factorA float Forward adjustment factor A.
      forward_adj_factorB float Forward adjustment factor B.
      backward_adj_factorA float Backward adjustment factor A.
      backward_adj_factorB float Backward adjustment factor B.

      Price after forward adjustment = price before forward adjustment * Forward adjustment factor A + Forward adjustment factor B
      Price after backward adjustment = price before backward adjustment * Backward adjustment factor A + Backward adjustment factor B

  • Example

from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

ret, data = quote_ctx.get_rehab("HK.00700")
if ret == RET_OK:
    print(data)
    print(data['ex_div_date'][0]) # Take the first ex-dividend date
    print(data['ex_div_date'].values.tolist()) # Convert to list
else:
    print('error:', data)
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
1
2
3
4
5
6
7
8
9
10
11
  • Output
    ex_div_date  split_ratio  per_cash_div  per_share_div_ratio  per_share_trans_ratio  allotment_ratio  allotment_price  stk_spo_ratio  stk_spo_price  forward_adj_factorA  forward_adj_factorB  backward_adj_factorA  backward_adj_factorB
0   2005-04-19          NaN          0.07                  NaN                    NaN              NaN              NaN            NaN            NaN                  1.0                -0.07                   1.0                  0.07
..         ...          ...           ...                  ...                    ...              ...              ...            ...            ...                  ...                  ...                   ...                   ...
15  2019-05-17          NaN          1.00                  NaN                    NaN              NaN              NaN            NaN            NaN                  1.0                -1.00                   1.0                  1.00

[16 rows x 13 columns]
2005-04-19
['2005-04-19', '2006-05-15', '2007-05-09', '2008-05-06', '2009-05-06', '2010-05-05', '2011-05-03', '2012-05-18', '2013-05-20', '2014-05-15', '2014-05-16', '2015-05-15', '2016-05-20', '2017-05-19', '2018-05-18', '2019-05-17']
1
2
3
4
5
6
7
8

Interface Limitations

  • A maximum of 60 requests per 30 seconds