fixes, levels, whitelist...
This commit is contained in:
parent
927102b2e9
commit
9fab344720
18
dabo/calc-levels.sh
Executable file
18
dabo/calc-levels.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /dabo/dabo-prep.sh
|
||||||
|
|
||||||
|
rm -f asset-histories/*.history.*.csv.levels-calculating
|
||||||
|
sleep 12
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
# Reload Config
|
||||||
|
. ../../dabo-bot.conf
|
||||||
|
. ../../dabo-bot.override.conf
|
||||||
|
# get levels
|
||||||
|
get_levels_all
|
||||||
|
rm -f asset-histories/*.history.*.csv.levels-calculating
|
||||||
|
sleep 900
|
||||||
|
done
|
||||||
|
|
@ -19,8 +19,8 @@ TRANSFER_CURRENCY="USD"
|
|||||||
# Only use currencies under the first X currencies sorted by market capitalization
|
# Only use currencies under the first X currencies sorted by market capitalization
|
||||||
LARGEST_MARKETCAP="250"
|
LARGEST_MARKETCAP="250"
|
||||||
|
|
||||||
# Blacklist Currencies
|
# symbols that should be traded
|
||||||
BLACKLIST="^USDT${CURRENCY}|^DAI${CURRENCY}|^BUSD${CURRENCY}|^USDC${CURRENCY}|^USDP${CURRENCY}|^TUSD${CURRENCY}|^USDD${CURRENCY}|^GUSD${CURRENCY}|^FEI${CURRENCY}|^USTC${CURRENCY}|^FRAX${CURRENCY}|^USDJ${CURRENCY}|^LUSD${CURRENCY}|^EURS${CURRENCY}|^TRIBE${CURRENCY}|^BNB${CURRENCY}|^FDUSD${CURRENCY}"
|
SYMBOLS="ETH SOL"
|
||||||
|
|
||||||
## Signal Group for Notifications
|
## Signal Group for Notifications
|
||||||
SIGNAL_GROUP="Krypto-Bot"
|
SIGNAL_GROUP="Krypto-Bot"
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
. /dabo/dabo-prep.sh
|
. /dabo/dabo-prep.sh
|
||||||
|
|
||||||
|
interval=$1
|
||||||
|
[ -z "$interval" ] && return 1
|
||||||
|
seconds=$2
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
# Reload Config
|
# Reload Config
|
||||||
@ -10,7 +14,12 @@ do
|
|||||||
# Timestamp
|
# Timestamp
|
||||||
export f_timestamp=$(g_date_print)
|
export f_timestamp=$(g_date_print)
|
||||||
# get orders
|
# get orders
|
||||||
get_ohlcv-candles
|
get_ohlcv-candles $interval
|
||||||
sleep 10
|
[ -n "$seconds" ] && sleeptime=$(( ( ($seconds - $(TZ=UTC printf "%(%s)T") % $seconds) % $seconds + 2 )))
|
||||||
|
#[[ $interval = 4h ]] &&
|
||||||
|
[ "$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
|
done
|
||||||
|
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
. /dabo/dabo-prep.sh
|
. /dabo/dabo-prep.sh
|
||||||
|
|
||||||
# Headline
|
|
||||||
export csv_headline="Date and Time,Price,Change,EMA12,EMA26,MACD,EMA9 (Sig.),Histogram,MACD Sig.,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Coingecko Change 24h,Coingecko Change 7d,Coingecko Change 14d,Coingecko Change 30d,Coingecko Change 1y,Coingecko MarketCap Change 24h,RANGE DATE,LOWEST IN RANGE,HIGHEST IN RANGE,PIVOT POINT,SUPPORT1,RESIST1,GOLDEN POCKET SUPPORT,GOLDEN POCKET RESIST,GOLDEN POCKET 65 SUPPORT,GOLDEN POCKET 65 RESIST,SUPPORT3,RESIST3,EMA50,EMA100,EMA200,EMA800,Coingecko Price"
|
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
# Reload Config
|
# Reload Config
|
||||||
@ -14,6 +11,6 @@ do
|
|||||||
export f_timestamp=$(g_date_print)
|
export f_timestamp=$(g_date_print)
|
||||||
# get assets
|
# get assets
|
||||||
get_symbols_ticker refetchonly || g_echo_warn "Error while refetching tickers from ${STOCK_EXCHANGE}"
|
get_symbols_ticker refetchonly || g_echo_warn "Error while refetching tickers from ${STOCK_EXCHANGE}"
|
||||||
sleep 2
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ function get_indicators_all {
|
|||||||
|
|
||||||
# find all hitory files
|
# find all hitory files
|
||||||
get_symbols_ticker
|
get_symbols_ticker
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||||
do
|
do
|
||||||
f_symbol=${f_symbol%%:*}
|
f_symbol=${f_symbol%%:*}
|
||||||
f_symbol=${f_symbol//\/}
|
f_symbol=${f_symbol//\/}
|
||||||
|
@ -3,30 +3,42 @@
|
|||||||
function get_levels_all {
|
function get_levels_all {
|
||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
local f_histfile f_level f_symbol
|
local f_levelsfile f_level f_symbol f_symbol_in_array f_price
|
||||||
|
|
||||||
get_symbols_ticker
|
get_symbols_ticker
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||||
do
|
do
|
||||||
f_symbol=${f_symbol%%:*}
|
f_symbol=${f_symbol%%:*}
|
||||||
f_symbol=${f_symbol//\/}
|
f_symbol=${f_symbol//\/}
|
||||||
|
|
||||||
for f_histfile in "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv"
|
# check for data files
|
||||||
|
for f_levelsfile in "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv"
|
||||||
do
|
do
|
||||||
[ -s "$f_histfile" ] || continue 2
|
[ -s "$f_levelsfile" ] || continue 2
|
||||||
done
|
done
|
||||||
f_histfile="asset-histories/${f_symbol}.history.csv"
|
|
||||||
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_histfile}.levels-calculating"
|
|
||||||
g_echo_note "Estimating relevant levels of $f_symbol"
|
|
||||||
mapfile -t f_prices < <(cut -d, -f3,4,5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" | sed 's/,/\n/g' | sort -rnu)
|
|
||||||
get_levels && printf '%(%Y-%m-%d %H:%M:%S)T'
|
|
||||||
rm -f "${f_histfile}.levels-calculating"
|
|
||||||
|
|
||||||
for f_level in "$g_levels[@]"
|
# define target file
|
||||||
|
f_levelsfile="asset-histories/${f_symbol}.history.csv"
|
||||||
|
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculating"
|
||||||
|
g_echo_note "Estimating relevant levels of $f_symbol"
|
||||||
|
|
||||||
|
# get current price to reduce the range, save cpu-power and time
|
||||||
|
f_symbol_in_array=${f_symbol/ /}
|
||||||
|
f_price=${f_tickers_array[$f_symbol_in_array]}
|
||||||
|
|
||||||
|
# get relevant data max 30000 (+-15000) prices from current price
|
||||||
|
mapfile -t f_prices < <((cut -d, -f3,4,5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C 15000 "^${f_price}$")
|
||||||
|
|
||||||
|
# calculate levels
|
||||||
|
get_levels && printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculated"
|
||||||
|
rm -f "${f_levelsfile}.levels-calculating"
|
||||||
|
|
||||||
|
# write new levels file
|
||||||
|
for f_level in "${f_levels[@]}"
|
||||||
do
|
do
|
||||||
echo $f_level
|
echo $f_level
|
||||||
done >"${f_histfile}.levels.new"
|
done >"${f_levelsfile}.levels.new"
|
||||||
mv "${f_histfile}.levels.new" "${f_histfile}.levels"
|
mv "${f_levelsfile}.levels.new" "${f_levelsfile}.levels"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,13 +46,13 @@ function get_levels_all {
|
|||||||
|
|
||||||
function get_levels {
|
function get_levels {
|
||||||
|
|
||||||
# estimates the relevant levels from price list from array f_prices and put then in arra f_levels
|
# estimates the relevant levels from price list from array f_prices and put then in array f_levels
|
||||||
# - needs array $f_prices with prices sorted from low to high and no duplicates (sort -nru) to analyze
|
# - needs array $f_prices with prices sorted from low to high and no duplicates (sort -nru) to analyze
|
||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
|
|
||||||
# if there is not enough or no price data
|
# if there is not enough or no price data
|
||||||
[ -z "$f_prices[100]" ] && return 1
|
[ -z "${f_prices[100]}" ] && return 1
|
||||||
|
|
||||||
# reset old levels var
|
# reset old levels var
|
||||||
unset f_levels
|
unset f_levels
|
||||||
@ -56,12 +68,15 @@ function get_levels {
|
|||||||
|
|
||||||
# calc threshold (avarage of percentual price difference)
|
# calc threshold (avarage of percentual price difference)
|
||||||
local f_price_range_percentage=${g_percentage_diff_result//-/}
|
local f_price_range_percentage=${g_percentage_diff_result//-/}
|
||||||
g_calc "$f_price_range_percentage / $f_number_of_prices"
|
g_calc "$f_price_range_percentage / $f_number_of_prices" || return 1
|
||||||
local f_threshold=$g_calc_result
|
local f_threshold=$g_calc_result
|
||||||
# calc threshold in range (1/100 of percentual range)
|
# calc threshold in range (1/100 of percentual range)
|
||||||
g_calc "$f_price_range_percentage / 100"
|
g_calc "$f_price_range_percentage / 100" || return 1
|
||||||
local f_threshold_in_range=$g_calc_result
|
local f_threshold_in_range=$g_calc_result
|
||||||
|
|
||||||
|
#echo "$f_threshold_in_range - $f_threshold - $f_price_range_percentage"
|
||||||
|
#return 0
|
||||||
|
|
||||||
# how much occurencies / same prices have so show up for a defined level - percentage from number of prices
|
# how much occurencies / same prices have so show up for a defined level - percentage from number of prices
|
||||||
local f_min_occurrences=3
|
local f_min_occurrences=3
|
||||||
|
|
||||||
@ -107,7 +122,7 @@ function get_levels {
|
|||||||
then
|
then
|
||||||
g_calc "($f_level_prices)/$f_level_count"
|
g_calc "($f_level_prices)/$f_level_count"
|
||||||
f_levels+=("$g_calc_result")
|
f_levels+=("$g_calc_result")
|
||||||
#echo "ending relevant level $g_calc_result after $f_level_count times"
|
g_echo_note "adding significant level at $g_calc_result after reaching $f_level_count times"
|
||||||
fi
|
fi
|
||||||
f_level_prices=""
|
f_level_prices=""
|
||||||
f_level_count=""
|
f_level_count=""
|
||||||
@ -117,5 +132,3 @@ function get_levels {
|
|||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ function get_ohlcv-candles {
|
|||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
|
|
||||||
local f_asset f_histfile f_histfile_week f_symbol f_timeframe
|
local f_asset f_histfile f_symbol f_timeframe
|
||||||
local f_timeframes="1w 1d 4h 1h 15m 5m"
|
local f_timeframes="1w 1d 4h 1h 15m 5m"
|
||||||
|
[ -n $1 ] && f_timeframes=$1
|
||||||
|
|
||||||
get_symbols_ticker
|
get_symbols_ticker
|
||||||
|
for f_symbol in BTC/$CURRENCY "${f_symbols_array_trade[@]}"
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
|
||||||
do
|
do
|
||||||
# fetch only single symbols (for debugging)
|
# fetch only single symbols (for debugging)
|
||||||
#[ "$f_symbol" = "BTC/USDT:USDT" ] || continue
|
#[ "$f_symbol" = "BTC/USDT:USDT" ] || continue
|
||||||
@ -17,7 +17,7 @@ function get_ohlcv-candles {
|
|||||||
f_asset="${f_symbol//:*}"
|
f_asset="${f_symbol//:*}"
|
||||||
f_asset="${f_asset///}"
|
f_asset="${f_asset///}"
|
||||||
f_histfile="asset-histories/$f_asset.history.$f_timeframe.csv"
|
f_histfile="asset-histories/$f_asset.history.$f_timeframe.csv"
|
||||||
f_histfile_week="asset-histories/$f_asset.history.1w.csv"
|
#f_histfile_week="asset-histories/$f_asset.history.1w.csv"
|
||||||
|
|
||||||
if [ -s "${f_histfile}.indicators-calculating" ]
|
if [ -s "${f_histfile}.indicators-calculating" ]
|
||||||
then
|
then
|
||||||
@ -27,7 +27,7 @@ function get_ohlcv-candles {
|
|||||||
|
|
||||||
# get data
|
# get data
|
||||||
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_histfile}.fetching"
|
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_histfile}.fetching"
|
||||||
get_ohlcv-candle "$f_symbol" $f_timeframe "${f_histfile}" "${f_histfile_week}" && printf '%(%Y-%m-%d %H:%M:%S)T' >>"$f_histfile.fetched"
|
get_ohlcv-candle "$f_symbol" $f_timeframe "${f_histfile}" && printf '%(%Y-%m-%d %H:%M:%S)T' >>"$f_histfile.fetched"
|
||||||
|
|
||||||
# refresh latest indicators
|
# refresh latest indicators
|
||||||
get_indicators "${f_histfile}" 801
|
get_indicators "${f_histfile}" 801
|
||||||
@ -45,7 +45,7 @@ function get_ohlcv-candle {
|
|||||||
local f_symbol="$1"
|
local f_symbol="$1"
|
||||||
local f_timeframe=$2
|
local f_timeframe=$2
|
||||||
local f_histfile="$3"
|
local f_histfile="$3"
|
||||||
local f_histfile_week="$4"
|
#local f_histfile_week="$4"
|
||||||
|
|
||||||
local f_yahoo f_date f_unit_date f_data f_data_array f_data_unit f_open f_high f_low f_close f_volume
|
local f_yahoo f_date f_unit_date f_data f_data_array f_data_unit f_open f_high f_low f_close f_volume
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ function get_ohlcv-candle {
|
|||||||
if [ -z "$f_yahoo" ]
|
if [ -z "$f_yahoo" ]
|
||||||
then
|
then
|
||||||
# find latest time which is not fetched already create f_since
|
# find latest time which is not fetched already create f_since
|
||||||
get_ohlcv-candle-latest "$f_symbol" "$f_histfile" "$f_histfile_week"
|
get_ohlcv-candle-latest "$f_symbol" "$f_histfile"
|
||||||
[ -z $f_since ] && break
|
[ -z $f_since ] && break
|
||||||
|
|
||||||
# from exchange
|
# from exchange
|
||||||
@ -106,16 +106,16 @@ function get_ohlcv-candle {
|
|||||||
|
|
||||||
# define field vars and convert exponential number (for example 9.881e-05) to "normal" notation
|
# define field vars and convert exponential number (for example 9.881e-05) to "normal" notation
|
||||||
f_open=${f_data_unit_ref[1]}
|
f_open=${f_data_unit_ref[1]}
|
||||||
g_num_exponential2normal "$f_open" && f_open=$f_g_num_exponential2normal_result
|
g_num_exponential2normal "$f_open" && f_open=$g_num_exponential2normal_result
|
||||||
f_high=${f_data_unit_ref[2]}
|
f_high=${f_data_unit_ref[2]}
|
||||||
g_num_exponential2normal "$f_high" && f_high=$f_g_num_exponential2normal_result
|
g_num_exponential2normal "$f_high" && f_high=$g_num_exponential2normal_result
|
||||||
f_low=${f_data_unit_ref[3]}
|
f_low=${f_data_unit_ref[3]}
|
||||||
g_num_exponential2normal "$f_low" && f_low=$f_g_num_exponential2normal_result
|
g_num_exponential2normal "$f_low" && f_low=$g_num_exponential2normal_result
|
||||||
f_close=${f_data_unit_ref[4]}
|
f_close=${f_data_unit_ref[4]}
|
||||||
g_num_exponential2normal "$f_close" && f_close=$f_g_num_exponential2normal_result
|
g_num_exponential2normal "$f_close" && f_close=$g_num_exponential2normal_result
|
||||||
f_volume=${f_data_unit_ref[5]}
|
f_volume=${f_data_unit_ref[5]}
|
||||||
[ -n "$f_yahoo" ] && f_volume=${f_data_unit_ref[6]}
|
[ -n "$f_yahoo" ] && f_volume=${f_data_unit_ref[6]}
|
||||||
g_num_exponential2normal "$f_volume" && f_volume=$f_g_num_exponential2normal_result
|
g_num_exponential2normal "$f_volume" && f_volume=$g_num_exponential2normal_result
|
||||||
|
|
||||||
# check date for valid date
|
# check date for valid date
|
||||||
if ! [[ $f_unit_date =~ ^2[0-1][0-9][0-9]-[0-1][0-9]-[0-3][0-9]( [0-2][0-9]:[0-5][0-9]:[0-5][0-9])?$ ]]
|
if ! [[ $f_unit_date =~ ^2[0-1][0-9][0-9]-[0-1][0-9]-[0-3][0-9]( [0-2][0-9]:[0-5][0-9]:[0-5][0-9])?$ ]]
|
||||||
@ -158,7 +158,7 @@ function get_ohlcv-candle-latest {
|
|||||||
|
|
||||||
local f_symbol="$1"
|
local f_symbol="$1"
|
||||||
local f_histfile="$2"
|
local f_histfile="$2"
|
||||||
local f_histfile_week="$3"
|
#local f_histfile_week="$3"
|
||||||
|
|
||||||
# find latest time which is not fetched already
|
# find latest time which is not fetched already
|
||||||
if [ -s "$f_histfile" ]
|
if [ -s "$f_histfile" ]
|
||||||
|
@ -9,7 +9,7 @@ function get_orders {
|
|||||||
local f_symbols=()
|
local f_symbols=()
|
||||||
if [ -z "$f_symbol" ]
|
if [ -z "$f_symbol" ]
|
||||||
then
|
then
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||||
do
|
do
|
||||||
if [ -z "$LEVERAGE" ]
|
if [ -z "$LEVERAGE" ]
|
||||||
then
|
then
|
||||||
|
@ -5,7 +5,7 @@ function get_positions {
|
|||||||
local f_symbol f_symbols
|
local f_symbol f_symbols
|
||||||
|
|
||||||
# build python array of symbols
|
# build python array of symbols
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||||
do
|
do
|
||||||
if [ -z "$LEVERAGE" ]
|
if [ -z "$LEVERAGE" ]
|
||||||
then
|
then
|
||||||
|
@ -12,17 +12,17 @@ function get_symbols_ticker {
|
|||||||
if [ "$f_fetch" = "refetchonly" ]
|
if [ "$f_fetch" = "refetchonly" ]
|
||||||
then
|
then
|
||||||
# fetch from exchange
|
# fetch from exchange
|
||||||
f_ccxt "print(${STOCK_EXCHANGE}.fetch_tickers())" && echo $f_ccxt_result >CCXT_TICKERS_RAW
|
f_ccxt "print(${STOCK_EXCHANGE}.fetch_tickers())" && echo $f_ccxt_result >CCXT_TICKERS_RAW-${STOCK_EXCHANGE}
|
||||||
|
|
||||||
# parse relevant tokens
|
# parse relevant tokens
|
||||||
local f_grep="${CURRENCY},"
|
local f_grep="${CURRENCY},"
|
||||||
[ -n "$LEVERAGE" ] && f_grep="${CURRENCY}:${CURRENCY},"
|
[ -n "$LEVERAGE" ] && f_grep="${CURRENCY}:${CURRENCY},"
|
||||||
[ -s CCXT_TICKERS_RAW ] && jq -r '.[] | .symbol + "," + (.last|tostring)' CCXT_TICKERS_RAW | grep "${f_grep}" >CCXT_TICKERS
|
[ -s CCXT_TICKERS_RAW-${STOCK_EXCHANGE} ] && jq -r '.[] | .symbol + "," + (.last|tostring)' CCXT_TICKERS_RAW-${STOCK_EXCHANGE} | grep "${f_grep}" >CCXT_TICKERS-${STOCK_EXCHANGE}.tmp
|
||||||
|
|
||||||
if [ -s CCXT_TICKERS ]
|
if [ -s CCXT_TICKERS-${STOCK_EXCHANGE}.tmp ]
|
||||||
then
|
then
|
||||||
cut -d, -f1 CCXT_TICKERS >CCXT_SYMBOLS
|
cat CCXT_TICKERS-${STOCK_EXCHANGE}.tmp >CCXT_TICKERS-$STOCK_EXCHANGE
|
||||||
cat CCXT_SYMBOLS >CCXT_SYMBOLS-$STOCK_EXCHANGE
|
cut -d, -f1 CCXT_TICKERS-${STOCK_EXCHANGE}.tmp >CCXT_SYMBOLS-${STOCK_EXCHANGE}
|
||||||
|
|
||||||
## get symbols by volume from history files and check with CCXT_SYMBOLS-$STOCK_EXCHANGE
|
## get symbols by volume from history files and check with CCXT_SYMBOLS-$STOCK_EXCHANGE
|
||||||
[ -n "$LEVERAGE" ] && f_naming="${CURRENCY}:${CURRENCY}"
|
[ -n "$LEVERAGE" ] && f_naming="${CURRENCY}:${CURRENCY}"
|
||||||
@ -41,15 +41,56 @@ function get_symbols_ticker {
|
|||||||
sed -i "\#${f_remove_symbol}#d" CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume
|
sed -i "\#${f_remove_symbol}#d" CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# write file with symbols that should be traded
|
||||||
|
rm -f CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade.tmp
|
||||||
|
for f_symbol in $SYMBOLS
|
||||||
|
do
|
||||||
|
grep "^$f_symbol/$CURRENCY" CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume >>CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade.tmp
|
||||||
|
done
|
||||||
|
[ -s CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade.tmp ] && mv CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade.tmp CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade
|
||||||
|
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
g_array CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume f_symbols_array_ref
|
# create associative ticker array
|
||||||
|
if [ -s CCXT_TICKERS-$STOCK_EXCHANGE ]
|
||||||
|
then
|
||||||
|
g_array CCXT_TICKERS-$STOCK_EXCHANGE f_tickers_array_ref
|
||||||
|
local f_ticker f_symbol f_price
|
||||||
|
declare -Ag f_tickers_array
|
||||||
|
for f_ticker in "${f_tickers_array_ref[@]}"
|
||||||
|
do
|
||||||
|
f_symbol=${f_ticker%%:*}
|
||||||
|
f_symbol=${f_symbol//\/}
|
||||||
|
f_symbol=${f_symbol/ /}
|
||||||
|
f_price=${f_ticker/*,/}
|
||||||
|
g_num_exponential2normal $f_price && f_price=$g_num_exponential2normal_result
|
||||||
|
|
||||||
|
# remove from symbol-list if price is invalid
|
||||||
|
if ! g_num_valid_number $f_price 2>/dev/null
|
||||||
|
then
|
||||||
|
f_remove_symbol=${f_ticker/,*/}
|
||||||
|
sed -i "\#${f_remove_symbol}#d" CCXT_SYMBOLS-${STOCK_EXCHANGE} CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
f_tickers_array[$f_symbol]=$f_price
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create array with ccxt symbols sorted by volume
|
||||||
|
[ -s CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume ] && g_array CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume f_symbols_array_ref
|
||||||
f_symbols_array=("${f_symbols_array_ref[@]}")
|
f_symbols_array=("${f_symbols_array_ref[@]}")
|
||||||
|
|
||||||
|
# create array with ccxt symbols sorted by volume which sould be traded
|
||||||
|
[ -s CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade ] && g_array CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume-trade f_symbols_array_trade_ref
|
||||||
|
f_symbols_array_trade=("${f_symbols_array_ref[@]}")
|
||||||
|
|
||||||
|
|
||||||
|
# create f_symbols var
|
||||||
[ -s CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume ] && f_symbols=$(cat CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume)
|
[ -s CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume ] && f_symbols=$(cat CCXT_SYMBOLS-${STOCK_EXCHANGE}-by-volume)
|
||||||
f_symbols=${f_symbols//$'\n'/'+'}
|
f_symbols=${f_symbols//$'\n'/'+'}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ function get_transactions {
|
|||||||
#for f_symbol in $f_symbols
|
#for f_symbol in $f_symbols
|
||||||
for f_symbol in "${f_symbols_array[@]}"
|
for f_symbol in "${f_symbols_array[@]}"
|
||||||
do
|
do
|
||||||
|
f_symbol=${f_symbol//,*}
|
||||||
|
|
||||||
# binance does not allow derivate trading in many countries so ignore because of 400-Error
|
# binance does not allow derivate trading in many countries so ignore because of 400-Error
|
||||||
[[ $f_symbol =~ : ]] && [[ $f_exchange = binance ]] && continue
|
[[ $f_symbol =~ : ]] && [[ $f_exchange = binance ]] && continue
|
||||||
|
@ -1 +0,0 @@
|
|||||||
ASSET,ALERTS,BUYPRICE,BUYDATE,BUYQUANTITY,SELLPRICE,SELLDATE,SELLQUANTITY,COMMENT
|
|
|
@ -10,7 +10,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
@ -32,7 +32,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
@ -45,7 +45,7 @@ services:
|
|||||||
cpus: '1'
|
cpus: '1'
|
||||||
memory: 512M
|
memory: 512M
|
||||||
|
|
||||||
dabo-ohlcv-candles-indicators:
|
dabo-ohlcv-candles-indicators-5m:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@ -55,18 +55,103 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 5m 300
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
dabo-ohlcv-candles-indicators-15m:
|
||||||
cpus: '1'
|
build:
|
||||||
memory: 512M
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 15m 900
|
||||||
|
|
||||||
|
|
||||||
|
dabo-ohlcv-candles-indicators-1h:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1h 3600
|
||||||
|
|
||||||
|
|
||||||
|
dabo-ohlcv-candles-indicators-4h:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 4h 3600
|
||||||
|
|
||||||
|
|
||||||
|
dabo-ohlcv-candles-indicators-1d:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1d
|
||||||
|
|
||||||
|
|
||||||
|
dabo-ohlcv-candles-indicators-1w:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1w
|
||||||
|
|
||||||
|
|
||||||
dabo-calc-indicators-hist:
|
dabo-calc-indicators-hist:
|
||||||
build:
|
build:
|
||||||
@ -78,7 +163,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
@ -92,6 +177,29 @@ services:
|
|||||||
cpus: '1'
|
cpus: '1'
|
||||||
memory: 1024M
|
memory: 1024M
|
||||||
|
|
||||||
|
dabo-calc-levels:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
user: 10000:10000
|
||||||
|
volumes:
|
||||||
|
- ./dabo:/dabo:ro
|
||||||
|
- ./strategies:/dabo/strategies:ro
|
||||||
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
|
- ./data:/dabo/htdocs:rw
|
||||||
|
- ./home:/dabo/home:rw
|
||||||
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
- /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: /dabo/calc-levels.sh
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '1'
|
||||||
|
memory: 1024M
|
||||||
|
|
||||||
dabo-orders:
|
dabo-orders:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
@ -102,7 +210,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
@ -125,7 +233,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
@ -149,7 +257,7 @@ services:
|
|||||||
- ./dabo:/dabo:ro
|
- ./dabo:/dabo:ro
|
||||||
- ./strategies:/dabo/strategies:ro
|
- ./strategies:/dabo/strategies:ro
|
||||||
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
- ./dabo-bot.conf:/dabo/dabo-bot.override.conf
|
||||||
- ./watch-assets.csv:/dabo/watch-assets.csv
|
# - ./watch-assets.csv:/dabo/watch-assets.csv
|
||||||
- ./data:/dabo/htdocs:rw
|
- ./data:/dabo/htdocs:rw
|
||||||
- ./home:/dabo/home:rw
|
- ./home:/dabo/home:rw
|
||||||
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
- /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro
|
||||||
|
Loading…
Reference in New Issue
Block a user