Refactor config.toml to support multi-instruments per exchange - #44
Merged
Conversation
…hange>.instrument.<alias>] Move instrument-level fields (instrument, suffix_topic, max_level, max_level_pct) from [source.<exchange>] into a new [source.<exchange>.instrument.<alias>] sub-section. The <alias> key doubles as the fallback lookup key into [source.<exchange>.fallback.<alias>]. The alias field on SourceConfig is removed — it becomes the HashMap key instruments: HashMap<String, InstrumentConfig>. validated_sources() now flattens over all (exchange, instrument) pairs, producing one ValidatedSource per instrument. to_data_source() takes the alias and InstrumentConfig as parameters. Add InstrumentConfig struct, update SourceConfig, update all tests, migrate config.toml.example, update README and AGENTS.md. Adds ADR-014. Breaking change: existing config.toml files with instrument fields at the [source.<exchange>] level must be migrated to the new nested layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the config schema to support multiple instruments per exchange. Per-instrument fields (instrument, suffix_topic, max_level, max_level_pct) are moved from the flat
[source.<exchange>]section into a new[source.<exchange>.instrument.<alias>]sub-section. The<alias>key doubles as the fallback lookup key into[source.<exchange>.fallback.<alias>].Changes
InstrumentConfigstruct — holds instrument, suffix_topic, max_level, max_level_pctSourceConfig— removed instrument/alias/suffix_topic/max_level/max_level_pct; addedinstruments: HashMap<String, InstrumentConfig>keyed by aliasvalidated_sources()flattens — produces one ValidatedSource per instrument (sorted by exchange, then alias)to_data_source()signature — now acceptsalias: &strandinstrument_cfg: &InstrumentConfigFixes #43