update
This commit is contained in:
parent
ff46ae8e8a
commit
a1c60d1696
@ -22,8 +22,8 @@ function webpage {
|
|||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
|
|
||||||
charts
|
|
||||||
webpage_transactions
|
webpage_transactions
|
||||||
|
get_symbols_ticker
|
||||||
|
|
||||||
# create status webpage
|
# create status webpage
|
||||||
echo "<html>
|
echo "<html>
|
||||||
@ -63,7 +63,7 @@ function webpage {
|
|||||||
</table>" >>../index.html.tmp
|
</table>" >>../index.html.tmp
|
||||||
|
|
||||||
echo "<h2>Balance in- outflows</h2>" >>../index.html.tmp
|
echo "<h2>Balance in- outflows</h2>" >>../index.html.tmp
|
||||||
echo "<table><tr><td><b>Time ago</b><td><b>Balance</b></td><td><b>in/out</b></td><td><b>Percentage</b></td></tr>" >> ../index.html.tmp
|
echo "<table><tr class=\"headline\"><td><b>Time ago</b><td><b>Balance</b></td><td><b>in/out</b></td><td><b>Percentage</b></td></tr>" >> ../index.html.tmp
|
||||||
|
|
||||||
for f_balance_date in Day Week Month 3Month Year
|
for f_balance_date in Day Week Month 3Month Year
|
||||||
do
|
do
|
||||||
@ -82,23 +82,35 @@ function webpage {
|
|||||||
|
|
||||||
|
|
||||||
echo '<h2>Open Positions</h2>' >>../index.html.tmp
|
echo '<h2>Open Positions</h2>' >>../index.html.tmp
|
||||||
echo "<table width='100%'><tr><td>Symbol</td><td>Amount</td><td>Entry Price</td><td>Current Price</td><td>Profit/Loss</td><td>Notes</td></tr>" >>../index.html.tmp
|
echo "<table width='100%'><tr class=\"headline\"><td>Symbol</td><td>Amount</td><td>Entry Price</td><td>Current Price</td><td>Profit/Loss</td><td>Liquidation Price</td><td>StopLoss</td><td>TakeProfit</td><td>Notes</td></tr>" >>../index.html.tmp
|
||||||
get_position_array
|
get_position_array
|
||||||
for f_position in "${f_get_positions_array[@]}"
|
for f_symbol in ${f_symbols_array_trade[@]}
|
||||||
do
|
do
|
||||||
get_position_line_vars "$f_position"
|
f_asset=${f_symbol//:$CURRENCY/}
|
||||||
printf -v f_position_currency_amount %.2f $f_position_currency_amount
|
f_asset=${f_asset//\//}
|
||||||
printf -v f_position_entry_price %.2f $f_position_entry_price
|
[ -z "${p[${f_asset}_entry_price]}" ] && continue
|
||||||
printf -v f_position_current_price %.2f $f_position_current_price
|
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
|
||||||
printf -v f_position_pnl %.2f $f_position_pnl
|
|
||||||
echo "<tr><td>$f_position_symbol</td><td>${CURRENCY} $f_position_currency_amount</td><td>${CURRENCY} $f_position_entry_price</td><td>${CURRENCY} $f_position_current_price</td><td>${CURRENCY} $f_position_pnl ( ${f_position_pnl_percentage}%)</td><td>$f_position_side ${f_position_leverage}x</td></tr>" >>../index.html.tmp
|
|
||||||
done
|
done
|
||||||
echo "</table>" >>../index.html.tmp
|
echo "</table>" >>../index.html.tmp
|
||||||
|
|
||||||
|
|
||||||
|
echo '<h2>Open Orders</h2>' >>../index.html.tmp
|
||||||
|
echo "<table width='100%'><tr class=\"headline\"><td>Symbol</td><td>Amount</td><td>Entry Price</td><td>StopLoss</td><td>TakeProfit</td><td>Notes</td></tr>" >>../index.html.tmp
|
||||||
|
get_orders_array
|
||||||
|
for f_symbol in ${f_symbols_array_trade[@]}
|
||||||
|
do
|
||||||
|
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
|
||||||
|
done
|
||||||
|
echo "</table>" >>../index.html.tmp
|
||||||
|
|
||||||
|
|
||||||
## Open Positions
|
## Open Positions
|
||||||
echo "<h2>Open Positions - From Trade Histories (daily refresh only)</h2>" >>../index.html.tmp
|
echo "<h2>Open Positions - From Trade Histories (daily refresh only)</h2>" >>../index.html.tmp
|
||||||
echo "<table width='100%'>" >>../index.html.tmp
|
echo "<table width='100%'>" >>../index.html.tmp
|
||||||
echo "<tr><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
|
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
|
rm -f ../index.html.tmp.tmp
|
||||||
local f_result_complete=0
|
local f_result_complete=0
|
||||||
local f_spent_complete=0
|
local f_spent_complete=0
|
||||||
@ -114,6 +126,7 @@ function webpage {
|
|||||||
f_asset=${f_asset_per_exchange_array[1]%$'\n'}
|
f_asset=${f_asset_per_exchange_array[1]%$'\n'}
|
||||||
f_exchange=${f_asset_per_exchange_array[0]}
|
f_exchange=${f_asset_per_exchange_array[0]}
|
||||||
[[ "$f_exchange" =~ JustTrade|Bitpanda ]] || continue
|
[[ "$f_exchange" =~ JustTrade|Bitpanda ]] || continue
|
||||||
|
f_date=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f1)
|
||||||
f_amount=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f18)
|
f_amount=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f18)
|
||||||
f_spent=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f20)
|
f_spent=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f20)
|
||||||
f_sold=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f22)
|
f_sold=$(egrep "$f_exchange,.+,$f_asset" ALL_TRANSACTIONS_OVERVIEW.csv | tail -n1 | cut -d, -f22)
|
||||||
@ -156,61 +169,22 @@ function webpage {
|
|||||||
#f_sold_complete=$g_calc_result
|
#f_sold_complete=$g_calc_result
|
||||||
printf -v f_sold_complete %.2f $g_calc_result
|
printf -v f_sold_complete %.2f $g_calc_result
|
||||||
|
|
||||||
echo "<tr><td>$f_currency_amount $TRANSFER_CURRENCY</td><td>$f_spent $TRANSFER_CURRENCY</td><td>$f_sold $TRANSFER_CURRENCY</td><td>$f_result $TRANSFER_CURRENCY ( ${f_result_percent}%)</td><td>$f_amount $f_asset</td><td>$f_exchange</td></tr>" >>../index.html.tmp.tmp
|
echo "<tr><td>$f_date</td><td>$f_currency_amount $TRANSFER_CURRENCY</td><td>$f_spent $TRANSFER_CURRENCY</td><td>$f_sold $TRANSFER_CURRENCY</td><td>$f_result $TRANSFER_CURRENCY ( ${f_result_percent}%)</td><td>$f_amount $f_asset</td><td>$f_exchange</td></tr>" >>../index.html.tmp.tmp
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
g_percentage-diff $f_spent_complete $f_currency_amount_complete
|
g_percentage-diff $f_spent_complete $f_currency_amount_complete
|
||||||
f_result_percent_complete=$g_percentage_diff_result
|
f_result_percent_complete=$g_percentage_diff_result
|
||||||
|
|
||||||
echo "<tr><td>$f_currency_amount_complete $TRANSFER_CURRENCY</td><td>$f_spent_complete $TRANSFER_CURRENCY</td><td>$f_sold_complete $TRANSFER_CURRENCY</td><td>$f_result_complete $TRANSFER_CURRENCY ( ${f_result_percent_complete}%)</td><td>ALL</td><td>ALL</td></tr>" >>../index.html.tmp
|
# ALL Line
|
||||||
sort -n -k3 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp
|
echo "<tr><td>-</td><td>$f_currency_amount_complete $TRANSFER_CURRENCY</td><td>$f_spent_complete $TRANSFER_CURRENCY</td><td>$f_sold_complete $TRANSFER_CURRENCY</td><td>$f_result_complete $TRANSFER_CURRENCY ( ${f_result_percent_complete}%)</td><td>ALL</td><td>ALL</td></tr>" >>../index.html.tmp
|
||||||
|
|
||||||
|
# Sort by Spent Amount
|
||||||
|
sort -n -k7 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp
|
||||||
rm ../index.html.tmp.tmp
|
rm ../index.html.tmp.tmp
|
||||||
echo "</table>" >>../index.html.tmp
|
echo "</table>" >>../index.html.tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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 "<tr>" >>../index.html.tmp
|
|
||||||
head -n1 MARKET_PERFORMANCE.csv | perl -pe 's/,/\n/g' | tr [:lower:] [:upper:] | while read f_mperfcol
|
|
||||||
do
|
|
||||||
echo "<td><b>${f_mperfcol}</b></td>" >>../index.html.tmp
|
|
||||||
done
|
|
||||||
echo "</tr>" >>../index.html.tmp
|
|
||||||
egrep "^[0-9][0-9]" MARKET_PERFORMANCE.csv | tail -n10 | while read f_mperfline
|
|
||||||
do
|
|
||||||
f_mperfline="$(echo ${f_mperfline} | perl -pe 's/ /_/g; s/,/ /g')"
|
|
||||||
echo "<tr>" >>../index.html.tmp
|
|
||||||
#echo "${mperfline}" | perl -pe 's/,/\n/g' | while read f_mperfcol
|
|
||||||
for f_mperfcol in ${f_mperfline}
|
|
||||||
do
|
|
||||||
if echo "${f_mperfcol}" | grep -q ":"
|
|
||||||
then
|
|
||||||
f_mperfcol="$(echo ${f_mperfcol} | perl -pe 's/_/ /')"
|
|
||||||
echo "<td><b>${f_mperfcol}</b></td>" >>../index.html.tmp
|
|
||||||
else
|
|
||||||
echo "<td> ${f_mperfcol}%</td>" >>../index.html.tmp
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "</tr>" >>../index.html.tmp
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "</table></details>" >>../index.html.tmp
|
|
||||||
echo "<a href=\"botdata/MARKET_PERFORMANCE.csv\">Complete list</a>" >>../index.html.tmp
|
|
||||||
|
|
||||||
|
|
||||||
# color magic
|
# 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
|
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