Skip to content

Commit

Permalink
Merge branch 'develop-formatting' into develop-firsttrade
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonDane committed Dec 29, 2023
2 parents 34d6a76 + 32e6a77 commit 756d93e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ RUN playwright install && \

# Grab needed files
COPY ./autoRSA.py .
COPY ./entrypoint.sh .
COPY ./fidelityAPI.py .
COPY ./firstradeAPI.py .
COPY ./helperAPI.py .
COPY ./robinhoodAPI.py .
COPY ./schwabAPI.py .
COPY ./tradierAPI.py .
COPY ./helperAPI.py .
COPY ./tastyAPI.py .
COPY ./entrypoint.sh .

# Make the entrypoint executable
RUN chmod +x entrypoint.sh

# Set the entrypoint to our entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
# Set the entrypoint to our entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
13 changes: 11 additions & 2 deletions fidelityAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ def fidelity_transaction(fidelity_o: Brokerage, orderObj: stockOrder, loop=None)
value="#market-no > s-root > div > label > s-slot > s-assigned-wrapper",
)
limit_button.click()
# Set price
difference_price = 0.01 if float(ask_price) > 0.1 else 0.005
# Set price
difference_price = 0.01 if float(ask_price) > 0.1 else 0.001
if orderObj.get_action() == "buy":
wanted_price = round(float(ask_price) + difference_price, 3)
else:
Expand All @@ -453,6 +453,15 @@ def fidelity_transaction(fidelity_o: Brokerage, orderObj: stockOrder, loop=None)
)
price_box.clear()
price_box.send_keys(wanted_price)
# Check for margin account
try:
margin_cash = driver.find_element(
by=By.ID, value="tradetype-cash"
)
margin_cash.click()
print("Margin account found!")
except NoSuchElementException:
pass
# Preview order
WebDriverWait(driver, 10).until(check_if_page_loaded)
sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pyotp==2.9.0
python-dotenv==1.0.0
requests==2.31.0
robin_stocks==3.0.6
schwab-api==0.3.3
schwab-api==0.3.5
selenium==4.12.0
tastytrade==6.1
webdriver-manager==4.0.0
1 change: 1 addition & 0 deletions schwabAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def schwab_init(SCHWAB_EXTERNAL=None):
name, account, account_info[account]["account_value"]
)
except Exception as e:
print(traceback.format_exc())
print(f"Error logging in to Schwab: {e}")
print(traceback.format_exc())
return None
Expand Down

0 comments on commit 756d93e

Please sign in to comment.