Compare commits
3 Commits
f69d75b1b7
...
655c3b4032
Author | SHA1 | Date | |
---|---|---|---|
655c3b4032 | |||
edfa828c2a | |||
c0a3e85888 |
@ -31,16 +31,20 @@ do
|
|||||||
# Reload Config
|
# Reload Config
|
||||||
. ../../dabo-bot.conf
|
. ../../dabo-bot.conf
|
||||||
. ../../dabo-bot.override.conf
|
. ../../dabo-bot.override.conf
|
||||||
# notify failed yahoo downloads
|
# notify failed downloads
|
||||||
[ "$interval" = "1d" ] && cat FAILED_YAHOO/*USD_* FAILED_YAHOO/*ECONOMY* 2>/dev/null | notify.sh -s "Failed Yahoo downloads"
|
[ "$interval" = "1d" ] && cat FAILED_*/* 2>/dev/null | notify.sh -s "Failed downloads"
|
||||||
# Timestamp
|
# Timestamp
|
||||||
export f_timestamp=$(g_date_print)
|
export f_timestamp=$(g_date_print)
|
||||||
# get candles and indicators
|
# get candles and indicators
|
||||||
get_ohlcv-candles $interval
|
get_ohlcv-candles $interval
|
||||||
[ -n "$seconds" ] && sleeptime=$(( ( ($seconds - $(TZ=UTC printf "%(%s)T") % $seconds) % $seconds + 2 )))
|
[ -n "$seconds" ] && sleeptime=$(( ( ($seconds - $(TZ=UTC printf "%(%s)T") % $seconds) % $seconds + 2 )))
|
||||||
#[[ $interval = 4h ]] && sleeptime=??
|
#[[ $interval = 4h ]] && sleeptime=??
|
||||||
[ "$interval" = "1d" ] && sleeptime=$(($(TZ=UTC date +%s -d "tomorrow 0:00") - $(date +%s) +2 ))
|
if [ "$interval" = "1d" ]
|
||||||
[ "$interval" = "1w" ] && sleeptime=$(($(TZ=UTC date +%s -d "next monday 0:00") - $(date +%s) +2 ))
|
then
|
||||||
|
get_marketdata_fear_and_greed_alternativeme
|
||||||
|
sleeptime=$(($(TZ=UTC date +%s -d "tomorrow 0:01") - $(date +%s) +2 ))
|
||||||
|
fi
|
||||||
|
[ "$interval" = "1w" ] && sleeptime=$(($(TZ=UTC date +%s -d "next monday 0:01") - $(date +%s) +2 ))
|
||||||
g_echo_note "Waiting $sleeptime seconds until next run"
|
g_echo_note "Waiting $sleeptime seconds until next run"
|
||||||
sleep $sleeptime
|
sleep $sleeptime
|
||||||
done
|
done
|
||||||
|
@ -119,6 +119,9 @@ function get_marketdata_coinmarketcap {
|
|||||||
egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" | sort -k1,2 -t, -u >"$f_targetcsv"
|
egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" | sort -k1,2 -t, -u >"$f_targetcsv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# change exponential notation to normal notation
|
||||||
|
g_num_exponential2normal_file "${f_targetcsv}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_marketdata_coinmarketcap_ids {
|
function get_marketdata_coinmarketcap_ids {
|
||||||
@ -151,7 +154,7 @@ function get_marketdata_coinmarketcap_ids {
|
|||||||
f_latest_date_seconds=$(date -d "$f_latest_date" +%s)
|
f_latest_date_seconds=$(date -d "$f_latest_date" +%s)
|
||||||
if [ $f_latest_date_seconds_now -lt $f_latest_date_seconds ]
|
if [ $f_latest_date_seconds_now -lt $f_latest_date_seconds ]
|
||||||
then
|
then
|
||||||
jq -r '.data | .symbol + "," + (.id|tostring) + "," + .name + "," + (.quotes[].quote|.marketCap|tostring)' "$g_tmp/get_marketdata_coinmarketcap_ids.json" | head -n 1
|
jq -r '.data | .symbol + "," + (.id|tostring) + "," + .name + "," + (.quotes[].quote|.marketCap|tostring)' "$g_tmp/get_marketdata_coinmarketcap_ids.json" | grep -vi ",0e-" | head -n 1
|
||||||
fi
|
fi
|
||||||
done | egrep --line-buffered '^.+,[0-9]*,' >"$f_target_loop"
|
done | egrep --line-buffered '^.+,[0-9]*,' >"$f_target_loop"
|
||||||
|
|
||||||
|
@ -54,17 +54,6 @@ function order {
|
|||||||
|
|
||||||
### validity checks end###
|
### validity checks end###
|
||||||
|
|
||||||
# get amount in crypto asset
|
|
||||||
if [[ $f_amount =~ ^crypto_amount: ]]
|
|
||||||
then
|
|
||||||
# if given in crypto
|
|
||||||
f_amount=${f_amount//crypto_amount:}
|
|
||||||
else
|
|
||||||
# if given in $CURRENCY
|
|
||||||
local f_asset=${f_symbol///*}
|
|
||||||
currency_converter $f_amount $CURRENCY $f_asset || return 1
|
|
||||||
local f_amount=$f_currency_converter_result
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check for swap/margin trades
|
# check for swap/margin trades
|
||||||
if [ -n "$LEVERAGE" ]
|
if [ -n "$LEVERAGE" ]
|
||||||
@ -83,11 +72,37 @@ function order {
|
|||||||
# define margibn mode isolated/cross
|
# define margibn mode isolated/cross
|
||||||
f_params="${f_params}'marginMode': '$MARGIN_MODE', "
|
f_params="${f_params}'marginMode': '$MARGIN_MODE', "
|
||||||
|
|
||||||
|
# calculate amount with leverage
|
||||||
|
g_calc "${f_amount}*${LEVERAGE}"
|
||||||
|
f_amount=$g_calc_result
|
||||||
else
|
else
|
||||||
# short/sell not possible in spot market
|
# short/sell not possible in spot market
|
||||||
[[ $f_side =~ ^sell$ ]] || return 1
|
[[ $f_side =~ ^sell$ ]] || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# get amount in crypto asset
|
||||||
|
if [[ $f_amount =~ ^crypto_amount: ]]
|
||||||
|
then
|
||||||
|
# if given in crypto
|
||||||
|
f_amount=${f_amount//crypto_amount:}
|
||||||
|
else
|
||||||
|
# on market order use current price
|
||||||
|
if [[ $f_type = market ]]
|
||||||
|
then
|
||||||
|
# if given in $CURRENCY
|
||||||
|
local f_asset=${f_symbol///*}
|
||||||
|
currency_converter $f_amount $CURRENCY $f_asset || return 1
|
||||||
|
f_amount=$f_currency_converter_result
|
||||||
|
# on limit order use limit price
|
||||||
|
elif [[ $f_type = limit ]]
|
||||||
|
then
|
||||||
|
g_calc "1/${f_price}*${f_amount}"
|
||||||
|
f_amount=$g_calc_result
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Add stoploos and take profit if available
|
# Add stoploos and take profit if available
|
||||||
if [ -n "$f_stoploss" ]
|
if [ -n "$f_stoploss" ]
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user