diff --git a/cogs/smr_market.py b/cogs/smr_market.py index eea17f4..b336e91 100644 --- a/cogs/smr_market.py +++ b/cogs/smr_market.py @@ -1,7 +1,7 @@ """" Copyright © antonionardella 2023 - https://github.com/antonionardella (https://antonionardella.it) Description: -Shimmer market data +IOTA market data Version: 5.5.0 """ @@ -32,13 +32,13 @@ def __init__(self, bot): @commands.cooldown(1, 360, commands.BucketType.user) @commands.hybrid_command( name="smr-market", - description="Shares the Shimmer market data", + description="Shares the IOTA market data", ) # This will only allow non-blacklisted members to execute the command @checks.not_blacklisted() async def shimmer_market_data(self, context: Context) -> None: """ - This command prints an embed with the Shimmer Market data + This command prints an embed with the IOTA Market data :param context: The application command context. """ @@ -61,19 +61,19 @@ async def shimmer_market_data(self, context: Context) -> None: @commands.cooldown(1, 360, commands.BucketType.user) @commands.hybrid_command( name="updatesmd", - description="Force updates the Shimmer market data (Admin only)", + description="Force updates the IOTA market data (Admin only)", ) # This will only allow owners to execute the command @checks.is_owner() async def updatesmd(self, context: Context) -> None: """ - This command forces an update of Shimmer Market data + This command forces an update of IOTA Market data :param context: The application command context. """ try: await context.send( - "Hello! Shimmer Market Data update launced...", ephemeral=True + "Hello! IOTA Market Data update launced...", ephemeral=True ) await build_embed() @@ -81,7 +81,7 @@ async def updatesmd(self, context: Context) -> None: print(traceback.format_exc()) await context.send( - "Hello! Shimmer Market Data update finished.", ephemeral=True + "Hello! IOTA Market Data update finished.", ephemeral=True ) # And then we finally add the cog to the bot so that it can load, unload, reload and use it's content. diff --git a/helpers/embed_and_messages.py b/helpers/embed_and_messages.py index b88a76e..b99ed03 100644 --- a/helpers/embed_and_messages.py +++ b/helpers/embed_and_messages.py @@ -1,7 +1,7 @@ """" Copyright © antonionardella 2023 - https://github.com/antonionardella (https://linkfree.antonionardella.it) Description: -This file contains functions for the Shimmer data +This file contains functions for the IOTA data Version: 5.4 """ @@ -11,7 +11,7 @@ async def create_empty_embed_and_messages(): - embed = discord.Embed(title="Shimmer Market Data", color=0x00FF00) + embed = discord.Embed(title="IOTA Market Data", color=0x00FF00) embed.add_field(name="Updates: ", value="Every 24h") embed.add_field( diff --git a/helpers/smr_market_data/smd_coingecko.py b/helpers/smr_market_data/smd_coingecko.py index b5fc12f..04ed491 100644 --- a/helpers/smr_market_data/smd_coingecko.py +++ b/helpers/smr_market_data/smd_coingecko.py @@ -1,7 +1,7 @@ """" Copyright © antonionardella 2023 - https://github.com/antonionardella (https://antonionardella.it) Description: -Get API data for Shimmer from CoinGecko API +Get API data for IOTA from CoinGecko API Version: 5.5.0 """ import requests @@ -13,17 +13,17 @@ # Load configuration config = configuration_manager.load_config('config.json') -# Shimmer data +# IOTA data coingecko_coin_id = config["coingecko_coin_id"] coingecko_exchange_id = config["coingecko_exchange_id"] async def get_coingecko_exchange_data(): """ - Get Coingecko exchange data for Shimmer (SMR) cryptocurrency. + Get Coingecko exchange data for IOTA cryptocurrency. Returns: - dict: A dictionary containing the latest USD price and 24h total volume for Shimmer. + dict: A dictionary containing the latest USD price and 24h total volume for IOTA. Example: {"usd_price": 0.1234, "total_volume": 1234567.89} Raises: requests.exceptions.RequestException: If there is an issue with the HTTP request to the Coingecko API. @@ -45,7 +45,7 @@ async def get_coingecko_exchange_data(): twentyfourh_volume = usd_volume + usdt_volume logger.debug("Last USD Price: %s", usd_price) - logger.debug("Total USD Converted Volume for Shimmer: %s", twentyfourh_volume) + logger.debug("Total USD Converted Volume for IOTA: %s", twentyfourh_volume) return {"usd_price": usd_price, "total_volume": twentyfourh_volume} diff --git a/helpers/smr_market_data/smd_defillama.py b/helpers/smr_market_data/smd_defillama.py index b9a0f70..3db545d 100644 --- a/helpers/smr_market_data/smd_defillama.py +++ b/helpers/smr_market_data/smd_defillama.py @@ -1,7 +1,7 @@ """" Copyright © antonionardella 2023 - https://github.com/antonionardella (https://antonionardella.it) Description: -Get API data for Shimmer from DefiLlama API +Get API data for IOTA from DefiLlama API Version: 5.5.0 """ import requests @@ -15,15 +15,15 @@ async def get_defillama_data(): """ - Get DefiLlama TVL data for ShimmerEVM. + Get DefiLlama TVL data for IOTA EVM. Returns: - dict: Dictionary containing ShimmerEVM TVL and rank. + dict: Dictionary containing IOTA EVM TVL and rank. """ logger.info("Getting the DefiLlama TVL and rank") defillama_url = "https://api.llama.fi/v2/chains" headers = {"accept": "*/*"} - shimmer_tvl = None + iota_tvl = None rank = None try: @@ -33,17 +33,17 @@ async def get_defillama_data(): if tvl_response.status_code == 200: tvl_data = tvl_response.json() - shimmer_entry = next((entry for entry in tvl_data if entry.get("name") == "ShimmerEVM"), None) + iota_entry = next((entry for entry in tvl_data if entry.get("name") == "IOTA EVM"), None) - if shimmer_entry: - shimmer_tvl = shimmer_entry.get("tvl") + if iota_entry: + iota_tvl = iota_entry.get("tvl") tvl_data.sort(key=lambda x: x.get("tvl", 0), reverse=True) - rank = tvl_data.index(shimmer_entry) + 1 + rank = tvl_data.index(iota_entry) + 1 - logger.debug("Shimmer TVL Value: %s", shimmer_tvl) - logger.debug("Shimmer TVL Rank: %s", rank) + logger.debug("IOTA TVL Value: %s", iota_tvl) + logger.debug("IOTA TVL Rank: %s", rank) - return {"shimmer_tvl": shimmer_tvl, "shimmer_rank": rank} + return {"iota_tvl": iota_tvl, "iota_rank": rank} except requests.exceptions.Timeout: logger.error("DefiLlama API request timed out.") diff --git a/helpers/smr_market_data/smd_geckoterminal.py b/helpers/smr_market_data/smd_geckoterminal.py index 2a64b66..a00919c 100644 --- a/helpers/smr_market_data/smd_geckoterminal.py +++ b/helpers/smr_market_data/smd_geckoterminal.py @@ -1,7 +1,7 @@ """" Copyright © antonionardella 2023 - https://github.com/antonionardella (https://antonionardella.it) Description: -Get API data for Shimmer from GeckoTerminal API +Get API data for IOTA from GeckoTerminal API Version: 5.5.0 """ import requests @@ -13,18 +13,18 @@ # Load configuration config = configuration_manager.load_config('config.json') -# Shimmer data +# IOTA data geckoterminal_ticker = config["geckoterminal_ticker"] async def get_geckoterminal_data(): """ - Get GeckoTerminal Defi Volume data for ShimmerEVM. + Get GeckoTerminal Defi Volume data for IOTA EVM. Returns: - dict: Dictionary containing ShimmerEVM's total 24h volume and total 24h transactions. + dict: Dictionary containing IOTA EVM's total 24h volume and total 24h transactions. """ - logger.info("Getting GeckoTerminal Defi Volume data for ShimmerEVM") + logger.info("Getting GeckoTerminal Defi Volume data for IOTA EVM") geckoterminal_url = f"https://api.geckoterminal.com/api/v2/networks/{geckoterminal_ticker}/pools" headers = {"accept": "application/json"} total_defi_volume_usd_h24 = 0 @@ -54,12 +54,12 @@ async def get_geckoterminal_data(): total_defi_tx_24h += buys_h24 + sells_h24 logger.debug("Total USD 24h Volume for all pools: %s", total_defi_volume_usd_h24) - logger.debug("Total 24h Defi Transactions for ShimmerEVM: %s", total_defi_tx_24h) + logger.debug("Total 24h Defi Transactions for IOTA EVM: %s", total_defi_tx_24h) if total_defi_volume_usd_h24 > 0 and total_defi_tx_24h > 0: return {"defi_total_volume": total_defi_volume_usd_h24, "total_defi_tx_24h": total_defi_tx_24h} else: - logger.debug("Shimmer Total Volume or Total Transactions not found in the response.") + logger.debug("IOTA Total Volume or Total Transactions not found in the response.") elif defi_volume.status_code == 404: logger.error("404 Client Error: Not Found for URL: %s", defi_volume.url) else: diff --git a/helpers/smr_market_data_embed.py b/helpers/smr_market_data_embed.py index d463b39..fe6d995 100644 --- a/helpers/smr_market_data_embed.py +++ b/helpers/smr_market_data_embed.py @@ -41,7 +41,7 @@ async def build_embed(): total_defi_tx_24h = geckoterminal_data["total_defi_tx_24h"] shimmer_rank = defillama_data["shimmer_rank"] discord_timestamp = await generate_discord_timestamp() - +""" # Set up Bitfinex order book depth bitfinex_order_book_data = await calculate_total_bitfinex_depth(coingecko_data['usd_price']) logger.debug("Final bitfinex_order_book_data: %s", bitfinex_order_book_data) @@ -56,6 +56,7 @@ async def build_embed(): positive_order_book_depth_str_20_percent = "" negative_order_book_depth_str_20_percent = "" + # Iterate through the order book data and format the strings for percentage, data in bitfinex_order_book_data['total_order_book_depth'].items(): @@ -91,7 +92,7 @@ async def build_embed(): positive_order_book_depth_str_10_percent += buy_sell_info elif int(percentage[:-1]) == 20: positive_order_book_depth_str_20_percent += buy_sell_info - +""" # Create an embed instance embed = discord.Embed(title="Shimmer Market Data", color=0x00FF00) embed.add_field(name="Price (Coingecko)", value=f"{await format_currency(coingecko_data['usd_price'])}", inline=False) @@ -104,15 +105,15 @@ async def build_embed(): embed.add_field(name="24h DeFi Transactions (GeckoTerminal)", value=total_defi_tx_24h, inline=True) embed.add_field(name="24h DeFi Volume (GeckoTerminal)", value=f"{await format_currency(geckoterminal_data['defi_total_volume'])}", inline=True) embed.add_field(name="\u200b", value="\u200b", inline=False) - embed.add_field(name="ShimmerEVM Order Books", value="\u200b", inline=False) - embed.add_field(name="Order Book depth ±2%", value=f"{negative_order_book_depth_str_2_percent} {positive_order_book_depth_str_2_percent}", inline=True) - embed.add_field(name="\u200b", value="\u200b", inline=False) - embed.add_field(name="Order Book depth ±5%", value=f"{negative_order_book_depth_str_5_percent} {positive_order_book_depth_str_5_percent}", inline=True) - embed.add_field(name="\u200b", value="\u200b", inline=False) - embed.add_field(name="Order Book depth ±10%", value=f"{negative_order_book_depth_str_10_percent} {positive_order_book_depth_str_10_percent}", inline=True) - embed.add_field(name="\u200b", value="\u200b", inline=False) - embed.add_field(name="Order Book depth ±20%", value=f"{negative_order_book_depth_str_20_percent} {positive_order_book_depth_str_20_percent}", inline=True) - embed.add_field(name="\u200b", value="\u200b", inline=False) + # embed.add_field(name="ShimmerEVM Order Books", value="\u200b", inline=False) + # embed.add_field(name="Order Book depth ±2%", value=f"{negative_order_book_depth_str_2_percent} {positive_order_book_depth_str_2_percent}", inline=True) + # embed.add_field(name="\u200b", value="\u200b", inline=False) + # embed.add_field(name="Order Book depth ±5%", value=f"{negative_order_book_depth_str_5_percent} {positive_order_book_depth_str_5_percent}", inline=True) + # embed.add_field(name="\u200b", value="\u200b", inline=False) + # embed.add_field(name="Order Book depth ±10%", value=f"{negative_order_book_depth_str_10_percent} {positive_order_book_depth_str_10_percent}", inline=True) + # embed.add_field(name="\u200b", value="\u200b", inline=False) + # embed.add_field(name="Order Book depth ±20%", value=f"{negative_order_book_depth_str_20_percent} {positive_order_book_depth_str_20_percent}", inline=True) + # embed.add_field(name="\u200b", value="\u200b", inline=False) # Add additional information embed.add_field(name="Sources", value="Bitfinex, Coingecko, DefiLlama, GeckoTerminal, Shimmer API", inline=False)