bash: lib_fetch: refactor 'symbol' as 'asset' or 'ticker'

Clarity through specificity.
This commit is contained in:
2024-06-17 21:27:49 -07:00
parent fcf7e3dd6b
commit c8fde5ad64

View File

@@ -53,7 +53,7 @@ function lib_fetch::__parse_args()
\e[32mUsage:\e[0m \e[32mUsage:\e[0m
$ $global_usage <<[all${global_arg_delim_2}<type1[{${global_arg_delim_3}type2${global_arg_delim_3}...}]>]> | <[price${global_arg_delim_2}<id${global_arg_delim_1}symbol[{${global_arg_delim_3}id${global_arg_delim_1}symbol${global_arg_delim_3}...}]>] | [account${global_arg_delim_2}<account1[{${global_arg_delim_3}account2${global_arg_delim_3}...}]>]>> [blockchain${global_arg_delim_2}<blockchain1[{${global_arg_delim_3}blockchain2${global_arg_delim_1}subaccount${global_arg_delim_3}...}]>] [year${global_arg_delim_2}<year|all>] $ $global_usage <<[all${global_arg_delim_2}<type1[{${global_arg_delim_3}type2${global_arg_delim_3}...}]>]> | <[price${global_arg_delim_2}<id${global_arg_delim_1}ticker[{${global_arg_delim_3}id${global_arg_delim_1}ticker${global_arg_delim_3}...}]>] | [account${global_arg_delim_2}<account1[{${global_arg_delim_3}account2${global_arg_delim_3}...}]>]>> [blockchain${global_arg_delim_2}<blockchain1[{${global_arg_delim_3}blockchain2${global_arg_delim_1}subaccount${global_arg_delim_3}...}]>] [year${global_arg_delim_2}<year|all>]
\e[32mArguments:\e[0m \e[32mArguments:\e[0m
@@ -63,7 +63,7 @@ function lib_fetch::__parse_args()
Asset values (see documentation): Asset values (see documentation):
price${global_arg_delim_2}<ticker symbol(s)> price${global_arg_delim_2}<asset1,asset2,...>
api${global_arg_delim_2}<mobula|coingecko> api${global_arg_delim_2}<mobula|coingecko>
@@ -450,7 +450,7 @@ function lib_fetch::__fetch_account()
# Set output dir for internally fetched files # Set output dir for internally fetched files
# #
# NOTE: # NOTE:
# - subaccount may include custom symbol list with format: # - subaccount may include custom ticker list with format:
# #
# subaccount/{CUR1,CUR2,CUR3,etc.} # subaccount/{CUR1,CUR2,CUR3,etc.}
# #
@@ -571,15 +571,15 @@ function lib_fetch::__fetch_price()
# Prepare given assets and filesystem layout # Prepare given assets and filesystem layout
# #
# Get symbols from configuration # Get assets from configuration
if [ -z "${global_arg_price[*]}" ]; then if [ -z "${global_arg_price[*]}" ]; then
# Parse out each symbol # Parse out each asset
while read _line; do while read _line; do
local _symbols+=("$_line") local _assets+=("$_line")
done < <(lib_fetch::__parse_yaml "get-values" "price.${global_arg_api}.asset") done < <(lib_fetch::__parse_yaml "get-values" "price.${global_arg_api}.asset")
else else
# Get symbols from CLI # Get assets from CLI
local _symbols=("${global_arg_price[*]}") local _assets=("${global_arg_price[*]}")
fi fi
# Set base dir for price files (subdirs will be by year) # Set base dir for price files (subdirs will be by year)
@@ -610,8 +610,8 @@ function lib_fetch::__fetch_price()
declare -x API_PRICES_KEY="$_api_key" declare -x API_PRICES_KEY="$_api_key"
lib_utils::print_debug "$API_PRICES_KEY" lib_utils::print_debug "$API_PRICES_KEY"
declare -x API_PRICES_SYMBOLS="${_symbols[*]}" declare -x API_PRICES_ASSETS="${_assets[*]}"
lib_utils::print_debug "$API_PRICES_SYMBOLS" lib_utils::print_debug "$API_PRICES_ASSETS"
lib_fetch::__fetch_exec "prices" "crypto" lib_fetch::__fetch_exec "prices" "crypto"