added formatting and adapted to isin

This commit is contained in:
Linus E 2022-04-19 21:08:47 +02:00
parent 76df6f27be
commit 71fed7fd18

View File

@ -417,9 +417,12 @@ def send_portfolio(message):
bot.send_message(chat_id=user_id, text='You do not have any stocks in your portfolio.')
return
else:
# tbd: format portfolio
bot.send_message(chat_id=user_id, text=f'Your portfolio is: _{str(portfolio)}_', parse_mode="MARKDOWN")
for stock in portfolio:
comment = str(stock["comment"])
count = "{:.2f}".format(float(stock["count"]))
isin = str(stock["isin"])
worth = "{:.2f}".format(float(stock["current_price"]) * float(stock["count"]))
bot.send_message(chat_id=user_id, text=f'*{comment}*\n_{isin}_\namount: {count}\nworth: ${worth}', parse_mode="MARKDOWN")
@bot.message_handler(commands=['newtransaction']) #tbd not working rn
@ -458,7 +461,7 @@ def set_new_transaction_step(message):
bot.send_message(chat_id=user_id, text=f'Failed adding transaction. (statuscode {status})')
@bot.message_handler(commands=['interval']) #tbd
@bot.message_handler(commands=['interval'])
def send_interval(message):
""" send interval for user
:type message: message object bot