Compare commits
No commits in common. "655c3b403255a6172bc0e95c55342585317674d4" and "f69d75b1b73061bc4cac54bf6bd1244eae1f1f7b" have entirely different histories.
655c3b4032
...
f69d75b1b7
@ -31,20 +31,16 @@ do
|
||||
# Reload Config
|
||||
. ../../dabo-bot.conf
|
||||
. ../../dabo-bot.override.conf
|
||||
# notify failed downloads
|
||||
[ "$interval" = "1d" ] && cat FAILED_*/* 2>/dev/null | notify.sh -s "Failed downloads"
|
||||
# notify failed yahoo downloads
|
||||
[ "$interval" = "1d" ] && cat FAILED_YAHOO/*USD_* FAILED_YAHOO/*ECONOMY* 2>/dev/null | notify.sh -s "Failed Yahoo downloads"
|
||||
# Timestamp
|
||||
export f_timestamp=$(g_date_print)
|
||||
# get candles and indicators
|
||||
get_ohlcv-candles $interval
|
||||
[ -n "$seconds" ] && sleeptime=$(( ( ($seconds - $(TZ=UTC printf "%(%s)T") % $seconds) % $seconds + 2 )))
|
||||
#[[ $interval = 4h ]] && sleeptime=??
|
||||
if [ "$interval" = "1d" ]
|
||||
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 ))
|
||||
[ "$interval" = "1d" ] && sleeptime=$(($(TZ=UTC date +%s -d "tomorrow 0:00") - $(date +%s) +2 ))
|
||||
[ "$interval" = "1w" ] && sleeptime=$(($(TZ=UTC date +%s -d "next monday 0:00") - $(date +%s) +2 ))
|
||||
g_echo_note "Waiting $sleeptime seconds until next run"
|
||||
sleep $sleeptime
|
||||
done
|
||||
|
@ -118,9 +118,6 @@ function get_marketdata_coinmarketcap {
|
||||
else
|
||||
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
|
||||
|
||||
# change exponential notation to normal notation
|
||||
g_num_exponential2normal_file "${f_targetcsv}"
|
||||
|
||||
}
|
||||
|
||||
@ -154,7 +151,7 @@ function get_marketdata_coinmarketcap_ids {
|
||||
f_latest_date_seconds=$(date -d "$f_latest_date" +%s)
|
||||
if [ $f_latest_date_seconds_now -lt $f_latest_date_seconds ]
|
||||
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
|
||||
done | egrep --line-buffered '^.+,[0-9]*,' >"$f_target_loop"
|
||||
|
||||
|
@ -54,9 +54,20 @@ function order {
|
||||
|
||||
### 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
|
||||
if [ -n "$LEVERAGE" ]
|
||||
if [ -n "$LEVERAGE" ]
|
||||
then
|
||||
# do some margin things
|
||||
|
||||
@ -72,37 +83,11 @@ function order {
|
||||
# define margibn mode isolated/cross
|
||||
f_params="${f_params}'marginMode': '$MARGIN_MODE', "
|
||||
|
||||
# calculate amount with leverage
|
||||
g_calc "${f_amount}*${LEVERAGE}"
|
||||
f_amount=$g_calc_result
|
||||
else
|
||||
# short/sell not possible in spot market
|
||||
[[ $f_side =~ ^sell$ ]] || return 1
|
||||
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
|
||||
if [ -n "$f_stoploss" ]
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user