Skip to content

Commit

Permalink
Merge pull request #360 from NelsonDane/deepsource-transform-af99e64d
Browse files Browse the repository at this point in the history
style: format code with Black and isort
  • Loading branch information
matthew55 authored Sep 5, 2024
2 parents 1c26171 + ea827ce commit d1981cd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tornadoAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ def handle_buy(driver, stock, orderObj, loop):
return

try:
current_shares_element = driver.find_element(By.XPATH, '//*[@id="main-router"]/div[1]/div/div[4]/div')
current_shares_element = driver.find_element(
By.XPATH, '//*[@id="main-router"]/div[1]/div/div[4]/div'
)
has_current_shares = bool("sh" in current_shares_element.text.strip())
except NoSuchElementException:
has_current_shares = False
Expand Down Expand Up @@ -382,10 +384,15 @@ def handle_buy(driver, stock, orderObj, loop):
try:
cost_float = float(cost.replace("$", "").replace(",", ""))
except ValueError:
printAndDiscord(f"Tornado: Invalid price format for {stock}: {cost}", loop)
printAndDiscord(
f"Tornado: Invalid price format for {stock}: {cost}", loop
)
return
else:
printAndDiscord(f"Tornado: Price not available or in an unexpected format for {stock}: {cost}", loop)
printAndDiscord(
f"Tornado: Price not available or in an unexpected format for {stock}: {cost}",
loop,
)
return

# Check if the available buying power is enough
Expand Down

0 comments on commit d1981cd

Please sign in to comment.