コード例 #1
0
    def notification_text_large_tx(self, tx: StakeTx, dollar_per_rune: float,
                                   pool: StakePoolStats, pool_info: PoolInfo):
        msg = ''
        if tx.type == 'stake':
            msg += f'🐳 <b>Whale added liquidity</b> 🟢\n'
        elif tx.type == 'unstake':
            msg += f'🐳 <b>Whale removed liquidity</b> 🔴\n'

        total_usd_volume = tx.full_rune * dollar_per_rune if dollar_per_rune != 0 else 0.0
        pool_depth_usd = pool_info.usd_depth(dollar_per_rune)
        thor_tx = link(self.thor_explore_address(tx.address),
                       short_address(tx.address))
        bnb_tx = link(self.binance_explore_address(tx.address),
                      short_address(tx.address))

        rp, ap = tx.symmetry_rune_vs_asset()

        rune_side_usd = tx.rune_amount * dollar_per_rune
        rune_side_usd_short = short_money(rune_side_usd)
        asset_side_usd_short = short_money(total_usd_volume - rune_side_usd)
        percent_of_pool = pool_info.percent_share(tx.full_rune)

        msg += (
            f"<b>{pretty_money(tx.rune_amount)} {self.R}</b> ({rp:.0f}% = {rune_side_usd_short}) ↔️ "
            f"<b>{pretty_money(tx.asset_amount)} {short_asset_name(tx.pool)}</b> ({ap:.0f}% = {asset_side_usd_short})\n"
            f"Total: <code>${pretty_money(total_usd_volume)}</code> ({percent_of_pool:.2f}% of the whole pool).\n"
            f"Pool depth is <b>${pretty_money(pool_depth_usd)}</b> now.\n"
            f"Thor explorer: {thor_tx} / Binance explorer: {bnb_tx}.")

        return msg
コード例 #2
0
ファイル: rus.py プロジェクト: samelamin/kylinmonitorbot
 def text_stake_provides_liq_to_pools(self, address, pools):
     pools = pre(', '.join(pools))
     thor_tx = link(self.thor_explore_address(address), 'viewblock.io')
     bnb_tx = link(self.binance_explore_address(address), 'explorer.binance.org')
     return f'🛳️ {pre(address)}\n' \
            f'поставляет ликвидность в следующие пулы:\n{pools}.\n\n' \
            f"🔍 Explorers: {thor_tx}; {bnb_tx}.\n\n" \
            f'👇 Выберите пул, чтобы получить подробную карточку информаци.'
コード例 #3
0
 def text_stake_provides_liq_to_pools(self, address, pools):
     pools = pre(', '.join(pools))
     thor_tx = link(self.thor_explore_address(address), 'viewblock.io')
     bnb_tx = link(self.binance_explore_address(address),
                   'explorer.binance.org')
     return f'🛳️ {pre(address)}\nprovides liquidity to the following pools:\n' \
            f'{pools}.\n\n' \
            f"🔍 Explorers: {thor_tx}; {bnb_tx}.\n\n" \
            f'👇 Click on the button to get a detailed card.'
コード例 #4
0
    def notification_text_price_update(self, p: PriceReport, ath=False):
        title = bold('Price update') if not ath else bold(
            '🚀 A new all-time high has been achieved!')

        c_gecko_url = 'https://www.coingecko.com/en/coins/thorchain'
        c_gecko_link = link(c_gecko_url, 'RUNE')

        message = f"{title} | {c_gecko_link}\n\n"
        price = p.fair_price.real_rune_price

        pr_text = f"${price:.3f}"
        btc_price = f"₿ {p.btc_real_rune_price:.8f}"
        message += f"<b>RUNE</b> price is {code(pr_text)} ({btc_price}) now.\n"

        last_ath = p.last_ath
        if last_ath is not None and ath:
            last_ath_pr = f'{last_ath.ath_price:.2f}'
            message += f"Last ATH was ${pre(last_ath_pr)} ({format_time_ago(last_ath.ath_date)}).\n"

        time_combos = zip(('1h', '24h', '7d'),
                          (p.price_1h, p.price_24h, p.price_7d))
        for title, old_price in time_combos:
            if old_price:
                pc = calc_percent_change(old_price, price)
                message += pre(
                    f"{title.rjust(4)}:{adaptive_round_to_str(pc, True).rjust(8)} % "
                    f"{emoji_for_percent_change(pc).ljust(4).rjust(6)}") + "\n"

        fp = p.fair_price
        if fp.rank >= 1:
            message += f"Coin market cap is {bold(pretty_dollar(fp.market_cap))} (#{bold(fp.rank)})\n"

        if fp.tlv_usd >= 1:
            det_link = link(self.DET_PRICE_HELP_PAGE, 'deterministic price')
            message += (
                f"TVL of non-RUNE assets: ${pre(pretty_money(fp.tlv_usd))}\n"
                f"So {det_link} of RUNE is {code(pretty_money(fp.fair_price, prefix='$'))}\n"
                f"Speculative multiplier is {pre(x_ses(fp.fair_price, price))}\n"
            )

        return message.rstrip()
コード例 #5
0
ファイル: rus.py プロジェクト: samelamin/kylinmonitorbot
    def notification_text_large_tx(self, tx: StakeTx, dollar_per_rune: float, pool: StakePoolStats,
                                   pool_info: PoolInfo):
        msg = ''
        if tx.type == 'stake':
            msg += f'🐳 <b>Кит добавил ликвидности</b> 🟢\n'
        elif tx.type == 'unstake':
            msg += f'🐳 <b>Кит вывел ликвидность</b> 🔴\n'

        rp, ap = tx.symmetry_rune_vs_asset()
        total_usd_volume = tx.full_rune * dollar_per_rune if dollar_per_rune != 0 else 0.0
        pool_depth_usd = pool_info.usd_depth(dollar_per_rune)
        thor_tx = link(self.thor_explore_address(tx.address), short_address(tx.address))
        bnb_tx = link(self.binance_explore_address(tx.address), short_address(tx.address))
        percent_of_pool = pool_info.percent_share(tx.full_rune)

        return (
            f"<b>{pretty_money(tx.rune_amount)} {self.R}</b> ({rp:.0f}%) ↔️ "
            f"<b>{pretty_money(tx.asset_amount)} {short_asset_name(tx.pool)}</b> ({ap:.0f}%)\n"
            f"Всего: <code>${pretty_money(total_usd_volume)}</code> ({percent_of_pool:.2f}% от всего пула).\n"
            f"Глубина пула сейчас: <b>${pretty_money(pool_depth_usd)}</b>.\n"
            f"Thor обозреватель: {thor_tx} / Binance обозреватель: {bnb_tx}."
        )
コード例 #6
0
    def notification_text_price_update(self, p: PriceReport, ath=False):
        title = bold('Обновление цены') if not ath else bold(
            '🚀 Достигнуть новый исторический максимум!')

        c_gecko_url = 'https://www.coingecko.com/ru/' \
                      '%D0%9A%D1%80%D0%B8%D0%BF%D1%82%D0%BE%D0%B2%D0%B0%D0%BB%D1%8E%D1%82%D1%8B/thorchain'
        c_gecko_link = link(c_gecko_url, 'RUNE')

        message = f"{title} | {c_gecko_link}\n\n"
        price = p.fair_price.real_rune_price

        btc_price = f"₿ {p.btc_real_rune_price:.8f}"
        pr_text = f"${price:.2f}"
        message += f"Цена <b>RUNE</b> сейчас {code(pr_text)} ({btc_price}).\n"

        last_ath = p.last_ath
        if last_ath is not None and ath:
            message += f"Последний ATH был ${last_ath.ath_price:2.f} ({format_time_ago(last_ath.ath_date)}).\n"

        time_combos = zip(('1ч.', '24ч.', '7дн.'),
                          (p.price_1h, p.price_24h, p.price_7d))
        for title, old_price in time_combos:
            if old_price:
                pc = calc_percent_change(old_price, price)
                message += pre(
                    f"{title.rjust(5)}:{adaptive_round_to_str(pc, True).rjust(8)} % "
                    f"{emoji_for_percent_change(pc).ljust(4).rjust(6)}") + "\n"

        fp = p.fair_price
        if fp.rank >= 1:
            message += f"Капитализация: {bold(pretty_dollar(fp.market_cap))} (#{bold(fp.rank)} место)\n"

        if fp.tlv_usd >= 1:
            message += (
                f"TLV (кроме RUNE): ${pre(pretty_money(fp.tlv_usd))}\n"
                f"Детерминистическая цена: {code(pretty_money(fp.fair_price, prefix='$'))}\n"
                f"Спекулятивый множитель: {pre(x_ses(fp.fair_price, price))}\n"
            )

        return message.rstrip()
コード例 #7
0
 def pool_text(pool_name, status, to_status=None):
     t = link(self.pool_link(pool_name), pool_name)
     extra = '' if to_status is None else f' → {ital(statuses[to_status])}'
     return f'{t} ({ital(statuses[status])}{extra})'
コード例 #8
0
def bnb_link(bnb_addr, full=False):
    return link(f"https://explorer.binance.org/address/{bnb_addr}",
                bnb_addr if full else short_address(bnb_addr))
コード例 #9
0
def eth_link(eth_addr, full=False):
    return link(f"https://etherscan.io/address/{eth_addr}",
                eth_addr if full else short_address(eth_addr))