fixed and nicer output, added charts
This commit is contained in:
parent
e15740900a
commit
170ad50652
@ -39,9 +39,7 @@ function webpage {
|
||||
<h1>State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)</h1>
|
||||
<h1>Last update $(date '+%F %T')</h1>" >../index.html.tmp
|
||||
|
||||
# historic overview
|
||||
echo '<a href=TRANSACTIONS_OVERVIEWS.html><h2>Historic Overview</h2></a>' >>../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 "<tr><td>$f_symbol</td><td>${p[${f_asset}_currency_amount]}</td><td>${p[${f_asset}_entry_price]}</td><td>${p[${f_asset}_current_price]}</td><td>${p[${f_asset}_pnl]} ( ${p[${f_asset}_pnl_percentage]}%)</td><td>${p[${f_asset}_liquidation_price]}</td><td>${p[${f_asset}_stoploss_price]}</td><td>${p[${f_asset}_takeprofit_price]}</td><td>${p[${f_asset}_side]} ${p[${f_asset}_leverage]}x</td></tr>" >>../index.html.tmp
|
||||
echo "<tr>
|
||||
<td><a href=\"charts.html?symbol=${f_asset}&time=4h&symbol2=BTCUSDT\" target=\"_blank\" rel=\"noopener noreferrer\">$f_symbol</a></td>
|
||||
<td>${p[${f_asset}_currency_amount]}</td>
|
||||
<td>${p[${f_asset}_entry_price]}</td>
|
||||
<td>${p[${f_asset}_current_price]}</td>
|
||||
<td>${p[${f_asset}_pnl]} ( ${p[${f_asset}_pnl_percentage]}%)</td>
|
||||
<td>${p[${f_asset}_liquidation_price]}</td>
|
||||
<td>${p[${f_asset}_stoploss_price]}</td>
|
||||
<td>${p[${f_asset}_takeprofit_price]}</td>
|
||||
<td>${p[${f_asset}_side]} ${p[${f_asset}_leverage]}x</td>
|
||||
</tr>" >>../index.html.tmp
|
||||
done
|
||||
echo "</table>" >>../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 "<tr><td>$f_symbol</td><td>${o[${f_asset}_amount]}</td><td>${o[${f_asset}_entry_price]}</td><td>${o[${f_asset}_stoplossprice]}</td><td>${o[${f_asset}_takeprofitprice]}</td><td>${o[${f_asset}_type]} ${p[${f_asset}_side]}</td></tr>" >>../index.html.tmp
|
||||
[ "${o[${f_asset}_entry_price]}" = "null" ] && continue
|
||||
echo "<tr>
|
||||
<td><a href=\"charts.html?symbol=${f_asset}&time=4h&symbol2=BTCUSDT\" target=\"_blank\" rel=\"noopener noreferrer\">$f_symbol</a></td>
|
||||
<td>${o[${f_asset}_amount]}</td>
|
||||
<td>${o[${f_asset}_entry_price]}</td>
|
||||
<td>${o[${f_asset}_stoplossprice]}</td>
|
||||
<td>${o[${f_asset}_takeprofitprice]}</td>
|
||||
<td>${o[${f_asset}_type]} ${p[${f_asset}_side]}</td>
|
||||
</tr>" >>../index.html.tmp
|
||||
done
|
||||
echo "</table>" >>../index.html.tmp
|
||||
|
||||
## charts
|
||||
echo '<h2>Charts with local data</h2><p>Click on time units to open chart</p>' >>../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 "<td><a href=\"charts.html?symbol=${f_asset}&time=${f_timeframe}&symbol2=BTCUSDT\" target=\"_blank\" rel=\"noopener noreferrer\"}>${f_timeframe}</a>" >>../index.html.tmp
|
||||
done
|
||||
echo "<br>" >>../index.html.tmp
|
||||
done
|
||||
|
||||
## Open Positions
|
||||
echo "<h2>Open Positions - From Trade Histories (daily refresh only)</h2>" >>../index.html.tmp
|
||||
echo "<h2>Open Positions - from other Exchanges</h2>
|
||||
<p>Crypto-Only from Bitpanda and JustTrade - daily refresh</p>" >>../index.html.tmp
|
||||
echo "<table width='100%'>" >>../index.html.tmp
|
||||
echo "<tr class=\"headline\"><td>Date</td><td>Amount</td><td>Spent Amount</td><td>Sold Amount</td><td>Profit/Loss</td><td>Asset Amount</td><td>Exchange</td></tr>" >>../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 "</table>" >>../index.html.tmp
|
||||
fi
|
||||
|
||||
# Closed positions
|
||||
echo "<h2>Closed Positions and (german) tax declaration notes</h2>" >>../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 "<a href='${f_html}'>$f_name</a><br>" >>../index.html.tmp
|
||||
done
|
||||
echo "$(cat ALL_TRANSACTIONS_OVERVIEW_WARN.csv | cut -d, -f1,2,20)<br>" >>../index.html.tmp
|
||||
|
||||
# THE END
|
||||
echo "</body></html>" >>../index.html.tmp
|
||||
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user