small fixes

This commit is contained in:
olli 2023-06-02 09:53:01 +02:00
parent 08bb049aa1
commit 4c0e8be234
5 changed files with 27 additions and 7 deletions

View File

@ -120,9 +120,9 @@ do
echo "${file}" | egrep -q "BALANCE|MSCI-WORLD-INDEX" && continue echo "${file}" | egrep -q "BALANCE|MSCI-WORLD-INDEX" && continue
lines=$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,' | wc -l) lines=$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,' | wc -l)
if [ $lines -lt 40 ] if [ $lines -lt 150 ]
then 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 continue
fi fi

View File

@ -28,9 +28,15 @@ function check_for_buy {
f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv" 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 then
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}" check_buy_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}"
else
g_echo_note "BUY $f_ASSET_HIST_FILE no current data - ignoring"
fi
else else
g_echo_note "BUY $f_ASSET_HIST_FILE not enough data - waiting for complete values" g_echo_note "BUY $f_ASSET_HIST_FILE not enough data - waiting for complete values"
fi fi

View File

@ -22,6 +22,10 @@ function check_for_sell {
do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}" do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}"
continue continue
fi 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}" check_sell_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}"
done done
} }

View File

@ -4,7 +4,7 @@
return 1 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. # 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 # for details see functions/market_performance.sh
# If the market performance is under this value no buying will be done # If the market performance is under this value no buying will be done

View File

@ -3,11 +3,11 @@
return 1 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. # 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 # for details see functions/market_performance.sh
# If the market performance is under this value no buying will be done # 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. # 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" 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. # decimal numbers are not allowed here.
local SELL_MACD_RELATION_FROM="25" 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"