fix
This commit is contained in:
parent
244667d11a
commit
62ad7ce2da
@ -36,6 +36,9 @@ function get_marketdata_coinmarketcap {
|
||||
|
||||
# use EUR EURC stable coin fo EUR
|
||||
f_item=${f_item//EUR-/EURC-}
|
||||
|
||||
# renamed cryptos
|
||||
f_item=${f_item//RNDR-/RENDER-}
|
||||
|
||||
# remove -
|
||||
f_item=${f_item//-//}
|
||||
@ -65,6 +68,7 @@ function get_marketdata_coinmarketcap {
|
||||
|
||||
local f_id
|
||||
f_id=$(egrep "^${f_item}," COINMARKETCAPIDS | head -n1 | cut -d, -f2)
|
||||
[[ $f_item = EURC ]] && f_id=20641
|
||||
if [ -z "$f_id" ]
|
||||
then
|
||||
g_echo_error "${FUNCNAME} $@: No CoinMarketCap ID for $f_item"
|
||||
@ -94,7 +98,8 @@ function get_marketdata_coinmarketcap {
|
||||
then
|
||||
# Download data from coinmarketcap
|
||||
g_wget -O "${f_targetjsontmp}" "https://api.coinmarketcap.com/data-api/v3.1/cryptocurrency/historical?id=${f_id}&interval=${f_timeframe}" 2>"${f_targetjsontmp}".err
|
||||
jq -r '.data.quotes[] | .quote.timestamp[0:10] + "," + (.quote.open|tostring) + "," + (.quote.high|tostring) + "," + (.quote.low|tostring) + "," + (.quote.close|tostring) + "," + (.quote.volume|tostring)' "${f_targetjsontmp}" | egrep -v ',0$|,$' >"${f_targetcsvtmp}" 2>"${f_targetjsontmp}".err
|
||||
cp "${f_targetjsontmp}" /tmp/xxxx
|
||||
jq -r '.data.quotes[] | .quote.timestamp[0:10] + "," + (.quote.open|tostring) + "," + (.quote.high|tostring) + "," + (.quote.low|tostring) + "," + (.quote.close|tostring) + "," + (.quote.volume|tostring)' "${f_targetjsontmp}" | egrep -v ',0$|,$' >"${f_targetcsvtmp}" 2>"${f_targetjsontmp}".err
|
||||
else
|
||||
g_echo_error "${FUNCNAME} $@: Timeframe $f_timeframe in CoinMarketCap not supported."
|
||||
return 1
|
||||
|
@ -114,7 +114,7 @@ function get_ohlcv-candle {
|
||||
if [[ $f_asset =~ ^ECONOMY- ]]
|
||||
then
|
||||
# economy from yahoo finance
|
||||
if [ "$f_timeframe" = "1h" ] || [ "$f_timeframe" = "15m" ] || [ "$f_timeframe" = "15m" ]
|
||||
if [ "$f_timeframe" = "1h" ] || [ "$f_timeframe" = "15m" ] || [ "$f_timeframe" = "5m" ]
|
||||
then
|
||||
if ! get_marketdata_yahoo "$f_symbol" "$f_asset" $f_timeframe
|
||||
then
|
||||
@ -154,7 +154,7 @@ function get_ohlcv-candle {
|
||||
f_data=${f_data//],/+}
|
||||
g_array $f_data f_data_ref +
|
||||
else
|
||||
# from coinmarketcap
|
||||
# from coinmarketcap/yahoo
|
||||
g_array "$f_histfile_extdata" f_data_ref
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user