Compare commits

..

No commits in common. "655c3b403255a6172bc0e95c55342585317674d4" and "f69d75b1b73061bc4cac54bf6bd1244eae1f1f7b" have entirely different histories.

3 changed files with 17 additions and 39 deletions

View File

@ -31,20 +31,16 @@ do
# Reload Config # Reload Config
. ../../dabo-bot.conf . ../../dabo-bot.conf
. ../../dabo-bot.override.conf . ../../dabo-bot.override.conf
# notify failed downloads # notify failed yahoo downloads
[ "$interval" = "1d" ] && cat FAILED_*/* 2>/dev/null | notify.sh -s "Failed downloads" [ "$interval" = "1d" ] && cat FAILED_YAHOO/*USD_* FAILED_YAHOO/*ECONOMY* 2>/dev/null | notify.sh -s "Failed Yahoo 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=??
if [ "$interval" = "1d" ] [ "$interval" = "1d" ] && sleeptime=$(($(TZ=UTC date +%s -d "tomorrow 0:00") - $(date +%s) +2 ))
then [ "$interval" = "1w" ] && sleeptime=$(($(TZ=UTC date +%s -d "next monday 0:00") - $(date +%s) +2 ))
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

View File

@ -119,9 +119,6 @@ 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 {
@ -154,7 +151,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" | grep -vi ",0e-" | head -n 1 jq -r '.data | .symbol + "," + (.id|tostring) + "," + .name + "," + (.quotes[].quote|.marketCap|tostring)' "$g_tmp/get_marketdata_coinmarketcap_ids.json" | head -n 1
fi fi
done | egrep --line-buffered '^.+,[0-9]*,' >"$f_target_loop" done | egrep --line-buffered '^.+,[0-9]*,' >"$f_target_loop"

View File

@ -54,6 +54,17 @@ 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" ]
@ -72,37 +83,11 @@ 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