adds fallback capability to market data providers

This commit is contained in:
hackerESQ
2024-09-13 20:20:19 -05:00
parent d59b8447d0
commit 2b8fe3c3c2
5 changed files with 172 additions and 17 deletions
+1 -8
View File
@@ -11,16 +11,9 @@ class AppServiceProvider extends ServiceProvider
*/
public function register(): void
{
if (!in_array(
$interface = config('investbrain.default', 'yahoo'),
array_keys(config('investbrain.interfaces', []))
)) {
throw new \Exception("Error: '$interface' is not a valid market data interface.");
}
$this->app->bind(
\App\Interfaces\MarketData\MarketDataInterface::class,
config("investbrain.interfaces.$interface")
\App\Interfaces\MarketData\FallbackInterface::class
);
}