diff --git a/dabo/functions/webpage.sh b/dabo/functions/webpage.sh index 29c0cfd..2f71344 100644 --- a/dabo/functions/webpage.sh +++ b/dabo/functions/webpage.sh @@ -22,8 +22,8 @@ function webpage { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" - charts webpage_transactions + get_symbols_ticker # create status webpage echo " @@ -63,7 +63,7 @@ function webpage { " >>../index.html.tmp echo "

Balance in- outflows

" >>../index.html.tmp - echo "" >> ../index.html.tmp + echo "
Time agoBalancein/outPercentage
" >> ../index.html.tmp for f_balance_date in Day Week Month 3Month Year do @@ -82,23 +82,35 @@ function webpage { echo '

Open Positions

' >>../index.html.tmp - echo "
Time agoBalancein/outPercentage
" >>../index.html.tmp + echo "
SymbolAmountEntry PriceCurrent PriceProfit/LossNotes
" >>../index.html.tmp get_position_array - for f_position in "${f_get_positions_array[@]}" + for f_symbol in ${f_symbols_array_trade[@]} do - get_position_line_vars "$f_position" - printf -v f_position_currency_amount %.2f $f_position_currency_amount - printf -v f_position_entry_price %.2f $f_position_entry_price - printf -v f_position_current_price %.2f $f_position_current_price - printf -v f_position_pnl %.2f $f_position_pnl - echo "" >>../index.html.tmp + f_asset=${f_symbol//:$CURRENCY/} + f_asset=${f_asset//\//} + [ -z "${p[${f_asset}_entry_price]}" ] && continue + echo "" >>../index.html.tmp done echo "
SymbolAmountEntry PriceCurrent PriceProfit/LossLiquidation PriceStopLossTakeProfitNotes
$f_position_symbol${CURRENCY} $f_position_currency_amount${CURRENCY} $f_position_entry_price${CURRENCY} $f_position_current_price${CURRENCY} $f_position_pnl ( ${f_position_pnl_percentage}%)$f_position_side ${f_position_leverage}x
$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 '

Open Orders

' >>../index.html.tmp + echo "" >>../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 "" >>../index.html.tmp + done + echo "
SymbolAmountEntry PriceStopLossTakeProfitNotes
$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 + + ## Open Positions echo "

Open Positions - From Trade Histories (daily refresh only)

" >>../index.html.tmp echo "" >>../index.html.tmp - echo "" >>../index.html.tmp + echo "" >>../index.html.tmp rm -f ../index.html.tmp.tmp local f_result_complete=0 local f_spent_complete=0 @@ -114,6 +126,7 @@ function webpage { f_asset=${f_asset_per_exchange_array[1]%$'\n'} f_exchange=${f_asset_per_exchange_array[0]} [[ "$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_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) @@ -156,61 +169,22 @@ function webpage { #f_sold_complete=$g_calc_result printf -v f_sold_complete %.2f $g_calc_result - echo "" >>../index.html.tmp.tmp + echo "" >>../index.html.tmp.tmp fi done g_percentage-diff $f_spent_complete $f_currency_amount_complete f_result_percent_complete=$g_percentage_diff_result + + # ALL Line + echo "" >>../index.html.tmp - echo "" >>../index.html.tmp - sort -n -k3 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp + # Sort by Spent Amount + sort -n -k7 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp rm ../index.html.tmp.tmp echo "
AmountSpent AmountSold AmountProfit/LossAsset AmountExchange
DateAmountSpent AmountSold AmountProfit/LossAsset AmountExchange
$f_currency_amount $TRANSFER_CURRENCY$f_spent $TRANSFER_CURRENCY$f_sold $TRANSFER_CURRENCY$f_result $TRANSFER_CURRENCY ( ${f_result_percent}%)$f_amount $f_asset$f_exchange
$f_date$f_currency_amount $TRANSFER_CURRENCY$f_spent $TRANSFER_CURRENCY$f_sold $TRANSFER_CURRENCY$f_result $TRANSFER_CURRENCY ( ${f_result_percent}%)$f_amount $f_asset$f_exchange
-$f_currency_amount_complete $TRANSFER_CURRENCY$f_spent_complete $TRANSFER_CURRENCY$f_sold_complete $TRANSFER_CURRENCY$f_result_complete $TRANSFER_CURRENCY ( ${f_result_percent_complete}%)ALLALL
$f_currency_amount_complete $TRANSFER_CURRENCY$f_spent_complete $TRANSFER_CURRENCY$f_sold_complete $TRANSFER_CURRENCY$f_result_complete $TRANSFER_CURRENCY ( ${f_result_percent_complete}%)ALLALL
" >>../index.html.tmp fi - echo "

Market Performance ( $(cat MARKET_PERFORMANCE_LATEST)%)

" >>../index.html.tmp - #echo "
Charts" >>../index.html.tmp - echo "
Charts" >>../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 "
" >>../index.html.tmp - echo "" >>../index.html.tmp - echo "
Table" >>../index.html.tmp - echo "" >>../index.html.tmp - head -n1 MARKET_PERFORMANCE.csv | perl -pe 's/,/\n/g' | tr [:lower:] [:upper:] | while read f_mperfcol - do - echo "" >>../index.html.tmp - done - echo "" >>../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 "" >>../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 "" >>../index.html.tmp - else - echo "" >>../index.html.tmp - fi - done - echo "" >>../index.html.tmp - done - - echo "
${f_mperfcol}
${f_mperfcol} ${f_mperfcol}%
" >>../index.html.tmp - echo "Complete list" >>../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