# 獲取區間漲跌幅

get_period_change_rank(market, period_type=None, sort_dir=None, count=10, offset=None, filter_list=None)

  • 介紹

    獲取區間漲跌幅排行,返回指定市場中按不同時間週期(5分鐘至250日/年初至今)的漲跌幅排行,支持豐富的篩選條件(市值、價格、PE、PB、換手率、量比、振幅等)。

  • 參數

    參數 類型 說明
    market Market 市場類型(HK/US)(必填)
    period_type RankPeriodType 排序週期,默認 5 分鐘
    sort_dir RankSortDir 排序方向,默認降序
    count int 返回數量 [1, 200],默認 10
    offset int 起始位置,默認 0
    filter_list list[PeriodChangeRankFilter] 篩選條件列表(多條件爲 AND 關係)
  • 輸入限制

    • filter_list 篩選條件(PeriodChangeRankFilter):

      構造參數 說明
      indicator_type 篩選因子類型(PeriodChangeIndicatorType,必填)
      interval_min 範圍最小值(閉區間)
      interval_max 範圍最大值(閉區間)
  • 返回

    參數 類型 說明
    ret RET_CODE 接口調用結果
    data pd.DataFrame 當 ret == RET_OK,返回 (all_count, DataFrame) 元組
    str 當 ret != RET_OK,返回錯誤描述
    • 數據格式如下:
      字段 類型 說明
      security str 股票代碼(如 'US.AAPL'
      name str 股票名稱
      cur_price float 最新價
      change_ratio float 今日漲跌幅(%)
      turnover float 成交額
      volume int 成交量
      market_cap float 市值
      change_rate_5min float 5分鐘漲跌幅(%)
      change_rate_5d float 5日漲跌幅(%)
      change_rate_10d float 10日漲跌幅(%)
      change_rate_20d float 20日漲跌幅(%)
      change_rate_60d float 60日漲跌幅(%)
      change_rate_120d float 120日漲跌幅(%)
      change_rate_250d float 250日漲跌幅(%)
      change_rate_ytd float 年初至今漲跌幅(%)
      pe_ttm float 市盈率 TTM
      pb float 市淨率
      turnover_ratio float 換手率(%)
      volume_ratio float 量比
      amplitude float 振幅(%)
  • Example

from futu import *

quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

ret, data = quote_ctx.get_period_change_rank(market=Market.US, count=2)
if ret == RET_OK:
    all_count, df = data
    print(f'總數據量: {all_count}')
    print(df)
else:
    print('error:', data)

quote_ctx.close()
1
2
3
4
5
6
7
8
9
10
11
12
13
  • Output
總數據量: 6429
  security                           name  cur_price  change_ratio  turnover  volume   market_cap  change_rate_5min  change_rate_5d  change_rate_10d  change_rate_20d  change_rate_60d  change_rate_120d  change_rate_250d  change_rate_ytd   pe_ttm       pb  turnover_ratio  volume_ratio  amplitude
0   US.JYD                         佳裕達物流       0.93        11.537  271197.0  311313   7717977.00             9.540           32.80           30.875           20.779          -68.150           -80.128           -90.610          -81.374 -0.40558  0.49892           5.220         0.732      20.94
1  US.RAIN  Rain Enhancement Technologies       2.23        19.892  112286.0   56451  18261097.59             9.313           -2.62            1.826           -6.302          -21.754           -71.914           -22.299          -61.815 -1.79838 -1.27283           2.812         0.816      27.15
1
2
3
4

接口限制

  • 30 秒內最多 60 次請求
  • 分頁請求僅首頁計入限頻統計