Mapping API Data Into Variables

This article explains how to turn raw series imported from Google Finance, Yahoo style or similar APIs into usable variables and drivers inside a Model Reef model.

You will learn:

  • How API series are stored in the Data Library.

  • How to reference them in variables and formulas.

  • Patterns for using them as drivers instead of direct P&L lines.


How API data is stored

When you import data from Google Finance or a similar API:

  • Each requested symbol and field becomes a Data Library entry.

  • The entry contains a time series of values with dates and selected frequency (daily, weekly, monthly).

  • Metadata or tags indicate that the source is an API based feed.

These entries are conceptually similar to imported CSV series or Xero sourced series, but they are typically used as drivers rather than as accounting lines.


Mapping API series to drivers

A common pattern is to treat API series as drivers or modifier drivers, for example:

  • FX rate series used to translate foreign currency revenue or costs into the model currency.

  • Commodity price series used as input into pricing, margin or cost formulas.

  • Index levels used as macro drivers for regression based forecasts.

To implement this pattern, follow these steps:

1

Keep the API series as a driver entry

  1. Import the symbol/field into the Data Library.

  2. Mark the Data Library entry with type "Driver" or "Modifier".

2

Reference the series in formulas

Use the driver in variable formulas. Examples:

  • Revenue = Units * Price * FXRate

  • Cost = BaseCost * CommodityIndex

3

Use drivers, not accounting lines

Keep the API series as drivers so they do not appear directly as P&L or Balance Sheet lines; instead let variables and formulas generate the accounting impact.


Creating variables that reference API series

You can create explicit variables whose behaviour depends on API data. Examples:

  • A variable representing "FX Adjustment" as a function of an FX rate series.

  • A variable representing "Market Linked Fee Income" based on an index level.

  • A variable representing "Performance Fee" based on fund returns vs a benchmark.

To create such variables, follow these steps:

1

Create the variable

  1. Create a new variable with the appropriate type and category.

  2. Choose a meaningful name (e.g., "FX Adjustment", "Market Linked Fee Income").

2

Define the formula

  1. Reference one or more API-backed Data Library entries in the variable formula.

  2. Use expressions such as multipliers, thresholds, or regressions based on the driver(s).

3

Configure timing and recognition

  1. Configure timing and delays if there is a difference between accrual and cash recognition.

  2. Ensure the variable's type/category will route amounts to P&L, Balance Sheet and Cashflow as intended.

The variable will then contribute to P&L, Balance Sheet and Cashflow in line with its type.


Choosing types and categories

Because API series are external drivers, you will usually map dependent variables as:

  • Revenue or COGS when the driver affects sales or direct costs.

  • Opex or Staff when the driver affects operating expenses.

  • Asset or Liability when the driver affects mark to market values or indexed obligations.

  • Modifier only when the variable is intended to stay as a pure driver with no direct statement impact.

The key is to separate:

  • The driver itself (API series in the Data Library).

  • The economic effect (variables typed and categorised to reflect accounting impact).


Examples

Some concrete examples:

  • Import GBPUSD FX rates and create:

    • A driver GBPUSD Rate.

    • Revenue variables that multiply foreign currency sales by GBPUSD Rate to express them in model currency.

  • Import a commodity index and create:

    • A driver Input Commodity Index.

    • COGS variables that scale with this index over time.

  • Import an equity index and create:

    • A driver Market Index.

    • Performance fee variables that depend on whether a fund's return exceeds this index.


Last updated