def command_portfolio(_, update): has_real_trader, has_simulated_trader, \ portfolio_real_current_value, portfolio_simulated_current_value = get_portfolio_current_value() reference_market = get_reference_market() real_global_portfolio, simulated_global_portfolio = get_global_portfolio_currencies_amounts( ) portfolios_string = "" if has_real_trader: portfolios_string += "{0}Portfolio value : {1} {2}{3}".format( REAL_TRADER_STR, PrettyPrinter.get_min_string_from_number( portfolio_real_current_value), reference_market, TelegramApp.EOL) portfolios_string += "{0}Portfolio : {2}{1}{2}{2}".format( REAL_TRADER_STR, PrettyPrinter.global_portfolio_pretty_print( real_global_portfolio), TelegramApp.EOL) if has_simulated_trader: portfolios_string += "{0}Portfolio value : {1} {2}{3}".format( SIMULATOR_TRADER_STR, PrettyPrinter.get_min_string_from_number( portfolio_simulated_current_value), reference_market, TelegramApp.EOL) portfolios_string += "{0}Portfolio : {2}{1}".format( SIMULATOR_TRADER_STR, PrettyPrinter.global_portfolio_pretty_print( simulated_global_portfolio), TelegramApp.EOL) if not portfolios_string: portfolios_string = TelegramApp.NO_TRADER_MESSAGE update.message.reply_text(portfolios_string)
def command_portfolio(_, update): portfolio_real_current_value, portfolio_simulated_current_value = get_portfolio_current_value() reference_market = get_reference_market() real_global_portfolio, simulated_global_portfolio = get_global_portfolio_currencies_amounts() update.message.reply_text("Portfolio real value : {0} {1}".format(portfolio_real_current_value, reference_market)) update.message.reply_text("Global real portfolio : \n{0}" .format(PrettyPrinter.global_portfolio_pretty_print(real_global_portfolio))) update.message.reply_text("Portfolio simulated value : {0} {1}".format(portfolio_simulated_current_value, reference_market)) update.message.reply_text("Global simulated portfolio : \n{0}" .format(PrettyPrinter.global_portfolio_pretty_print(simulated_global_portfolio)))
def command_portfolio(_, update): portfolio_real_current_value, portfolio_simulated_current_value = get_portfolio_current_value( ) reference_market = get_reference_market() real_global_portfolio, simulated_global_portfolio = get_global_portfolio_currencies_amounts( ) update.message.reply_text("Portfolio real value : {0} {1}".format( portfolio_real_current_value, reference_market)) update.message.reply_text("Global real portfolio : \n{0}".format( PrettyPrinter.global_portfolio_pretty_print( real_global_portfolio))) update.message.reply_text("Portfolio simulated value : {0} {1}".format( portfolio_simulated_current_value, reference_market)) update.message.reply_text("Global simulated portfolio : \n{0}".format( PrettyPrinter.global_portfolio_pretty_print( simulated_global_portfolio)))
def _print_portfolio(current_val, ref_market, portfolio, trader_str, markdown=False): _, b, c = PrettyPrinter.get_markets(markdown) portfolios_string = f"{b}{trader_str}{b}Portfolio value : " \ f"{b}{PrettyPrinter.get_min_string_from_number(current_val)} {ref_market}{b}" \ f"{EOL}" portfolio_str = PrettyPrinter.global_portfolio_pretty_print(portfolio, markdown=markdown) if not portfolio_str: portfolio_str = "Nothing there." portfolios_string += f"{b}{trader_str}{b}Portfolio : {EOL}{c}{portfolio_str}{c}" return portfolios_string