Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanAkkerman committed Mar 30, 2024
1 parent 66c9015 commit c818c46
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cogs/loops/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async def post_events(self):
df["timestamp"] = df["timestamp"].apply(lambda x: f"<t:{int(x)}:d>")

# Replace zone names

# TODO: fix future warning
df["zone"].replace(
{"euro zone": "🇪🇺", "united states": "🇺🇸"},
inplace=True,
Expand Down
3 changes: 2 additions & 1 deletion src/cogs/loops/losers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard libraries
import datetime
import traceback

# > 3rd party dependencies
import yahoo_fin.stock_info as si
Expand Down Expand Up @@ -51,6 +51,7 @@ async def losers(self) -> None:
await self.channel.send(embed=e)
except Exception as e:
print("Error getting or posting stock losers, error:", e)
print(traceback.format_exc())


def setup(bot: commands.Bot) -> None:
Expand Down
8 changes: 7 additions & 1 deletion src/cogs/loops/nfts.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,13 @@ async def upcoming_cmc():
df = df.head(10)

# name, websiteUrl, price, dropDate
df = df[["name", "websiteUrl", "price", "dropDate"]]
# Filter out the columns that actually exist in the DataFrame
existing_columns = [
col for col in ["name", "websiteUrl", "price", "dropDate"] if col in df.columns
]

# Use only the existing columns to filter the DataFrame
df = df[existing_columns]

# Use same method as #events channel time
# Rename to start_time
Expand Down
2 changes: 1 addition & 1 deletion src/util/yf_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def append_price_data(price_key, change_key):

# Prepare return values
url = f"https://finance.yahoo.com/quote/{ticker}"
exchange = stock_info.get("exchange", "N/A")
exchange = stock_info.get("exchange", [])

return volume, url, exchange, prices, changes if changes else ["N/A"], ticker

Expand Down

0 comments on commit c818c46

Please sign in to comment.