marketflows.config
Configuration loading and validation.
Parses TOML settings into dataclasses, applies defaults, and enforces basic sanity/consistency checks for providers, analysis, and plotting.
Functions
|
|
|
Load and validate the config file. |
Classes
|
Create a dataclass to hold the configuration values for analysis. |
|
Create a dataclass to hold the configuration values for plots. |
|
Create a dataclass to hold the configuration values for the providers. |
- class marketflows.config.AnalysisConfig(provider_config, smoothing_ema, is_unit_normalize, diff_orders=<factory>, ema_periods=<factory>)
Bases:
objectCreate a dataclass to hold the configuration values for analysis.
- provider_config
provider config
- smoothing_ema
EMA period for smoothing growth and inflection data
- is_unit_normalize
will we be creating plots that are normalized at each time step?
- diff_orders
the orders of differentiation where 0 is no differentiation, 1 is the first derivative (growth), and 2 is the 2nd derivative (inflection)
- Type:
list[int]
- ema_periods
EMA periods
- class marketflows.config.PlotConfig(hours_ago)
Bases:
objectCreate a dataclass to hold the configuration values for plots.
- hours_ago
list of offsets for tables columns
- class marketflows.config.ProviderConfig(provider, days, flow_types, base_assets=<factory>, narratives=<factory>, range_lower_limits=<factory>, asset_groups=<factory>)
Bases:
objectCreate a dataclass to hold the configuration values for the providers.
- provider
name of provider. Leave as “” to read saved data from last run
- Type:
str
- days
the number of days we want to collect data for
- Type:
int
- flow_types
the list of flow types we want to collect data for
- Type:
list[FlowType]
- base_assets
assets used as base currency (e.g. EUR, JPY, etc.). These must be in decreasing MC order.
- Type:
list[str]
- narratives
list of narratives to be graphed
- Type:
list[str]
- range_lower_limits
the lower limits of each of the market cap ranges
- Type:
list[float]
- asset_groups
groups of assets as would be the case for multiple portfolios containing (often) different assets
- Type:
dict[str, set[str]]
Examples
>>> ProviderConfig(provider="td-ameritrade", days=10, flow_types=["narratives"], narratives=["ai"]) ProviderConfig(provider='td-ameritrade', days=10, flow_types=['narratives'], base_assets=['us-dollar'], narratives=['ai'], range_lower_limits=[], asset_groups={})
- marketflows.config.load_and_validate_config(config_file)
Load and validate the config file.
This does deep merge (i.e. it will descend into each nested item and only replace matching keys.
- Return type:
tuple[ProviderConfig,AnalysisConfig,PlotConfig]