Skip to main content

Get quarterly financial reports

Method name: get_financial_statement

Enter parameters

is_latest selection rules (actual test in production environment)

The granularity of is_latest is each stock, not “each financial period for each stock”:
  • is_latest=True: Suitable for querying a single-period snapshot of “the latest financial report disclosed by each stock as of a certain date”. Even if the quarterly range contains Multiple fiscal periods, often ending up with only one row per stock.
  • is_latest=False: Suitable for year-on-year revenue, month-on-month, multi-period trends, historical sections, dynamic coupon pools and backtesting. After returning the data, still press (symbol, fy_period) selects the version with the latest announcement date, and cannot directly use all lines that may have duplicate disclosures.
  • date=<cross-section or rebalance date> must be passed in both historical research and backtesting modes. Omitting date will use the latest disclosure in the current dataset, Financial reports after the backtest date may be brought into the strategy, causing future data leakage.
2026-07-25 Used date="20250101" and 2023q1~2024q4 at the production computing power node to verify the Hong Kong and US stocks: After omitting date in the same test, the US stock market returned the record with the announcement date of 20260225/20260609, and the Hong Kong stock market returned Records of 20260526/20260601. If the strategy is backtested in 2025, these records will not be visible at that time and are therefore prohibited from being used for historical decision-making.

Full parameter production testing experience

2026-07-25 All parameters were verified one by one on the production computing power node. The usage experience is as follows: Silent ignoring of fields is particularly dangerous. For example, requesting fields=["not_a_real_field"] did not report an error, but only returned the automatically supplemented symbol, fy_period, date. Therefore the Agent must perform a required_fields <= set(df.columns) check before calculation.

Dynamic timing rules for one-year backtesting

Financial reports are generally disclosed on a quarterly basis, but different companies have different announcement dates. If fundamentals determine stock qualification, the one-year backtest must be repeated on each rebalancing date. Calculate point-in-time financial factors; the qualified bond pool at the starting point of the backtest cannot be fixed for one year. Production testing results in: This is not a future data problem, but a static coupon pool using expired fundamentals. The correct dynamic process is:
  1. To obtain the multi-period financial reports required for the entire backtest, use is_latest=False, and use the end date of the backtest as the maximum interface date.
  2. First screen announcement date <= rebalance date on each position rebalancing day.
  3. Press (symbol, fy_period) to keep the version with the latest announcement date in the visible subset.
  4. Select the latest financial period visible at that time according to the company’s financial period, match the same financial period of the previous year and calculate the factor.
  5. Form a panel containing date, symbol, fy_period, source_date, each factor, and eligible.
  6. Only the latest section of panel.date <= context.now is read during transactions; if there is a new announcement, it will be updated on the next rebalancing day, if not, the old value will be used.
The order cannot be changed to “first deduplicate all the data on the end date of the backtest, and then filter by the rebalancing date”, otherwise the subsequent restatement version may cover the earlier visible data at that time. version. Each section must verify max(source_date) <= rebalance_date.

Response parameters

Response parameters

The following are financial related fields cash flow statement (cfs) balance sheet(bs) Income statement(is)

Usage examples

Obtain the financial quarterly report of a certain stock in a certain quarter

Response Example

Get the latest financial quarterly report of a certain stock in a certain quarter and use fields

Response Example
The “latest” here means the largest row of 0700.HK in 20241014 and the previous announcement date. It does not return the respective latest version and therefore cannot be used directly for year-over-year calculations.

Historical cross-section and year-on-year calculation

Revenue, gross profit, and operating cash flow may only populate one of the compatible fields at different companies. Common candidates are:
  • Income: is_reported_revenue, is_revenue_business_total
  • Gross profit: is_reported_gross_profit, is_gross_profit
  • Operating cash flow: cfs_net_cf_operating, cfs_reported_cf_operating
After selecting the field, first use pd.to_numeric(..., errors="coerce") to convert, delete empty strings, NaN and plus or minus infinity; the income is year-on-year Revenue for the same fiscal period last year must be greater than 0. Fiscal periods should be matched by the actual suffix of the fy_period returned, do not assume that all markets only return quarterly format.

Constructing a dynamic financial panel without future data for one-year backtesting

The following demonstrates the key sequence of prefetching and slicing on a bin-by-bin basis. period_sort_key, previous_year_period and field cleaning can be reused Functions in the previous section:
calculate_financial_metrics should return cleaned revenue_growth, gross_margin, operating_cf and eligible. If the rebalancing frequency is every 5 trading days, the panel is also generated every 5 trading days; the financial values can remain unchanged between the two announcements, but the qualification The judgment must be updated on the next rebalancing day after the new announcement. Do not re-query the interface in handle_data for each bar. It should be done in the offline phase or Build and cache the panel once in initialize.