fixes,..
This commit is contained in:
parent
0341ba683a
commit
2417df2317
@ -39,7 +39,7 @@ function get_bitpanda_api_transactions {
|
|||||||
.time.date_iso8601 + ",leverage-" + .type + "," + .cryptocoin_symbol + "," + .amount_cryptocoin + ",EUR," + .amount_fiat + ",Bitpanda"
|
.time.date_iso8601 + ",leverage-" + .type + "," + .cryptocoin_symbol + "," + .amount_cryptocoin + ",EUR," + .amount_fiat + ",Bitpanda"
|
||||||
' BITPANDA_trades.json >>BITPANDA.csv.tmp
|
' BITPANDA_trades.json >>BITPANDA.csv.tmp
|
||||||
# Workaround fpr staking-rewards (not availabpe per API yet (https://help.blockpit.io/hc/de-at/articles/360011790820-Wie-importiere-ich-Daten-mittels-Bitpanda-API-Key)
|
# Workaround fpr staking-rewards (not availabpe per API yet (https://help.blockpit.io/hc/de-at/articles/360011790820-Wie-importiere-ich-Daten-mittels-Bitpanda-API-Key)
|
||||||
[ -s bitpanda-export.csv ] && cat bitpanda-export.csv | grep reward,incoming | awk -F, '{print $2",reward-staking,"$8","$9",EUR,"$5",Bitpanda"}' >>BITPANDA.csv.tmp
|
[ -s bitpanda-export.csv ] && cat bitpanda-export.csv | grep reward,incoming | awk -F, '{print $2",reward-staking,"$8","$7",EUR,"$5",Bitpanda"}' >>BITPANDA.csv.tmp
|
||||||
|
|
||||||
cat BITPANDA.csv.tmp | grep -v ",reward.best," | sort >TRANSACTIONS-BITPANDA.csv
|
cat BITPANDA.csv.tmp | grep -v ",reward.best," | sort >TRANSACTIONS-BITPANDA.csv
|
||||||
rm -f BITPANDA.csv.tmp
|
rm -f BITPANDA.csv.tmp
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
function webpage {
|
function webpage {
|
||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
|
|
||||||
|
webpage_transactions
|
||||||
|
|
||||||
# Get charts.css
|
# Get charts.css
|
||||||
[ -e ../charts.min.css ] || wget ${g_wget_opts} -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O ../charts.min.css
|
[ -e ../charts.min.css ] || wget ${g_wget_opts} -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O ../charts.min.css
|
||||||
@ -20,6 +21,9 @@ function webpage {
|
|||||||
<h1>State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)</h1>
|
<h1>State of Dabo-Bot! on ${STOCK_EXCHANGE} - ${URL} (ReadOnly)</h1>
|
||||||
<h1>Last update $(date '+%F %T')</h1>" >../index.html.tmp
|
<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
|
||||||
|
|
||||||
local f_SPOT_BALANCE=$(tail -n1 "asset-histories/BALANCESPOT${CURRENCY}.history.csv" | cut -d, -f2)
|
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)
|
local f_COMPLETE_BALANCE=$(tail -n1 "asset-histories/BALANCECOMPLETE${CURRENCY}.history.csv" | cut -d, -f2)
|
||||||
echo '<h2>Overview</h2>' >>../index.html.tmp
|
echo '<h2>Overview</h2>' >>../index.html.tmp
|
||||||
@ -82,8 +86,7 @@ function webpage {
|
|||||||
</tr>
|
</tr>
|
||||||
</table>" >>../index.html.tmp
|
</table>" >>../index.html.tmp
|
||||||
|
|
||||||
|
echo '<h2>Open Positions</h2>' >>../index.html.tmp
|
||||||
echo '<h2>Open Trades (Invested Assets)</h2>' >>../index.html.tmp
|
|
||||||
echo "<table width='100%'>" >>../index.html.tmp
|
echo "<table width='100%'>" >>../index.html.tmp
|
||||||
local line
|
local line
|
||||||
cat EXCHANGE_GET_BALANCES_CMD_OUT | grep -v ${CURRENCY} | sort | while read line
|
cat EXCHANGE_GET_BALANCES_CMD_OUT | grep -v ${CURRENCY} | sort | while read line
|
||||||
@ -97,6 +100,45 @@ function webpage {
|
|||||||
done
|
done
|
||||||
echo "</table>" >>../index.html.tmp
|
echo "</table>" >>../index.html.tmp
|
||||||
|
|
||||||
|
## Open Positions
|
||||||
|
echo "<h2>Open Positions - From Trade Histories</h2>" >>../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
|
||||||
|
rm -f ../index.html.tmp.tmp
|
||||||
|
cat ALL_TRANSACTIONS_OVERVIEW.csv | cut -d, -f2,4 | sort -u | while read f_asset_per_exchange
|
||||||
|
do
|
||||||
|
mapfile -d, -t f_asset_per_exchange_array < <(echo $f_asset_per_exchange)
|
||||||
|
f_asset=${f_asset_per_exchange_array[1]%$'\n'}
|
||||||
|
f_exchange=${f_asset_per_exchange_array[0]}
|
||||||
|
[[ "$f_exchange" =~ JustTrade|Bitpanda ]] || continue
|
||||||
|
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)
|
||||||
|
if ! [ "$f_amount" = 0 ]
|
||||||
|
then
|
||||||
|
currency_converter $f_amount $f_asset $TRANSFER_CURRENCY || continue
|
||||||
|
f_currency_amount=$f_currency_converter_result
|
||||||
|
g_calc "$f_currency_amount+($f_sold)"
|
||||||
|
f_currency_amount=$g_calc_result
|
||||||
|
g_calc "$f_spent-($f_sold)"
|
||||||
|
f_spent=$g_calc_result
|
||||||
|
|
||||||
|
if [ "$f_spent" = 0 ]
|
||||||
|
then
|
||||||
|
f_result_percent=0
|
||||||
|
else
|
||||||
|
g_percentage-diff $f_spent $f_currency_amount
|
||||||
|
f_result_percent=$g_percentage_diff_result
|
||||||
|
fi
|
||||||
|
g_calc "$f_currency_amount-($f_spent)"
|
||||||
|
f_result=$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
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sort -n -k3 -t'>' -r ../index.html.tmp.tmp >>../index.html.tmp
|
||||||
|
rm ../index.html.tmp.tmp
|
||||||
|
echo "</table>" >>../index.html.tmp
|
||||||
|
|
||||||
echo "<h2>Market Performance ( $(cat MARKET_PERFORMANCE_LATEST)%)</h2>" >>../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 "<table width='100%'><tr><td><details><summary>Charts</summary>" >>../index.html.tmp
|
||||||
echo "<details><summary>Charts</summary>" >>../index.html.tmp
|
echo "<details><summary>Charts</summary>" >>../index.html.tmp
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
get_transactions
|
|
||||||
transactions_overview
|
transactions_overview
|
||||||
transactions_summary
|
|
||||||
sleep 3600
|
sleep 3600
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user