diff --git a/dabo/functions/webpage.sh b/dabo/functions/webpage.sh index 2f71344..47df784 100644 --- a/dabo/functions/webpage.sh +++ b/dabo/functions/webpage.sh @@ -39,9 +39,7 @@ function webpage {

State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)

Last update $(date '+%F %T')

" >../index.html.tmp - # historic overview - echo '

Historic Overview

' >>../index.html.tmp - + # balance local f_USED_BALANCE=$(tail -n1 "asset-histories/BALANCEUSED${CURRENCY}.history.csv" | cut -d, -f2) local f_COMPLETE_BALANCE=$(tail -n1 "asset-histories/BALANCECOMPLETE${CURRENCY}.history.csv" | cut -d, -f2) g_calc "$f_COMPLETE_BALANCE-$f_USED_BALANCE" @@ -89,7 +87,17 @@ function webpage { f_asset=${f_symbol//:$CURRENCY/} f_asset=${f_asset//\//} [ -z "${p[${f_asset}_entry_price]}" ] && continue - echo "$f_symbol${p[${f_asset}_currency_amount]}${p[${f_asset}_entry_price]}${p[${f_asset}_current_price]}${p[${f_asset}_pnl]} ( ${p[${f_asset}_pnl_percentage]}%)${p[${f_asset}_liquidation_price]}${p[${f_asset}_stoploss_price]}${p[${f_asset}_takeprofit_price]}${p[${f_asset}_side]} ${p[${f_asset}_leverage]}x" >>../index.html.tmp + echo " +$f_symbol +${p[${f_asset}_currency_amount]} +${p[${f_asset}_entry_price]} +${p[${f_asset}_current_price]} +${p[${f_asset}_pnl]} ( ${p[${f_asset}_pnl_percentage]}%) +${p[${f_asset}_liquidation_price]} +${p[${f_asset}_stoploss_price]} +${p[${f_asset}_takeprofit_price]} +${p[${f_asset}_side]} ${p[${f_asset}_leverage]}x +" >>../index.html.tmp done echo "" >>../index.html.tmp @@ -102,13 +110,37 @@ function webpage { f_asset=${f_symbol//:$CURRENCY/} f_asset=${f_asset//\//} [ -z "${o[${f_asset}_entry_price]}" ] && continue - echo "$f_symbol${o[${f_asset}_amount]}${o[${f_asset}_entry_price]}${o[${f_asset}_stoplossprice]}${o[${f_asset}_takeprofitprice]}${o[${f_asset}_type]} ${p[${f_asset}_side]}" >>../index.html.tmp + [ "${o[${f_asset}_entry_price]}" = "null" ] && continue + echo " +$f_symbol +${o[${f_asset}_amount]} +${o[${f_asset}_entry_price]} +${o[${f_asset}_stoplossprice]} +${o[${f_asset}_takeprofitprice]} +${o[${f_asset}_type]} ${p[${f_asset}_side]} +" >>../index.html.tmp done echo "" >>../index.html.tmp + ## charts + echo '

Charts with local data

Click on time units to open chart

' >>../index.html.tmp + + local eco_assets=$(echo " $ECO_ASSETS" | sed 's/ / ECONOMY-/g') + for f_symbol in ${f_symbols_array_trade[@]} $eco_assets + do + f_asset=${f_symbol//:$CURRENCY/} + f_asset=${f_asset//\//} + echo "$f_asset: " >>../index.html.tmp + for f_timeframe in 1w 1d 4h 1h 15m + do + echo "${f_timeframe}" >>../index.html.tmp + done + echo "
" >>../index.html.tmp + done ## Open Positions - echo "

Open Positions - From Trade Histories (daily refresh only)

" >>../index.html.tmp + echo "

Open Positions - from other Exchanges

+

Crypto-Only from Bitpanda and JustTrade - daily refresh

" >>../index.html.tmp echo "" >>../index.html.tmp echo "" >>../index.html.tmp rm -f ../index.html.tmp.tmp @@ -118,9 +150,7 @@ function webpage { local f_sold_complete=0 local f_result_percent_complete=0 local f_asset f_exchange f_amount f_spent f_sold f_currency_amount f_result_percent - if [ -s ALL_TRANSACTIONS_OVERVIEW.csv ] - then - for f_asset_per_exchange in $(cat ALL_TRANSACTIONS_OVERVIEW.csv | cut -d, -f2,4 | sort -u) + for f_asset_per_exchange in $(cat ALL_TRANSACTIONS_OVERVIEW.csv 2>/dev/null | cut -d, -f2,4 | sort -u) do mapfile -d, -t f_asset_per_exchange_array < <(echo $f_asset_per_exchange) f_asset=${f_asset_per_exchange_array[1]%$'\n'} @@ -183,7 +213,19 @@ function webpage { sort -n -k7 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp rm ../index.html.tmp.tmp echo "
DateAmountSpent AmountSold AmountProfit/LossAsset AmountExchange
" >>../index.html.tmp - fi + + # Closed positions + echo "

Closed Positions and (german) tax declaration notes

" >>../index.html.tmp + ls ../TRANSACTIONS_OVERVIEW-* | while read f_html + do + f_html=$(basename $f_html) + f_name=$(echo $f_html | cut -d- -f2,3 | cut -d. -f1) + echo "$f_name
" >>../index.html.tmp + done + echo "$(cat ALL_TRANSACTIONS_OVERVIEW_WARN.csv | cut -d, -f1,2,20)
" >>../index.html.tmp + + # THE END + echo "" >>../index.html.tmp # color magic cat ../index.html.tmp | perl -pe 's/ (\-[0-9]+\.[0-9]+\%)/$1<\/font>/g; s/ ([0-9]+\.[0-9]+\%)/$1<\/font>/g;' >../index.html