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:
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:
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
GBPUSDFX rates and create:A driver
GBPUSD Rate.Revenue variables that multiply foreign currency sales by
GBPUSD Rateto 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.
Related articles
Last updated