added chart

This commit is contained in:
olli 2023-10-28 14:32:14 +02:00
parent 7bf28241ae
commit 1c5753329c

View File

@ -43,6 +43,10 @@ function analyze {
ORIGIFS="$IFS" ORIGIFS="$IFS"
IFS=$'\n' IFS=$'\n'
# Chart Part
head -n1 ${file} >analyze-${analyzedate}/chart-${tmpfile}.csv
# Chart Part End
for line in $(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,') for line in $(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,')
do do
IFS="$ORIGIFS" IFS="$ORIGIFS"
@ -50,6 +54,9 @@ function analyze {
time=$(echo $line | cut -d, -f1 | cut -d: -f1,2) time=$(echo $line | cut -d, -f1 | cut -d: -f1,2)
f_market_performance=$(grep "^$time" data/botdata/MARKET_PERFORMANCE | tail -n1 | cut -d: -f4 | cut -d"%" -f1 | sed 's/ *//') f_market_performance=$(grep "^$time" data/botdata/MARKET_PERFORMANCE | tail -n1 | cut -d: -f4 | cut -d"%" -f1 | sed 's/ *//')
echo "$line" >>${g_tmp}/${tmpfile} echo "$line" >>${g_tmp}/${tmpfile}
# Chart Part
echo "$line,${f_market_performance},${f_score}" >>analyze-${analyzedate}/chart-${tmpfile}.csv
# Chart Part End
echo " ${line},${f_market_performance}" | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | column -t -s, >>${g_tmp}/output-${tmpfile} echo " ${line},${f_market_performance}" | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | column -t -s, >>${g_tmp}/output-${tmpfile}
if [ -f "${g_tmp}/open-${tmpfile}" ] if [ -f "${g_tmp}/open-${tmpfile}" ]
then then
@ -119,6 +126,10 @@ cp -r strategies analyze-${analyzedate}/
analyzecounter=0 analyzecounter=0
# Chart Part
[ -e data/charts.min.css ] || wget -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O data/charts.min.css
# Chart Part End
for file in $@ for file in $@
do do
echo "${file}" | egrep -q "BALANCE|-INDEX" && continue echo "${file}" | egrep -q "BALANCE|-INDEX" && continue
@ -137,6 +148,28 @@ do
analyze ${file} analyze ${file}
fi fi
# Chart Part
g_echo "generating chart for $file"
echo "<html>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' href='../dabo/data/browser.css'>
<link rel='stylesheet' type='text/css' href='../dabo/data/charts.min.css'>
<title>analyze.sh ${ANALYZE_TIME}</title>
</head>
<body>
<h1>analyze.sh ${ANALYZE_TIME}</h1>
" >analyze-${analyzedate}/chart-${tmpfile}.html
echo "Price, EMA, Levels" >>analyze-${analyzedate}/chart-${tmpfile}.html
genchart analyze-${analyzedate}/chart-${tmpfile}.csv 500 2,25,26,27,28,29,30,31,32,33,34,35,4,36,37,38,39 green,DarkSlateGrey,DarkSlateGrey,Gold,DarkOrange,DarkOrange,GoldenRod,GoldenRod,GoldenRod,GoldenRod,DarkOrange,DarkOrange,MidnightBlue,Indigo,DarkSlateBlue,DodgerBlue,DeepSkyBlue >>analyze-${analyzedate}/chart-${tmpfile}.html
echo "MACD" >>analyze-${analyzedate}/chart-${tmpfile}.html
genchart analyze-${analyzedate}/chart-${tmpfile}.csv 500 8,6,7 >>analyze-${analyzedate}/chart-${tmpfile}.html
echo "RSIs" >>analyze-${analyzedate}/chart-${tmpfile}.html
genchart analyze-${analyzedate}/chart-${tmpfile}.csv 500 10,11,12,14,15,16,17,13 >>analyze-${analyzedate}/chart-${tmpfile}.html
# Chart Part End
echo "</body></html>">>analyze-${analyzedate}/chart-${tmpfile}.html
done done
if [ "${ANALYZE_BATCH}" -eq "0" ] if [ "${ANALYZE_BATCH}" -eq "0" ]