ccxt switch
This commit is contained in:
parent
c53b968b21
commit
ee0af1a21d
@ -8,7 +8,11 @@ function get_asset {
|
|||||||
|
|
||||||
[ -f "${f_ASSET_HIST_FILE}" ] || echo "Date and Time,Price" >"${f_ASSET_HIST_FILE}"
|
[ -f "${f_ASSET_HIST_FILE}" ] || echo "Date and Time,Price" >"${f_ASSET_HIST_FILE}"
|
||||||
|
|
||||||
local f_line="${f_timestamp},$(grep "^${f_ASSET}," CCXT_TICKERS | cut -d, -f2)"
|
#local f_line="${f_timestamp},$(grep "^${f_ASSET}," CCXT_TICKERS | cut -d, -f2)"
|
||||||
|
local f_price=$(grep "^${f_ASSET}," CCXT_TICKERS | cut -d, -f2)
|
||||||
|
# exponential number (9.881e-05) to normal
|
||||||
|
[[ $f_price =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?(e-[0-9]+)?$ ]] && printf -v f_price -- "%.10f" "$f_price"
|
||||||
|
local f_line="$f_timestamp,$f_price"
|
||||||
echo "${f_line}" >>${f_ASSET_HIST_FILE}
|
echo "${f_line}" >>${f_ASSET_HIST_FILE}
|
||||||
|
|
||||||
local f_linecount=0
|
local f_linecount=0
|
||||||
@ -31,7 +35,7 @@ function get_asset {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ${FULL_LOOP} == 0 ] && return 0
|
#[ ${FULL_LOOP} == 0 ] && return 0
|
||||||
grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}" || return 0
|
grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}" || return 0
|
||||||
f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv"
|
f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv"
|
||||||
#if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}"
|
#if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}"
|
||||||
@ -41,7 +45,7 @@ function get_asset {
|
|||||||
#fi
|
#fi
|
||||||
|
|
||||||
# headline
|
# headline
|
||||||
#[ -s "${f_ASSET_HIST_FILE}" ] || echo "${csv_headline}" >"${f_ASSET_HIST_FILE}"
|
[ -s "${f_ASSET_HIST_FILE}" ] || echo "${csv_headline}" >"${f_ASSET_HIST_FILE}"
|
||||||
if [ -s "${f_ASSET_HIST_FILE}" ]
|
if [ -s "${f_ASSET_HIST_FILE}" ]
|
||||||
then
|
then
|
||||||
sed -i -e 1c"$csv_headline" "${f_ASSET_HIST_FILE}"
|
sed -i -e 1c"$csv_headline" "${f_ASSET_HIST_FILE}"
|
||||||
|
Loading…
Reference in New Issue
Block a user