optimations
This commit is contained in:
@@ -26,12 +26,12 @@ function get_asset {
|
||||
|
||||
for f_price in $(tail -n 50 "${f_ASSET_HIST_FILE}" | grep "^[0-9]" | cut -d, -f2)
|
||||
do
|
||||
if [ "$f_last_price" == "$f_price" ]
|
||||
if [ "${f_last_price}" == "${f_price}" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
let "f_linecount+=1"
|
||||
f_last_price=$f_price
|
||||
f_last_price=${f_price}
|
||||
done
|
||||
|
||||
if [ ${f_linecount} -le 3 ] && [ ${f_lines} -ge 50 ]
|
||||
@@ -102,10 +102,15 @@ function get_asset {
|
||||
do
|
||||
local f_calcema=$(echo ${f_calcemanumcolumn} | cut -d: -f1)
|
||||
local f_caclemacolumn=$(echo ${f_calcemanumcolumn} | cut -d: -f2)
|
||||
get_ema "${f_ASSET_HIST_FILE}" 2 ${f_calcema} "$(tail -n2 "${f_ASSET_HIST_FILE}" | head -n1 | grep ^2 | cut -d, -f${f_caclemacolumn})" "${f_price}"
|
||||
local f_last_ema="$(tail -n2 "${f_ASSET_HIST_FILE}" | head -n1 | grep "^[0-9]" | cut -d, -f${f_caclemacolumn})"
|
||||
if [ -z "${f_last_ema}" ] || [ -z "${f_price}" ]
|
||||
then
|
||||
get_ema "${f_ASSET_HIST_FILE}" 2 ${f_calcema}
|
||||
else
|
||||
get_ema "${f_ASSET_HIST_FILE}" 2 ${f_calcema} "${f_last_ema}" "${f_price}"
|
||||
fi
|
||||
if [ -z "${f_ema}" ]
|
||||
then
|
||||
g_echo_note "${FUNCNAME} $@: Not enough data for calculating EMA - waiting for more values"
|
||||
echo -n "," >>"${f_ASSET_HIST_FILE}"
|
||||
else
|
||||
echo -n ",${f_ema}" >>"${f_ASSET_HIST_FILE}"
|
||||
|
||||
Reference in New Issue
Block a user