Compare commits
No commits in common. "7d3856e37c6ace10c3a915f447ae8e547febd279" and "e59090a2cfae295bbc7ce3e35b745cc980743777" have entirely different histories.
7d3856e37c
...
e59090a2cf
@ -32,3 +32,7 @@ INVEST="5"
|
||||
# Stop all trading and sell everything if the complete balance shrinks under this value in ${CURRENCY}
|
||||
EMERGENCY_STOP="1000"
|
||||
|
||||
# Headline - don't touch
|
||||
export csv_headline="Date and Time,Price,Change,EMA12,EMA26,MACD,EMA9 (Sig.),Histogram,MACD Sig.,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Change 24h,Change 7d,Change 14d,Change 30d,Change 1y,MarketCap Change 24h,FIB60,FIB168,FIB672,FIB8064"
|
||||
|
||||
|
||||
|
@ -55,16 +55,6 @@ do
|
||||
. ../../dabo-bot.conf
|
||||
. ../../dabo-bot.override.conf
|
||||
|
||||
# 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,Change 24h,Change 7d,Change 14d,Change 30d,Change 1y,MarketCap Change 24h,RANGE PERIODS,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"
|
||||
|
||||
# Timestamp
|
||||
export f_timestamp=$(g_date_print)
|
||||
|
||||
# get minute interval for find -mmin
|
||||
INTERVAL_MIN=$(echo "${INTERVAL}/60-1" | bc -l | sed -r 's/^(-?)\./\10./' | cut -d\. -f1)
|
||||
[ -z "${INTERVAL_MIN}" ] && INTERVAL_MIN=1
|
||||
|
||||
# stock data
|
||||
if [ ${STOCK_EXCHANGE} = "BINANCE" ]
|
||||
then
|
||||
|
@ -1,105 +0,0 @@
|
||||
function genchart {
|
||||
# generate css chart (line diagram) from csv file or simple file with number per line - needed charts.css included in webppage
|
||||
local mark
|
||||
local lastmark
|
||||
local file=$1
|
||||
local lastlines=$2
|
||||
[ -z "${lastlines}" ] && lastlines=50
|
||||
local fields=$3
|
||||
[ -z "${fields}" ] && fields=1
|
||||
local colors=$4
|
||||
[ -z "${colors}" ] && colors="White,Gold,Silver,Blue,DarkMagenta,DarkViolet,Indigo,MediumBlue,DarkOrchid,MidnightBlue,CornflowerBlue,CadetBlue,DarkCyan,DarkSlateBlue,DeepSkyBlue,DodgerBlue,Teal"
|
||||
|
||||
local awkfields=$(echo "${fields}" | sed 's/,/ \",\" \$/g; s/^/\$/')
|
||||
#tail -n ${lastlines} "${file}" | cut -d, -f${fields} | egrep "^[-0-9]" >${g_tmp}/g_genchart_data
|
||||
tail -n ${lastlines} "${file}" | awk -F',' "{ print $awkfields }" | perl -pe 's/,,+//g' | egrep "^[-0-9]" >${g_tmp}/g_genchart_data
|
||||
lines=$(cat ${g_tmp}/g_genchart_data | wc -l)
|
||||
#head -n1 "${file}" | cut -d, -f${fields} >${g_tmp}/g_genchart_headline
|
||||
head -n1 "${file}" | awk -F',' "{ print $awkfields }" >${g_tmp}/g_genchart_headline
|
||||
|
||||
local time_from=$(tail -n ${lastlines} "${file}" | head -n1 | cut -d, -f1)
|
||||
local time_to=$(tail -n1 "${file}" | cut -d, -f1)
|
||||
|
||||
local highest=$(cat ${g_tmp}/g_genchart_data | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | tail -n1 | sed 's/^-//')
|
||||
local lowest=$(cat ${g_tmp}/g_genchart_data | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | head -n1)
|
||||
if echo ${lowest} | grep -q '^-'
|
||||
then
|
||||
lowest=$(echo ${lowest} | sed 's/^-//')
|
||||
local calc="+ ${lowest}) / (${highest} + ${lowest}"
|
||||
local calcnull="(0 $calc)"
|
||||
else
|
||||
local calc="- ${lowest}) / (${highest} - ${lowest}"
|
||||
local calcnull="0"
|
||||
fi
|
||||
|
||||
#local divideby=$(echo "$highest+$lowest" | bc -l | sed 's/^\./0./; s/^-\./-0./')
|
||||
|
||||
local fieldsnum=$(cat ${g_tmp}/g_genchart_headline | sed 's/,/\n/g' | wc -l)
|
||||
|
||||
local color="green"
|
||||
tail -n1 ${g_tmp}/g_genchart_data | cut -d, -f1 | grep -q "^-" && color="red"
|
||||
|
||||
mkdir ${g_tmp}/g_genchart
|
||||
local RND=$RANDOM
|
||||
echo "<table id='noborder' width='100%'><tr><td id='noborder' width='100%'>"
|
||||
echo "<div id='$RND'>"
|
||||
echo "<table class='charts-css line show-data-on-hover'><caption> $RND </caption>"
|
||||
local line
|
||||
for fieldnum in $(seq ${fieldsnum} | tac)
|
||||
do
|
||||
linecolor=$(echo "$colors" | cut -d, -f${fieldnum})
|
||||
linename=$(cat ${g_tmp}/g_genchart_headline | cut -d, -f${fieldnum} | tr [:lower:] [:upper:])
|
||||
if [ ${fieldnum} -eq 1 ]
|
||||
then
|
||||
echo "<b><font color='${color}'>${linename}</font></b><br>"
|
||||
else
|
||||
echo "<b><font color='${linecolor}'>${linename}</font></b><br>"
|
||||
fi >>${g_tmp}/g_genchart/legend
|
||||
local linenum=1
|
||||
for line in $(cat ${g_tmp}/g_genchart_data)
|
||||
do
|
||||
for mark in $(echo ${line} | cut -d, -f${fieldnum})
|
||||
do
|
||||
[ -z "${lastmark}" ] && lastmark=${mark}
|
||||
local calcstart="(${lastmark} ${calc})"
|
||||
local calcend="(${mark} ${calc})"
|
||||
if [ ${fieldnum} -eq 1 ]
|
||||
then
|
||||
echo "<td style='--color: grey; --start: calc( ${calcnull} ); --end: calc( ${calcnull} );'> </td>"
|
||||
echo "<td style='--color: ${color}; --start: calc( ${calcstart} ); --end: calc( ${calcend} );'> <span class='tooltip'> ${mark} </span> </td>"
|
||||
else
|
||||
echo "<td style='--color: ${linecolor}; --start: calc( ${calcstart} ); --end: calc( ${calcend} );'> </td>"
|
||||
fi >>${g_tmp}/g_genchart/${linenum}
|
||||
((linenum=linenum+1))
|
||||
lastmark=${mark}
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
# put all lines together
|
||||
for linenum in $(seq 2 ${lines})
|
||||
do
|
||||
echo "<tr>"
|
||||
cat ${g_tmp}/g_genchart/${linenum}
|
||||
echo "</tr>"
|
||||
done
|
||||
echo "</table></div>"
|
||||
|
||||
# legend
|
||||
if grep -q ',' ${g_tmp}/g_genchart_headline
|
||||
then
|
||||
echo "<td id='noborder'>"
|
||||
tac ${g_tmp}/g_genchart/legend
|
||||
echo "</td>"
|
||||
fi
|
||||
|
||||
if echo ${time_from} | egrep -q '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]' && echo ${time_to} | egrep -q '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]'
|
||||
then
|
||||
echo "</tr><td id='noborder'><table width='100%' id='noborder'><tr><td id='noborder'><p style='text-align:left;'>${time_from}</p></td><td id='noborder' width='100%'><hr></td><td id='noborder'><p style='text-align:right;'>${time_to}</p></td></tr></table></td><td id='noborder'></td>"
|
||||
fi
|
||||
|
||||
echo "</tr></table>"
|
||||
|
||||
rm -r ${g_tmp}/g_genchart
|
||||
|
||||
}
|
@ -5,15 +5,6 @@ function get_asset {
|
||||
|
||||
# write asset hist file with macd and rsi
|
||||
local f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history-raw.csv"
|
||||
|
||||
if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}"
|
||||
then
|
||||
g_echo_note "${f_ASSET_HIST_FILE} already downloaded in the last ${INTERVAL_MIN} minutes"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
[ -f "${f_ASSET_HIST_FILE}" ] || echo "Date and Time,Price" >"${f_ASSET_HIST_FILE}"
|
||||
if ! grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}"
|
||||
then
|
||||
@ -41,23 +32,18 @@ function get_asset {
|
||||
fi
|
||||
|
||||
f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv"
|
||||
#if [ ${f_linecount} -lt 30 ] && [ ${f_lines} -ge 50 ] && [ ${INTERVAL} -lt 300 ]
|
||||
#then
|
||||
# g_echo_note "${f_ASSET_HIST_FILE}: set price to 5 minute period"
|
||||
# if ! echo "${f_timestamp}" | egrep -q ":[0-5]0:|:[0-5]5:"
|
||||
# then
|
||||
# return 0
|
||||
# fi
|
||||
#fi
|
||||
if [ ${f_linecount} -lt 30 ] && [ ${f_lines} -ge 50 ] && [ ${INTERVAL} -lt 300 ]
|
||||
then
|
||||
g_echo_note "${f_ASSET_HIST_FILE}: set price to 5 minute period"
|
||||
if ! echo "${f_timestamp}" | egrep -q ":[0-5]0:|:[0-5]5:"
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# headline
|
||||
#[ -s "${f_ASSET_HIST_FILE}" ] || echo "${csv_headline}" >"${f_ASSET_HIST_FILE}"
|
||||
if [ -s "${f_ASSET_HIST_FILE}" ]
|
||||
then
|
||||
sed -i -e 1c"$csv_headline" "${f_ASSET_HIST_FILE}"
|
||||
else
|
||||
echo "$csv_headline" >"${f_ASSET_HIST_FILE}"
|
||||
fi
|
||||
[ -s "${f_ASSET_HIST_FILE}" ] || echo "${csv_headline}" >"${f_ASSET_HIST_FILE}"
|
||||
|
||||
|
||||
# date and price
|
||||
echo -n "${f_line}" >>${f_ASSET_HIST_FILE}
|
||||
@ -93,24 +79,15 @@ function get_asset {
|
||||
echo -n ,$(jq -r ".[] |select(.symbol==\"${f_asset}\")|\"\\(.price_change_percentage_1y_in_currency)\"" COINGECKO_GET_ASSETS_CMD_OUT) >>${f_ASSET_HIST_FILE}
|
||||
echo -n ,$(jq -r ".[] |select(.symbol==\"${f_asset}\")|\"\\(.market_cap_change_percentage_24h)\"" COINGECKO_GET_ASSETS_CMD_OUT) >>${f_ASSET_HIST_FILE}
|
||||
|
||||
# range and fibonacci
|
||||
get_range ${f_ASSET_HIST_FILE}
|
||||
|
||||
# Calculate EMA 50:36 100:37 200:38 800:39
|
||||
local f_calcemanumcolumn
|
||||
for f_calcemanumcolumn in 50:36 100:37 200:38 800:39
|
||||
do
|
||||
local f_calcema=$(echo ${f_calcemanumcolumn} | cut -d: -f1)
|
||||
local f_caclemacolumn=$(echo ${f_calcemanumcolumn} | cut -d: -f2)
|
||||
get_ema "${f_ASSET_HIST_FILE}" 2 ${f_calcema} "$(tail -n2 "${f_ASSET_HIST_FILE}" | head -n1 | grep ^2 | cut -d, -f${f_caclemacolumn})" "${f_price}"
|
||||
if [ -z "${f_ema}" ]
|
||||
then
|
||||
g_echo_note "${FUNCNAME} $@: Not enough data for calculating EMA - waiting for more values"
|
||||
echo -n "," >>"${f_ASSET_HIST_FILE}"
|
||||
else
|
||||
echo -n ",${f_ema}" >>"${f_ASSET_HIST_FILE}"
|
||||
fi
|
||||
done
|
||||
# Calculate Fibonacci-Retracement
|
||||
# last 60 timeframes (a day on hourly)
|
||||
get_fibonacci_indicator ${f_ASSET_HIST_FILE} 60
|
||||
# last 168 timeframes (a week on hourly)
|
||||
get_fibonacci_indicator ${f_ASSET_HIST_FILE} 168
|
||||
# last 672 timeframes (a month on hourly)
|
||||
get_fibonacci_indicator ${f_ASSET_HIST_FILE} 672
|
||||
# last 8064 timeframes (a year on hourly)
|
||||
get_fibonacci_indicator ${f_ASSET_HIST_FILE} 8064
|
||||
|
||||
# end with newline
|
||||
echo "" >>${f_ASSET_HIST_FILE}
|
||||
|
@ -19,7 +19,7 @@ function get_assets {
|
||||
cp -p ${g_tmp}/API_CMD_OUT PRICETICKER
|
||||
|
||||
# timestamp for data
|
||||
#f_timestamp=$(g_date_print)
|
||||
f_timestamp=$(g_date_print)
|
||||
# check output
|
||||
if [ -s ${f_filename}_OUT.tmp ] && egrep -q "^[A-Z]+${CURRENCY},[0-9]*\.[0-9]+$" ${f_filename}_OUT.tmp
|
||||
then
|
||||
|
@ -111,7 +111,7 @@ function get_balances {
|
||||
|
||||
# calculate complete balance
|
||||
local f_COMPLETE_BALANCE=$(echo "scale=2; $CURRENCY_BALANCE+$f_SPOT_BALANCE" | bc -l)
|
||||
#local f_timestamp=$(g_date_print)
|
||||
local f_timestamp=$(g_date_print)
|
||||
|
||||
# write balance history
|
||||
echo "$f_timestamp,$f_COMPLETE_BALANCE" >>"asset-histories/BALANCECOMPLETE${CURRENCY}.history.csv"
|
||||
|
48
dabo/functions/get_fibonacci_indicator.sh
Normal file
48
dabo/functions/get_fibonacci_indicator.sh
Normal file
@ -0,0 +1,48 @@
|
||||
function get_fibonacci_indicator {
|
||||
#g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
# get histfile
|
||||
local f_hist_file="$1"
|
||||
local f_period="$2"
|
||||
|
||||
f_fibonacci=""
|
||||
|
||||
# Check for enough time periods in data
|
||||
local f_period=$((f_period+1))
|
||||
local f_period_sum=$(tail -n${f_period} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | wc -l)
|
||||
if ! [ ${f_period_sum} -ge ${f_period} ]
|
||||
then
|
||||
g_echo_note "${FUNCNAME} $@: Not enough data - waiting for more values and defaulting to 0. (${f_period} needed; ${f_period_sum} given)"
|
||||
echo -n ",0" >>"${f_hist_file}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# get highest and lowest price in period and current price
|
||||
local f_highest=$(tail -n${f_period} "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]" | sort -n | tail -n1)
|
||||
local f_lowest=$(tail -n${f_period} "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]" | sort -n | head -n1)
|
||||
local f_price=$(tail -n1 "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]")
|
||||
# calculate range
|
||||
local f_range=$(echo "${f_highest}-${f_lowest}" | bc -l)
|
||||
|
||||
# calculate current difference to highest
|
||||
local f_diff_to_highest=$(echo "${f_highest}-${f_price}" | bc -l)
|
||||
local f_diff_to_highest_in_range=$(echo "${f_range}-${f_diff_to_highest}" | bc -l)
|
||||
|
||||
# calculate fibonacci retracement value from range to difference of highest price
|
||||
f_fibonacci=$(echo "scale=8; 1+(1/${f_range}*(${f_diff_to_highest_in_range}-${f_range}))" | bc | sed 's/^\./0./;' | xargs printf "%.3f")
|
||||
#f_fibonacci=$(g_percentage-diff ${f_range} ${f_diff_to_highest_in_range})
|
||||
|
||||
echo -n ",${f_fibonacci}" >>"${f_hist_file}"
|
||||
|
||||
# echo "
|
||||
#Highest=$f_highest
|
||||
#Lowest=$f_lowest
|
||||
#Price=$f_price
|
||||
#Range=$f_range
|
||||
#highest-diff=$f_diff_to_highest
|
||||
#highest-diff-range=$f_diff_to_highest_in_range
|
||||
#"
|
||||
|
||||
#g_echo_note "Fibonacci-Retracement: ${f_fibonacci}"
|
||||
|
||||
}
|
||||
|
@ -3,11 +3,6 @@ function get_marketdata {
|
||||
local f_name="$2"
|
||||
|
||||
## get data for analysis
|
||||
if find asset-histories/${f_name}.history.csv -mmin -${INTERVAL_MIN} | grep -q "asset-histories/${f_name}.history.csv"
|
||||
then
|
||||
g_echo_note "asset-histories/${f_name}.history.csv already downloaded in the last ${INTERVAL_MIN} minutes"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# check source platform for parsing parameters, prepare and run wget command
|
||||
>MARKET_DATA_CMD
|
||||
|
@ -1,55 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#. /etc/bash/gaboshlib.include
|
||||
|
||||
function get_range {
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
# get histfile
|
||||
local f_hist_file="$1"
|
||||
|
||||
# find constant range in defined periods
|
||||
local f_test_periods=1000
|
||||
|
||||
# go reverse through periods and look for range
|
||||
for f_test_period in $(seq 1 ${f_test_periods})
|
||||
do
|
||||
# get average from period to now
|
||||
local f_rangeaverage=$(tail -n${f_test_period} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | awk '{ sum += $1; n++ } END { OFMT = "%2.8f"; if (n > 0) print sum / n; }')
|
||||
# get old price from period
|
||||
local f_period_price=$(tail -n${f_test_period} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | head -n1)
|
||||
# get percentage diff from old price and last average
|
||||
local f_period_price_diff=$(g_percentage-diff ${f_period_price} ${f_rangeaverage} | sed 's/^-//; s/\..*$//')
|
||||
# if percentage change is larger then 2% to the average we have an new price range
|
||||
local f_range_periods=${f_test_period}
|
||||
if [ ${f_period_price_diff} -gt 2 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# get highest, lowest and current price in period
|
||||
local f_highest_in_range=$(tail -n${f_range_periods} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | sort -n | tail -n1)
|
||||
local f_lowest_in_range=$(tail -n${f_range_periods} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | sort -n | head -n1)
|
||||
local f_current_price=$(tail -n1 "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | head -n1)
|
||||
|
||||
# calculate Pivot Point (PP)
|
||||
local f_pivot_point=$(echo "scale=8; (${f_highest_in_range}+${f_lowest_in_range}+${f_current_price})/3" | bc | sed 's/^\./0./;')
|
||||
|
||||
# calculate support/resist and golden pocket
|
||||
local f_support1=$(echo "scale=8; ${f_pivot_point}-((${f_highest_in_range}-${f_lowest_in_range})*0.382)" | bc | sed 's/^\./0./;' )
|
||||
local f_resist1=$(echo "scale=8; ${f_pivot_point}+((${f_highest_in_range}-${f_lowest_in_range})*0.382)" | bc | sed 's/^\./0./;' )
|
||||
local f_golden_pocket_support=$(echo "scale=8; ${f_pivot_point}-((${f_highest_in_range}-${f_lowest_in_range})*0.618)" | bc | sed 's/^\./0./;' )
|
||||
local f_golden_pocket_resist=$(echo "scale=8; ${f_pivot_point}+((${f_highest_in_range}-${f_lowest_in_range})*0.618)" | bc | sed 's/^\./0./;' )
|
||||
local f_golden_pocket65_support=$(echo "scale=8; ${f_pivot_point}-((${f_highest_in_range}-${f_lowest_in_range})*0.65)" | bc | sed 's/^\./0./;' )
|
||||
local f_golden_pocket65_resist=$(echo "scale=8; ${f_pivot_point}+((${f_highest_in_range}-${f_lowest_in_range})*0.65)" | bc | sed 's/^\./0./;' )
|
||||
local f_support3=$(echo "scale=8; ${f_pivot_point}-((${f_highest_in_range}-${f_lowest_in_range})*1)" | bc | sed 's/^\./0./;' )
|
||||
local f_resist3=$(echo "scale=8; ${f_pivot_point}+((${f_highest_in_range}-${f_lowest_in_range})*1)" | bc | sed 's/^\./0./;' )
|
||||
|
||||
# write down in history
|
||||
echo -n "${f_range_periods},${f_lowest_in_range},${f_highest_in_range},${f_pivot_point},${f_support1},${f_resist1},${f_golden_pocket_support},${f_golden_pocket_resist},${f_golden_pocket65_support},${f_golden_pocket65_resist},${f_support3},${f_resist3}" >>"${f_hist_file}"
|
||||
|
||||
}
|
||||
|
||||
#get_range /home/docker/dabo-bitpanda.ds9.dedyn.io/data/botdata/asset-histories/SHIBEUR.history.csv
|
||||
|
||||
|
63
dabo/functions/get_rate_percentage_min_before_and_now.sh
Normal file
63
dabo/functions/get_rate_percentage_min_before_and_now.sh
Normal file
@ -0,0 +1,63 @@
|
||||
function get_rate_percentage_min_before_and_now {
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
# get vars
|
||||
local f_asset=$1
|
||||
local f_currency=$2
|
||||
local f_min=$3
|
||||
# Optional time from min before sould be calculated (to be able to calculate from 5 min before to 10 minutes before)
|
||||
local f_min_from=$4
|
||||
|
||||
# clean up global variable (maybe used in runs before)
|
||||
f_exchange_rate_diff_percentage=""
|
||||
|
||||
local f_asset_hist_file="asset-histories/${f_asset}${f_currency}.history.csv"
|
||||
if [ -s "f_asset_hist_file" ]
|
||||
then
|
||||
g_echo_note "${f_asset}: No or empty histfile(${f_asset_hist_file}) found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# prepare date
|
||||
if [ -n "${f_min_from}" ]
|
||||
then
|
||||
local f_min_date_from=$(date "+%F %H:%M:" --date="-${f_min_from} minutes")
|
||||
f_min=$((f_min+f_min_from))
|
||||
else
|
||||
local f_min_date_from=$(date "+%F %H:%M:")
|
||||
fi
|
||||
local f_min_date=$(date "+%F %H:%M:" --date="-${f_min} minutes")
|
||||
|
||||
if [ -z "${f_min_date}" ]
|
||||
then
|
||||
g_echo_warn "${f_asset}: Error while calculating date ${f_min} before"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get current exchange rate
|
||||
local f_current_exchange_rate=$(egrep "^${f_min_date_from}" ${f_asset_hist_file} | cut -d, -f2)
|
||||
if [ -z "${f_current_exchange_rate}" ]
|
||||
then
|
||||
g_echo_note "${f_asset}: From rate $f_min_from ${f_min_date_from} not found in ${f_asset_hist_file}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get exchange rate defined minutes before
|
||||
local f_min_before_exchange_rate=$(egrep "^${f_min_date}" ${f_asset_hist_file} | cut -d, -f2)
|
||||
if [ -z "${f_min_before_exchange_rate}" ]
|
||||
then
|
||||
g_echo_note "${f_asset}: Rate ${f_min} minutes ago not found in ${f_asset_hist_file}"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# calculate difference in percentage between current rate and rate defined minutes before
|
||||
f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_min_before_exchange_rate} ${f_current_exchange_rate})
|
||||
if [ -z "$f_exchange_rate_diff_percentage" ]
|
||||
then
|
||||
g_echo_warn "${f_asset}: Calculating difference between rate ${f_min} minutes ago (${min_before_exchange_rate}) and current (${m_current_exchange_rate}) in percentage failed"
|
||||
return 3
|
||||
fi
|
||||
|
||||
# give back percentage
|
||||
g_echo_note "${f_asset}: difference from ${f_current_exchange_rate} from ${f_min_date_from} and ${f_min_date} ${f_min_before_exchange_rate}: ${f_exchange_rate_diff_percentage}%"
|
||||
return 0
|
||||
}
|
@ -17,23 +17,19 @@ function get_vars_from_csv {
|
||||
|
||||
readarray -d "," -t f_last_line_array < <(echo "0,${f_last_line}")
|
||||
|
||||
# basics
|
||||
get_var_from_line date 1
|
||||
get_var_from_line price 2
|
||||
get_var_from_line price_change 3
|
||||
|
||||
# MACD EMA
|
||||
get_var_from_line ema12 4
|
||||
get_var_from_line ema26 5
|
||||
|
||||
# MACD
|
||||
get_var_from_line macd_histogram 8
|
||||
get_var_from_line macd_signal_relation 9
|
||||
f_macd_histogram_relation=$(echo "${f_macd_signal_relation}" | cut -d\| -f1)
|
||||
[ -z "$f_macd_histogram_relation" ] && return 1
|
||||
f_macd_histogram_signal=$(echo "${f_macd_signal_relation}" | cut -d\| -f2)
|
||||
|
||||
# rsi
|
||||
get_var_from_line rsi5 10
|
||||
get_var_from_line rsi14 11
|
||||
get_var_from_line rsi21 12
|
||||
@ -43,36 +39,18 @@ function get_vars_from_csv {
|
||||
get_var_from_line rsi240 16
|
||||
get_var_from_line rsi420 17
|
||||
|
||||
# price changes
|
||||
get_var_from_line price_change_1_day 18
|
||||
get_var_from_line price_change_7_day 19
|
||||
get_var_from_line price_change_14_day 20
|
||||
get_var_from_line price_change_30_day 21
|
||||
get_var_from_line price_change_1_year 22
|
||||
|
||||
# marketcap
|
||||
get_var_from_line marketcap_change_1_day 23
|
||||
|
||||
# range and fibonacci
|
||||
get_var_from_line range_periods 24
|
||||
get_var_from_line lowest_in_range 25
|
||||
get_var_from_line highest_in_range 26
|
||||
get_var_from_line pivot_point 27
|
||||
get_var_from_line support1 28
|
||||
get_var_from_line resist1 29
|
||||
get_var_from_line golden_pocket_support 30
|
||||
get_var_from_line golden_pocket_resist 31
|
||||
get_var_from_line golden_pocket65_support 32
|
||||
get_var_from_line golden_pocket65_resist 33
|
||||
get_var_from_line support3 34
|
||||
get_var_from_line resist3 35
|
||||
|
||||
# EMAs
|
||||
get_var_from_line ema50 36
|
||||
get_var_from_line ema100 37
|
||||
get_var_from_line ema200 38
|
||||
get_var_from_line ema800 39
|
||||
|
||||
get_var_from_line fibo60 24
|
||||
get_var_from_line fibo168 25
|
||||
get_var_from_line fibo672 26
|
||||
get_var_from_line fibo8064 27
|
||||
}
|
||||
|
||||
function get_var_from_line {
|
||||
|
@ -1,11 +1,6 @@
|
||||
function market_performance {
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
if find MARKET_PERFORMANCE.csv -mmin -${INTERVAL_MIN} | grep -q "MARKET_PERFORMANCE.csv"
|
||||
then
|
||||
g_echo_note "MARKET_PERFORMANCE.csv already downloaded in the last ${INTERVAL_MIN} minutes"
|
||||
return 0
|
||||
fi
|
||||
|
||||
## function for scoring limits set in config up or down by specific (market) facts
|
||||
# generates variable f_market_performance
|
||||
@ -69,12 +64,12 @@ function market_performance {
|
||||
# day average 1 week ago
|
||||
local f_from=$(grep "^$(date "+%Y-%m-%d" -d "last week") " asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
# fallback this or last month
|
||||
#[ -z "${f_from}" ] && f_from=$(grep "^$(date "+%Y-%m-")" asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
#[ -z "${f_from}" ] && f_from=$(grep "^$(date "+%Y-%m-" -d "last month")" asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
[ -z "${f_from}" ] && f_from=$(grep "^$(date "+%Y-%m-")" asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
[ -z "${f_from}" ] && f_from=$(grep "^$(date "+%Y-%m-" -d "last month")" asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
# if no data
|
||||
[ -z "${f_from}" ] && f_from=0
|
||||
# middle of latest 10 values
|
||||
local f_to=$(tail -n 10 asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
# latest value
|
||||
local f_to=$(tail -n 1 asset-histories/${f_INDEX}-INDEX.history.csv | cut -d, -f2)
|
||||
[ -z "${f_to}" ] && f_to=0
|
||||
if [ ${f_to} == "0" ] || [ ${f_from} == "0" ]
|
||||
then
|
||||
@ -132,25 +127,29 @@ function market_performance {
|
||||
f_index_performance_csv="${f_index_performance_csv},${f_index_performance}"
|
||||
done
|
||||
|
||||
# price performance bitcoin
|
||||
#local f_from=$(tail -n 48 asset-histories/BTC${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
#local f_to=$(tail -n 24 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
#local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to})
|
||||
#local f_btc_performance=${f_exchange_rate_diff_percentage}
|
||||
local f_btc_performance=$(jq -r '.[] |select(.symbol=="btc")|(.price_change_percentage_7d_in_currency)' COINGECKO_GET_ASSETS_CMD_OUT)
|
||||
# price performance bitcoin (last 48 intervals)
|
||||
#local f_from=$(tail -n 48 asset-histories/BTC${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2)
|
||||
#local f_to=$(tail -n 1 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2)
|
||||
local f_from=$(tail -n 48 asset-histories/BTC${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
local f_to=$(tail -n 24 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to})
|
||||
#get_rate_percentage_min_before_and_now BTC ${CURRENCY} 360 || return 1
|
||||
local f_btc_performance=${f_exchange_rate_diff_percentage}
|
||||
|
||||
# price performance ethereum
|
||||
#local f_from=$(tail -n 48 asset-histories/ETH${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
#local f_to=$(tail -n 24 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
#local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to})
|
||||
#local f_eth_performance=${f_exchange_rate_diff_percentage}
|
||||
local f_eth_performance=$(jq -r '.[] |select(.symbol=="eth")|(.price_change_percentage_7d_in_currency)' COINGECKO_GET_ASSETS_CMD_OUT)
|
||||
# price performance ethereum (last 48 intervals)
|
||||
#get_rate_percentage_min_before_and_now ETH ${CURRENCY} 360 || return 1
|
||||
#local f_from=$(tail -n 48 asset-histories/ETH${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2)
|
||||
#local f_to=$(tail -n 1 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2)
|
||||
local f_from=$(tail -n 48 asset-histories/ETH${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
local f_to=$(tail -n 24 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }')
|
||||
local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to})
|
||||
local f_eth_performance=${f_exchange_rate_diff_percentage}
|
||||
|
||||
# hourly price performance over TOP 250 marketcap by coingecko
|
||||
local f_top250_marketcap_performance=$(jq -r ".[].price_change_percentage_1h_in_currency" COINGECKO_GET_ASSETS_CMD_OUT | awk '{ SUM += $1} END { printf("%.2f", SUM/250) }')
|
||||
|
||||
## calculate market performance
|
||||
f_market_performance=$(echo "scale=2; (${f_btc_forecast} + ${f_eth_forecast} + ${f_index_performance_added} + ${f_btc_performance} + ${f_eth_performance} + ${f_top250_marketcap_performance})" | bc -l | sed -r 's/^(-?)\./\10./' | xargs printf "%.2f")
|
||||
f_market_performance=$(echo "scale=2; (${f_btc_forecast} + ${f_eth_forecast} + ${f_index_performance_added} + ${f_btc_performance} + ${f_eth_performance} + ${f_top250_marketcap_performance})" | bc -l | sed -r 's/^(-?)\./\10./')
|
||||
local f_date=$(g_date_print)
|
||||
echo "${f_date} Market Performance: ${f_market_performance}%; BTC forecast: ${f_btc_forecast}%; ETH forecast: ${f_eth_forecast}%; ${f_index_performance_txt}BTC: ${f_btc_performance}%; ETH: ${f_eth_performance}%; TOP250 Marketcap: ${f_top250_marketcap_performance}%" >>MARKET_PERFORMANCE
|
||||
local f_indexlistcsv=$(echo "$f_indexlist" | perl -pe 's/\n/,/g; s/ +/,/g; s/,+/,/g')
|
||||
|
@ -1,4 +1,24 @@
|
||||
|
||||
function genchart {
|
||||
local lastmark=0
|
||||
local mark=""
|
||||
local file="$1"
|
||||
local highest=$(sort -n "${file}" | tail -n1 | sed s/^-//)
|
||||
local lowest=$(sort -n "${file}" | head -n1 | sed s/^-//)
|
||||
local divideby=$(echo "$highest+$lowest" | bc -l)
|
||||
local color="green"
|
||||
tail -n1 "${file}" | grep -q "^-" && color="red"
|
||||
|
||||
echo "<div id='${file}'>
|
||||
<table class='charts-css line show-data-on-hover show-heading'><caption> $file </caption>"
|
||||
for mark in $(cat "${file}")
|
||||
do
|
||||
echo "<tr><td style='--color: $color; --start: calc( ($lastmark + $lowest) / $divideby ); --end: calc( ( $mark + $lowest) / $divideby );'> <span class='tooltip'> ${mark} % </span> </td></tr>"
|
||||
lastmark=${mark}
|
||||
done
|
||||
echo "</table></div>"
|
||||
}
|
||||
|
||||
function webpage {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
@ -7,18 +27,17 @@ function webpage {
|
||||
[ -e ../charts.min.css ] || wget -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O ../charts.min.css
|
||||
|
||||
# create status webpage
|
||||
echo "<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<meta http-equiv='refresh' content='${INTERVAL}'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' href='/browser.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/charts.min.css'>
|
||||
<title>Dabo! on ${STOCK_EXCHANGE} - ${URL}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)</h1>
|
||||
<h1>Last update $(date '+%F %T')</h1>" >../index.html.tmp
|
||||
echo '<html><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="60" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="/browser.css">
|
||||
<link rel="stylesheet" type="text/css" href="/charts.min.css">' >../index.html.tmp
|
||||
echo "<title>Dabo! on ${STOCK_EXCHANGE} - ${URL}</title>
|
||||
</head><body>" >>../index.html.tmp
|
||||
echo "<h1>State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)</h1>
|
||||
<h1>Last update $(date "+%F %T")</h1>" >>../index.html.tmp
|
||||
|
||||
|
||||
local f_SPOT_BALANCE=$(tail -n1 "asset-histories/BALANCESPOT${CURRENCY}.history.csv" | cut -d, -f2)
|
||||
local f_COMPLETE_BALANCE=$(tail -n1 "asset-histories/BALANCECOMPLETE${CURRENCY}.history.csv" | cut -d, -f2)
|
||||
@ -84,7 +103,7 @@ function webpage {
|
||||
|
||||
|
||||
echo '<h2>Open Trades (Invested Assets)</h2>' >>../index.html.tmp
|
||||
echo "<table width='100%'>" >>../index.html.tmp
|
||||
echo "<table>" >>../index.html.tmp
|
||||
local line
|
||||
cat EXCHANGE_GET_BALANCES_CMD_OUT | grep -v ${CURRENCY} | sort | while read line
|
||||
do
|
||||
@ -98,19 +117,7 @@ function webpage {
|
||||
echo "</table>" >>../index.html.tmp
|
||||
|
||||
echo "<h2>Market Performance ( $(cat MARKET_PERFORMANCE_LATEST)%)</h2>" >>../index.html.tmp
|
||||
#echo "<table width='100%'><tr><td><details><summary>Charts</summary>" >>../index.html.tmp
|
||||
echo "<details><summary>Charts</summary>" >>../index.html.tmp
|
||||
echo "Krypto" >>../index.html.tmp
|
||||
genchart MARKET_PERFORMANCE.csv 50 2,3,4,5,6,7 red-or-green,gold,royalblue,lightyellow,MediumSlateBlue,Sienna >>../index.html.tmp
|
||||
echo "Commodities" >>../index.html.tmp
|
||||
genchart MARKET_PERFORMANCE.csv 50 2,12,10,13 red-or-green,gold,SandyBrown,Sienna >>../index.html.tmp
|
||||
echo "World Economic data" >>../index.html.tmp
|
||||
genchart MARKET_PERFORMANCE.csv 50 2,11,15 red-or-green,Yellow,Sienna >>../index.html.tmp
|
||||
echo "US Economic data" >>../index.html.tmp
|
||||
genchart MARKET_PERFORMANCE.csv 50 2,8,17,16,18,19,20,21,14,9 red-or-green,OliveDrab,Yellow,Orange,DeepSkyBlue,DarkMagenta,PeachPuff,PaleTurquoise,Pink,PapayaWhip >>../index.html.tmp
|
||||
#echo "</details></td></tr></table>" >>../index.html.tmp
|
||||
echo "</details>" >>../index.html.tmp
|
||||
echo "<details><summary>Table</summary><table width='100%'>" >>../index.html.tmp
|
||||
echo "<table>" >>../index.html.tmp
|
||||
echo "<tr>" >>../index.html.tmp
|
||||
head -n1 MARKET_PERFORMANCE.csv | perl -pe 's/,/\n/g' | tr [:lower:] [:upper:] | while read f_mperfcol
|
||||
do
|
||||
@ -135,20 +142,35 @@ function webpage {
|
||||
echo "</tr>" >>../index.html.tmp
|
||||
done
|
||||
|
||||
echo "</table></details>" >>../index.html.tmp
|
||||
echo "</table>" >>../index.html.tmp
|
||||
echo "<a href=\"botdata/MARKET_PERFORMANCE.csv\">Complete list</a>" >>../index.html.tmp
|
||||
|
||||
|
||||
echo "<h2>Top/Flop</h2>" >>../index.html.tmp
|
||||
ls -1 trade-histories/*.result | cut -d . -f3-6 | sort -u | while read f_asset_results
|
||||
do
|
||||
f_asset=$(echo ${f_asset_results} | cut -d\- -f1)
|
||||
echo $(cat trade-histories/*${f_asset_results} | awk "{ SUM += \$1} END { printf(\"%.2f\", SUM)}") >trade-histories/${f_asset}.complete_result
|
||||
done
|
||||
echo "<h3>Top 10</h3>" >>../index.html.tmp
|
||||
grep [0-9] trade-histories/*.complete_result | sort -t: -k2 -rn | head -n 10 | cut -d/ -f2 | perl -pe 's/\.complete_result:/ /; s/$/%<br>/' >>../index.html.tmp
|
||||
|
||||
echo "<h3>Flop 10</h3>" >>../index.html.tmp
|
||||
grep [0-9] trade-histories/*.complete_result | sort -t: -k2 -n | head -n 10 | cut -d/ -f2 | perl -pe 's/\.complete_result:/ /; s/$/%<br>/' >>../index.html.tmp
|
||||
|
||||
|
||||
echo '<h2>Latest trades</h2>' >>../index.html.tmp
|
||||
echo '<h3>Open</h3>' >>../index.html.tmp
|
||||
|
||||
echo "<table width='100%'><tr>" >>../index.html.tmp
|
||||
echo "<table><tr>" >>../index.html.tmp
|
||||
echo "<td>Date</td>
|
||||
<td>Asset</td>
|
||||
<td>Action</td>
|
||||
<td>${CURRENCY} Quantity</td>
|
||||
<td>${CURRENCY} Price</td>
|
||||
<td>Commission</td>
|
||||
<td>Comment</td></tr>" >>../index.html.tmp
|
||||
<td>Comment</td>
|
||||
<td>Chart</td></tr>" >>../index.html.tmp
|
||||
|
||||
local f_trade_file
|
||||
for f_trade_file in $(ls -t trade-histories/trade-*-open.history.csv 2>/dev/null)
|
||||
@ -163,23 +185,24 @@ function webpage {
|
||||
<td>$(echo ${tradeline} | cut -d, -f5)</td>
|
||||
<td>$(echo ${tradeline} | cut -d, -f6)</td>
|
||||
<td>$(echo ${tradeline} | cut -d, -f7,8,9,10,11,12,13,14,15)</td>
|
||||
</tr>" >>../index.html.tmp
|
||||
echo "<tr><td colspan='7'><details><summary>Chart</summary>" >>../index.html.tmp
|
||||
<td width='800'>" >>../index.html.tmp
|
||||
genchart "$interimfile" >>../index.html.tmp
|
||||
echo "</details></td></tr>" >>../index.html.tmp
|
||||
echo "</td>
|
||||
</tr>" >>../index.html.tmp
|
||||
done
|
||||
echo "</table>" >>../index.html.tmp
|
||||
|
||||
echo '<h3>Closed</h3>' >>../index.html.tmp
|
||||
|
||||
echo "<table width='100%'><tr>" >>../index.html.tmp
|
||||
echo "<table><tr>" >>../index.html.tmp
|
||||
echo "<td>Date</td>
|
||||
<td>Asset</td>
|
||||
<td>Action</td>
|
||||
<td>${CURRENCY} Quantity</td>
|
||||
<td>${CURRENCY} Price (result)</td>
|
||||
<td>Commission</td>
|
||||
<td>Comment</td></tr>" >>../index.html.tmp
|
||||
<td>Comment</td>
|
||||
<td>Chart</td></tr>" >>../index.html.tmp
|
||||
|
||||
for f_trade_file in $(ls -t trade-histories/trade-*-closed.history.csv 2>/dev/null | head -n 50)
|
||||
do
|
||||
@ -188,12 +211,10 @@ function webpage {
|
||||
do
|
||||
local f_action=$(echo ${tradeline} | cut -d, -f2)
|
||||
local f_price=$(echo ${tradeline} | cut -d, -f5)
|
||||
local tradedate=$(echo ${tradeline} | cut -d, -f1 | perl -pe 's/_([0-9][0-9])-([0-9][0-9])-([0-9][0-9])/ $1:$2/')
|
||||
|
||||
if echo ${f_action} | grep -q buy
|
||||
then
|
||||
echo ${f_price} >${g_tmp}/buyprice
|
||||
local tradedatebuy=${tradedate}
|
||||
fi
|
||||
|
||||
if echo ${f_action} | grep -q sell
|
||||
@ -210,43 +231,30 @@ function webpage {
|
||||
fi
|
||||
local asset=$(echo ${f_trade_file} | cut -d. -f3 | cut -d- -f1)
|
||||
interimfile=$(echo ${f_trade_file} | sed 's/closed\.history\.csv/interim\.history\.csv/')
|
||||
echo "<td>${tradedate}</td>
|
||||
echo "<td>$(echo ${tradeline} | cut -d, -f1)</td>
|
||||
<td><a href=\"botdata/asset-histories/${asset}.history.csv\">${asset}</a> <a href=\"https://www.coingecko.com/de/munze/$(egrep -i ^$(echo ${asset} | sed "s/${CURRENCY}$//"), COINGECKO_IDS | cut -d, -f2 )\">🔗</a></td>
|
||||
<td>${f_action}</td>
|
||||
<td>$(echo ${tradeline} | cut -d, -f4)</td>
|
||||
<td>${f_price}</td>
|
||||
<td>$(echo ${tradeline} | cut -d, -f6)</td>
|
||||
<td>$(echo ${tradeline} | cut -d, -f7,8,9,10,11,12,13,14,15)</td> ">>../index.html.tmp
|
||||
if echo ${f_action} | grep -q sell
|
||||
then
|
||||
echo "<tr><td colspan='7'><details><summary>Charts</summary>" >>../index.html.tmp
|
||||
local tradeintervals=$(cat ${interimfile} | wc -l)
|
||||
head -n1 asset-histories/${asset}.history.csv >${g_tmp}/trade.csv
|
||||
grep -A ${tradeintervals} "${tradedatebuy}:" asset-histories/${asset}.history.csv >>${g_tmp}/trade.csv
|
||||
echo "Price, EMA, Levels" >>../index.html.tmp
|
||||
genchart "${g_tmp}/trade.csv" ${tradeintervals} 2,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 >>../index.html.tmp
|
||||
echo "MACD" >>../index.html.tmp
|
||||
genchart "${g_tmp}/trade.csv" ${tradeintervals} 8,6,7 >>../index.html.tmp
|
||||
echo "RSIs" >>../index.html.tmp
|
||||
genchart "${g_tmp}/trade.csv" ${tradeintervals} 10,11,12,14,15,16,17,13 >>../index.html.tmp
|
||||
|
||||
echo "</details></td></tr>" >>../index.html.tmp
|
||||
else
|
||||
echo "</tr>" >>../index.html.tmp
|
||||
fi
|
||||
<td>$(echo ${tradeline} | cut -d, -f7,8,9,10,11,12,13,14,15)</td>
|
||||
<td width='800'> ">>../index.html.tmp
|
||||
echo ${f_action} | grep -q sell && genchart "$interimfile" >>../index.html.tmp
|
||||
echo "</td>
|
||||
</tr>" >>../index.html.tmp
|
||||
done
|
||||
done
|
||||
echo "</table>" >>../index.html.tmp
|
||||
|
||||
|
||||
|
||||
#echo "<h2>Current config</h2>" >>../index.html.tmp
|
||||
#echo "<pre>$(cat ../../dabo-bot.conf | perl -pe 's/\</</g; s/\>/>/g;')</pre>" >>../index.html.tmp
|
||||
echo "<h2>Current config</h2>" >>../index.html.tmp
|
||||
echo "<pre>$(cat ../../dabo-bot.conf | perl -pe 's/\</</g; s/\>/>/g;')</pre>" >>../index.html.tmp
|
||||
|
||||
|
||||
|
||||
echo '<h2>Available Assets and histories</h2>' >>../index.html.tmp
|
||||
echo "<table width='100%'><tr>" >>../index.html.tmp
|
||||
echo "<table><tr>" >>../index.html.tmp
|
||||
echo "<tr><td>Asset</td><td>Date</td><td>Price ${CURRENCY}</td><td>24h change (USD)</td></tr>" >>../index.html.tmp
|
||||
local asset
|
||||
cat ASSETS | egrep -v "${BLACKLIST}" | sort | while read asset
|
||||
@ -255,36 +263,15 @@ function webpage {
|
||||
echo "<td><a href=\"botdata/asset-histories/${asset}.history.csv\">${asset}</a> <a href=\"https://www.coingecko.com/de/munze/$(egrep -i ^$(echo ${asset} | sed "s/${CURRENCY}$//"), COINGECKO_IDS | cut -d, -f2 )\">🔗</a></td>" >>../index.html.tmp
|
||||
kcurrency=$(echo ${asset} | sed "s/${CURRENCY}//")
|
||||
#get_rate_percentage_min_before_and_now ${kcurrency} ${CURRENCY} 1440
|
||||
local assetin=($(cat asset-histories/${asset}.history.csv | egrep -v "0.00000000$" | tail -n2 | head -n1 | sed 's/,/ /g'))
|
||||
echo "<td>${assetin[0]} ${assetin[1]}</td>
|
||||
<td>${CURRENCY} ${assetin[2]}</td>
|
||||
local asset=($(cat asset-histories/${asset}.history.csv | egrep -v "0.00000000$" | tail -n2 | head -n1 | sed 's/,/ /g'))
|
||||
echo "
|
||||
<td>${asset[0]} ${asset[1]}</td>
|
||||
<td>${CURRENCY} ${asset[2]}</td>
|
||||
<td> $(grep "^$kcurrency," ASSET_PRICE_CHANGE_PERCENTAGE_24H | cut -d, -f2)%</td>
|
||||
</tr><tr><td colspan='4'>" >>../index.html.tmp
|
||||
echo "<details><summary>${asset} Charts</summary>" >>../index.html.tmp
|
||||
echo "Price, EMA, Levels" >>../index.html.tmp
|
||||
genchart asset-histories/${asset}.history.csv 50 2,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 >>../index.html.tmp
|
||||
echo "MACD" >>../index.html.tmp
|
||||
genchart asset-histories/${asset}.history.csv 50 8,6,7 >>../index.html.tmp
|
||||
echo "RSIs" >>../index.html.tmp
|
||||
genchart asset-histories/${asset}.history.csv 50 10,11,12,14,15,16,17,13 >>../index.html.tmp
|
||||
echo "</details></td></tr>" >>../index.html.tmp
|
||||
|
||||
</tr>" >>../index.html.tmp
|
||||
done
|
||||
echo "</table>" >>../index.html.tmp
|
||||
|
||||
echo "<h2>Top/Flop</h2>" >>../index.html.tmp
|
||||
ls -1 trade-histories/*.result | cut -d . -f3-6 | sort -u | while read f_asset_results
|
||||
do
|
||||
f_asset=$(echo ${f_asset_results} | cut -d\- -f1)
|
||||
echo $(cat trade-histories/*${f_asset_results} | awk "{ SUM += \$1} END { printf(\"%.2f\", SUM)}") >trade-histories/${f_asset}.complete_result
|
||||
done
|
||||
echo "<h3>Top 10</h3>" >>../index.html.tmp
|
||||
grep [0-9] trade-histories/*.complete_result | sort -t: -k2 -rn | head -n 10 | cut -d/ -f2 | perl -pe 's/\.complete_result:/ /; s/$/%<br>/' >>../index.html.tmp
|
||||
|
||||
echo "<h3>Flop 10</h3>" >>../index.html.tmp
|
||||
grep [0-9] trade-histories/*.complete_result | sort -t: -k2 -n | head -n 10 | cut -d/ -f2 | perl -pe 's/\.complete_result:/ /; s/$/%<br>/' >>../index.html.tmp
|
||||
|
||||
|
||||
echo '<h2>Complete trading histories</h2>' >>../index.html.tmp
|
||||
echo "<table>" >>../index.html.tmp
|
||||
find trade-histories -type f -name *.history.csv | cut -d/ -f2 | cut -d. -f1 | sort | while read asset
|
||||
@ -297,8 +284,4 @@ function webpage {
|
||||
# color magic
|
||||
cat ../index.html.tmp | perl -pe 's/ (\-[0-9]+\.[0-9]+\%)/<font color=red>$1<\/font>/g; s/ ([0-9]+\.[0-9]+\%)/<font color=green>$1<\/font>/g;' >../index.html
|
||||
#mv ../index.html.tmp ../index.html
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@ finished"
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,10 @@
|
||||
/* CSS Reset
|
||||
================================================== */
|
||||
|
||||
html,body,table,div,span,h1,h6,p,a,ul,li,audio {
|
||||
html,body,div,span,h1,h6,p,a,ul,li,audio {
|
||||
border:0;
|
||||
font:inherit;
|
||||
font-size:16px;
|
||||
font-size:25px;
|
||||
margin:0;
|
||||
padding:0;
|
||||
vertical-align:baseline;
|
||||
@ -33,7 +33,7 @@ body { line-height:1; }
|
||||
html,body {
|
||||
background-color:#000000;
|
||||
color:#808080;
|
||||
font:16px Helvetica, Arial, sans-serif;
|
||||
font:24px Helvetica, Arial, sans-serif;
|
||||
font-weight:300;
|
||||
padding:5px 0;
|
||||
}
|
||||
@ -48,8 +48,8 @@ h2 { font-size:32px; line-height:44px; margin:20px 0 0; text-align: left; font-w
|
||||
/* Links
|
||||
================================================== */
|
||||
|
||||
summary,a,a:visited { color:#808080; outline:0; text-decoration:none; }
|
||||
a:hover,a:focus,li,summary:hover,li,summary:focus,label:hover { color:#bbb; }
|
||||
a,a:visited { color:#808080; outline:0; text-decoration:none; }
|
||||
a:hover,a:focus,li:hover,li:focus,label:hover { color:#bbb; }
|
||||
p a,p a:visited { line-height:inherit; }
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ html[data-useragent*="Chrome"][data-useragent*="Mobile"] audio { margin-left:4px
|
||||
|
||||
audio { width:92%; }
|
||||
|
||||
/* for VPN Login */
|
||||
/* z.B. für VPN Login */
|
||||
input {
|
||||
width: 100%;
|
||||
font-size:25px;
|
||||
@ -207,18 +207,11 @@ pre,#footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
tr:hover {background-color: #191919;}
|
||||
|
||||
#noborder {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
}
|
||||
tr:hover {background-color: coral;}
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid;
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user