php: fetch: prices: new functionality / refactor
- Add support for multiple aggregator APIs - Refactor `prices` API implementation - Update documentation
This commit is contained in:
@@ -63,7 +63,9 @@ namespace docker_finance
|
||||
$env->set_env('API_OUT_DIR', getenv('API_OUT_DIR') . '/'); // API output path (account's 1-in dir)
|
||||
|
||||
// Prices
|
||||
$env->set_env('API_PRICES_PATH', getenv('API_PRICES_PATH')); // Master file
|
||||
$env->set_env('API_PRICES_PATH', getenv('API_PRICES_PATH')); // Master price file
|
||||
$env->set_env('API_PRICES_API', getenv('API_PRICES_API')); // Price API to use
|
||||
$env->set_env('API_PRICES_KEY', getenv('API_PRICES_KEY')); // Price API key
|
||||
$env->set_env('API_PRICES_SYMBOLS', getenv('API_PRICES_SYMBOLS')); // User-provided symbols
|
||||
|
||||
// Exchanges
|
||||
@@ -104,11 +106,11 @@ namespace docker_finance
|
||||
}
|
||||
break;
|
||||
case 'prices':
|
||||
switch ($env->get_env('API_FETCH_SUBTYPE')) {
|
||||
switch ($subtype) {
|
||||
case 'crypto':
|
||||
// TODO: `case 'legacy'` (stocks and bonds and ETFs, oh my!)
|
||||
$api = new prices\Fetch($env);
|
||||
break;
|
||||
// TODO: stocks and bonds and ETFs, oh my!
|
||||
default:
|
||||
utils\CLI::throw_fatal("unsupported subtype '$subtype' for interal API");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user