Standardization
What Is The Standardization Framework?
The Standardization Framework is a set of tools and guidelines that enable the user to query and obtain data in a consistent way across multiple providers.
Each provider data model should inherit from an already defined standard model. All standard models are created and maintained by the OpenBB team.
If a standard model needs to be created, please open a pull request and detail its use.
Standardizing provider query parameters and response data enhances the user experience by overcoming things like:
- Consistent query parameters across all data sources for a function, or type of function.
- Output data that has conformed types, is validated, and will be JSON serializable.
NaN
,NaT
,"None"
, empty strings, are always returned asNoneType
(null).
- Transparently defined schemas for the data and query parameters.
- Outputs from multiple sources are comparable with each other and easily interchanged.
The standard models are all defined in the /OpenBBTerminal/openbb_platform/core/openbb_core/provider/standard_models/
directory.
What Is A Standard Model?
Every standard model consists of two classes, with each being a Pydantic model.
Any parameter or field can be assigned a custom field_validator
, or the entire model can be passed through a model_validator
on creation.
Caveats
The standardization framework is a very powerful tool, but it has some caveats that you should be aware of:
- We standardize fields and parameters that are shared between multiple providers.
- In some cases, it can be undesirable to define common items in the standard model. In this event, we still want consistent names and descriptions.
- When mapping the column names from a provider-specific model to the standard model, the CamelCase to snake_case conversion is done automatically. If the column names are not the same, you'll need to manually map them.
- e.g.,
__alias_dict__ = {"o": "open"}
- e.g.,
- The standard models are created and maintained by the OpenBB team. If you want to add or modify a field within a standard model, you'll need to open a PR to the OpenBB Platform.