do minutely jobs - for alerts, sell conditions,...
This commit is contained in:
parent
c37518f0b1
commit
4519d4d4bc
@ -26,6 +26,7 @@ mkdir -p ${BASEPATH}/botdata/trade-histories
|
|||||||
cd ${BASEPATH}/botdata
|
cd ${BASEPATH}/botdata
|
||||||
|
|
||||||
touch firstloop
|
touch firstloop
|
||||||
|
export FULL_LOOP=1
|
||||||
|
|
||||||
# am I the bot (important for functions used by analyze.sh
|
# am I the bot (important for functions used by analyze.sh
|
||||||
echo $0 | grep -q "dabo-bot\.sh" && BOT=1
|
echo $0 | grep -q "dabo-bot\.sh" && BOT=1
|
||||||
@ -38,6 +39,7 @@ do
|
|||||||
touch -t ${csv_timestamp} "${csv_file}"
|
touch -t ${csv_timestamp} "${csv_file}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# run endless loop
|
# run endless loop
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
@ -46,8 +48,20 @@ do
|
|||||||
then
|
then
|
||||||
rm -f firstloop
|
rm -f firstloop
|
||||||
else
|
else
|
||||||
g_echo_note "NEXT LOOP - sleping until next full ${INTERVAL} seconds"
|
LOOP_INTERVAL=60 # 60s max free coinhecko API interval
|
||||||
sleep $((${INTERVAL} - $(date +%s) % ${INTERVAL}))
|
time_to_interval=$((${LOOP_INTERVAL} - $(date +%s) % ${LOOP_INTERVAL}))
|
||||||
|
g_echo_note "NEXT LOOP - sleeping ${time_to_interval} seconds until next full ${LOOP_INTERVAL} seconds"
|
||||||
|
sleep ${time_to_interval}
|
||||||
|
# Check for next general interval
|
||||||
|
time_to_full_interval=$((${INTERVAL} - $(date +%s) % ${INTERVAL}))
|
||||||
|
if [ ${time_to_full_interval} -le ${time_to_interval} ]
|
||||||
|
then
|
||||||
|
g_echo_note "NEXT FULL LOOP NOW - all ${INTERVAL} seconds"
|
||||||
|
FULL_LOOP=1
|
||||||
|
else
|
||||||
|
g_echo_note "NEXT FULL LOOP - ${INTERVAL} seconds in ${time_to_full_interval} seconds"
|
||||||
|
FULL_LOOP=0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# reload config
|
# reload config
|
||||||
@ -77,10 +91,16 @@ do
|
|||||||
TOKEN_INFO_CMD="bitpanda_get_token_info"
|
TOKEN_INFO_CMD="bitpanda_get_token_info"
|
||||||
TRADE_CMD='bitpanda-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""'
|
TRADE_CMD='bitpanda-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get coingecko data
|
||||||
|
get_coingecko_data
|
||||||
|
|
||||||
# Get current assets
|
# Get current assets
|
||||||
get_assets || continue
|
get_assets || continue
|
||||||
|
|
||||||
|
# stop here if no full loop
|
||||||
|
[ ${FULL_LOOP} == 0 ] && continue
|
||||||
|
|
||||||
# Get current balances
|
# Get current balances
|
||||||
get_balances || continue
|
get_balances || continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user