diff --git a/dabo/analyze.sh b/dabo/analyze.sh index f21bc36..e9c1a69 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -120,9 +120,9 @@ do echo "${file}" | egrep -q "BALANCE|MSCI-WORLD-INDEX" && continue lines=$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,' | wc -l) - if [ $lines -lt 40 ] + if [ $lines -lt 150 ] then - g_echo "Only $lines lines for given timeframe (${ANALYZE_TIME}) in $file - ignoring files with less then 40!" + g_echo "Only $lines lines for given timeframe (${ANALYZE_TIME}) in $file - ignoring files with less then 150!" continue fi diff --git a/dabo/functions/check_for_buy.sh b/dabo/functions/check_for_buy.sh index 0c62575..9450f11 100644 --- a/dabo/functions/check_for_buy.sh +++ b/dabo/functions/check_for_buy.sh @@ -28,9 +28,15 @@ function check_for_buy { f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv" - if [ $(tail -n 6 "$f_ASSET_HIST_FILE" | egrep -v ",,|,$" | wc -l) -ge 5 ] + if [ $(tail -n 155 "$f_ASSET_HIST_FILE" | egrep -v ",,|,$" | wc -l) -ge 150 ] then - check_buy_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}" + if tail -n1 $f_ASSET_HIST_FILE | grep -q "^$(date +%Y-%m-%d)" + then + g_echo_note "BUY $f_ASSET_HIST_FILE checking conditions" + check_buy_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}" + else + g_echo_note "BUY $f_ASSET_HIST_FILE no current data - ignoring" + fi else g_echo_note "BUY $f_ASSET_HIST_FILE not enough data - waiting for complete values" fi diff --git a/dabo/functions/check_for_sell.sh b/dabo/functions/check_for_sell.sh index 3e92054..e87b738 100644 --- a/dabo/functions/check_for_sell.sh +++ b/dabo/functions/check_for_sell.sh @@ -22,6 +22,10 @@ function check_for_sell { do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}" continue fi + if tail -n1 $f_ASSET_HIST_FILE | grep -q "^$(date +%Y-%m-%d)" + then + g_echo_warn "SELL $f_ASSET_HIST_FILE no current data of invested asset" + fi check_sell_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}" done } diff --git a/strategies/buy.example.conf b/strategies/buy.example.conf index 02ebe1a..85fbce9 100755 --- a/strategies/buy.example.conf +++ b/strategies/buy.example.conf @@ -4,7 +4,7 @@ return 1 -# GOOD_MARKET_PERFORMANCE_INDEX defines from fwhich growth the market is considered good/favorable for investment. +# GOOD_MARKET_PERFORMANCE_INDEX defines from which growth the market is considered good/favorable for investment. # The market performance is calculated from the average percentage development of various indicators such as development MSCI World, Bitcoin and Ethereum as well as forecasts. # for details see functions/market_performance.sh # If the market performance is under this value no buying will be done diff --git a/strategies/sell.example.conf b/strategies/sell.example.conf index 4a4b975..17b2333 100755 --- a/strategies/sell.example.conf +++ b/strategies/sell.example.conf @@ -3,11 +3,11 @@ return 1 -# GOOD_MARKET_PERFORMANCE_INDEX defines from fwhich growth the market is considered good/favorable for investment. +# GOOD_MARKET_PERFORMANCE_INDEX defines from which growth the market is considered good/favorable for investment. # The market performance is calculated from the average percentage development of various indicators such as development MSCI World, Bitcoin and Ethereum as well as forecasts. # for details see functions/market_performance.sh # If the market performance is under this value no buying will be done -local GOOD_MARKET_PERFORMANCE_INDEX="-1" +local GOOD_MARKET_PERFORMANCE_INDEX="2" # Force hold if result negative expect SELL_PERCENTAGE_FROM_LAST_PURCHASE_NEGATIVE. Boolean 1 for true 0 for false. local SELL_HOLD_IF_RESULT_NEGATIVE="1" @@ -53,3 +53,13 @@ local SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD="7200" # decimal numbers are not allowed here. local SELL_MACD_RELATION_FROM="25" +### Take profit/loss +local TAKE_PROFIT_CHECK_AFTER_POSTITIVE_RESULTS="1" +local TAKE_PROFIT_CHECK_AT_FEE_PLUS="0.5" +local TAKE_PROFIT_CHECK_AT_FACTOR="1.25" + +local TAKE_LOSS_CHECK_AFTER_NEGATIVE_RESULTS="5" +local TAKE_LOSS_CHECK_AT_FEE_PLUS="0" +local TAKE_LOSS_CHECK_AT_FACTOR="2" + +