DocsGuides
Adding a Market Provider
Extending t-server to pull in alternative financial market APIs.
When injecting a new data source into the system, strictly follow the provider abstraction structure.
- Create the Service File: Navigating to
src/market/providers/and establish a new class implementing theIMarketProviderinterface. - Wrap in Cache: Instantiate your class exclusively through the
CacheServicerather than calling it directly within an Express handler. - Error Propagation: The provider must trap its own HTTP 400/500 errors and map them to internal structural defaults. If an upstream source fails, it shouldn't crash the server.
typescriptexport class ExampleProvider { async fetchIndex() { try { const res = await fetch("..."); return await res.json(); } catch { return { _fallback: true, data: [] }; } } }