API Documentation

Below please find the documentation for the public classes and functions of fooltrader.

finance

quote

fooltrader.api.technical.get_kdata(security_item, exchange=None, the_date=None, start_date=None, end_date=None, fuquan='bfq', source=None, level='day', generate_id=False)[source]

get kdata.

Parameters:
  • security_item (SecurityItem or str) – the security item,id or code
  • exchange (str) – the exchange,set this for cryptocurrency
  • the_date (TimeStamp str or TimeStamp) – get the kdata for the exact date
  • start_date (TimeStamp str or TimeStamp) – start date
  • end_date (TimeStamp str or TimeStamp) – end date
  • fuquan (str) – {“qfq”,”hfq”,”bfq”},default:”bfq”
  • source (str) – the data source,{‘163’,’sina’,’exchange’},just used for internal merge
  • level (str or int) – the kdata level,{1,5,15,30,60,’day’,’week’,’month’},default : ‘day’
Returns:

Return type:

DataFrame

fooltrader.api.technical.get_security_list(security_type='stock', exchanges=None, start_code=None, end_code=None, mode='simple', start_list_date=None, codes=None)[source]

get security list.

Parameters:
  • security_type (str) – {‘stock’, ‘future’},default: stock
  • exchanges (str or list) – [‘sh’, ‘sz’,’nasdaq’,’nyse’,’amex’,’shfe’,’dce’,’zce’],default: [‘sh’,’sz’]
  • start_code (str) – the start code,work with end,default:None if using codes,it would be ignored
  • end_code (str) – the end code,works with start,default:None if using codes,it would be ignored
  • mode (str) – whether parse more security info,{‘simple’,’es’},default:’simple’
  • start_list_date (Timestamp str or Timestamp) – the filter for start list date,default:None
  • codes (list) – the exact codes to query,default:None
Returns:

the security list

Return type:

DataFrame

fooltrader.api.technical.get_ticks(security_item, the_date=None, start_date=None, end_date=None)[source]

get the ticks.

Parameters:
  • security_item (SecurityItem or str) – the security item,id or code
  • the_date (TimeStamp str or TimeStamp) – get the tick for the exact date
  • start_date (TimeStamp str or TimeStamp) – start date
  • end_date (TimeStamp str or TimeStamp) – end date
Yields:

DataFrame

event

fooltrader.api.event.get_event(security_item, event_type='finance_forecast', start_date=None, end_date=None, index='timestamp')[source]

get forecast items.

Parameters:
  • security_item (SecurityItem or str) – the security item,id or code
  • event_type (str) – {‘finance_forecast’,’finance_report’}
  • start_date (Timestamp str or Timestamp) – the start date for the event
  • end_date (Timestamp str or Timestamp) – the end date for the event
Returns:

Return type:

DataFrame