raiwalletbot.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码
def price_text(bot, update):
    user_id = update.message.from_user.id
    chat_id = update.message.chat_id
    lang_id = mysql_select_language(user_id)
    price = mysql_select_price()
    last_price_merc = ('%.8f' % (float(price[0][0]) / (10 ** 8)))
    ask_price_merc = ('%.8f' % (float(price[0][3]) / (10 ** 8)))
    bid_price_merc = ('%.8f' % (float(price[0][4]) / (10 ** 8)))
    last_price_grail = ('%.8f' % (float(price[1][0]) / (10 ** 8)))
    ask_price_grail = ('%.8f' % (float(price[1][3]) / (10 ** 8)))
    bid_price_grail = ('%.8f' % (float(price[1][4]) / (10 ** 8)))
    last_price_flip = ('%.8f' % (float(price[2][0]) / (10 ** 8)))
    ask_price_flip = ('%.8f' % (float(price[2][3]) / (10 ** 8)))
    bid_price_flip = ('%.8f' % (float(price[2][4]) / (10 ** 8)))

    high_price = ('%.8f' % (max(float(price[0][1]), float(price[1][1]), float(price[0][0])) / (10 ** 8)))
    low_price = ('%.8f' % (min(float(price[0][2]), float(price[1][2])) / (10 ** 8)))
    volume = int(price[0][5]) + int(price[1][5]) + int(price[2][5])
    volume_btc = ('%.2f' % ((float(price[0][6]) + float(price[1][6])) / (10 ** 8)))
    text = lang_text('price', lang_id).format(last_price_merc, ask_price_merc, bid_price_merc, last_price_grail, ask_price_grail, bid_price_grail, high_price, low_price, "{:,}".format(volume), volume_btc, last_price_flip, ask_price_flip, bid_price_flip)
    lang_keyboard(lang_id, bot, chat_id, text)
    sleep(1)
    message_markdown(bot, chat_id, lang_text('price_options', lang_id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号