fix
This commit is contained in:
parent
244667d11a
commit
62ad7ce2da
@ -37,6 +37,9 @@ function get_marketdata_coinmarketcap {
|
|||||||
# use EUR EURC stable coin fo EUR
|
# use EUR EURC stable coin fo EUR
|
||||||
f_item=${f_item//EUR-/EURC-}
|
f_item=${f_item//EUR-/EURC-}
|
||||||
|
|
||||||
|
# renamed cryptos
|
||||||
|
f_item=${f_item//RNDR-/RENDER-}
|
||||||
|
|
||||||
# remove -
|
# remove -
|
||||||
f_item=${f_item//-//}
|
f_item=${f_item//-//}
|
||||||
|
|
||||||
@ -65,6 +68,7 @@ function get_marketdata_coinmarketcap {
|
|||||||
|
|
||||||
local f_id
|
local f_id
|
||||||
f_id=$(egrep "^${f_item}," COINMARKETCAPIDS | head -n1 | cut -d, -f2)
|
f_id=$(egrep "^${f_item}," COINMARKETCAPIDS | head -n1 | cut -d, -f2)
|
||||||
|
[[ $f_item = EURC ]] && f_id=20641
|
||||||
if [ -z "$f_id" ]
|
if [ -z "$f_id" ]
|
||||||
then
|
then
|
||||||
g_echo_error "${FUNCNAME} $@: No CoinMarketCap ID for $f_item"
|
g_echo_error "${FUNCNAME} $@: No CoinMarketCap ID for $f_item"
|
||||||
@ -94,6 +98,7 @@ function get_marketdata_coinmarketcap {
|
|||||||
then
|
then
|
||||||
# Download data from coinmarketcap
|
# 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
|
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
|
||||||
|
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
|
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
|
else
|
||||||
g_echo_error "${FUNCNAME} $@: Timeframe $f_timeframe in CoinMarketCap not supported."
|
g_echo_error "${FUNCNAME} $@: Timeframe $f_timeframe in CoinMarketCap not supported."
|
||||||
|
@ -114,7 +114,7 @@ function get_ohlcv-candle {
|
|||||||
if [[ $f_asset =~ ^ECONOMY- ]]
|
if [[ $f_asset =~ ^ECONOMY- ]]
|
||||||
then
|
then
|
||||||
# economy from yahoo finance
|
# 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
|
then
|
||||||
if ! get_marketdata_yahoo "$f_symbol" "$f_asset" $f_timeframe
|
if ! get_marketdata_yahoo "$f_symbol" "$f_asset" $f_timeframe
|
||||||
then
|
then
|
||||||
@ -154,7 +154,7 @@ function get_ohlcv-candle {
|
|||||||
f_data=${f_data//],/+}
|
f_data=${f_data//],/+}
|
||||||
g_array $f_data f_data_ref +
|
g_array $f_data f_data_ref +
|
||||||
else
|
else
|
||||||
# from coinmarketcap
|
# from coinmarketcap/yahoo
|
||||||
g_array "$f_histfile_extdata" f_data_ref
|
g_array "$f_histfile_extdata" f_data_ref
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user