Skip to content

Commit

Permalink
Merge pull request #98 from MaxxRK/develop-schwab
Browse files Browse the repository at this point in the history
Update schwab2
  • Loading branch information
NelsonDane authored Oct 27, 2023
2 parents c036d96 + 9479a3a commit 8ac5cb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ python-dotenv==1.0.0
requests==2.31.0
robin_stocks==3.0.6
schwab-api==0.2.3
schwab-api2==0.2.8
schwab-api2==0.2.9
selenium==4.12.0
tastytrade==6.1
webdriver-manager==4.0.0
21 changes: 12 additions & 9 deletions schwabAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def schwab_transaction(schwab_o: Brokerage, orderObj: stockOrder, loop=None):
)
else:
messages, success = obj.trade(
ticker=s,
side=orderObj.get_action().capitalize(),
qty=orderObj.get_amount(),
account_id=account,
dry_run=orderObj.get_dry(),
)
ticker=s,
side=orderObj.get_action().capitalize(),
qty=orderObj.get_amount(),
account_id=account,
dry_run=orderObj.get_dry(),
)
printAndDiscord(
f"{key} account {account}: The order verification was "
+ "successful"
Expand All @@ -154,6 +154,9 @@ def schwab_transaction(schwab_o: Brokerage, orderObj: stockOrder, loop=None):
f"{key} {account}: Error submitting order: {e}", loop
)
sleep(1)
if SCHWAB_BETA:
print(f"Closing session for {key}")
obj.close_session()
# Kill playwright sessions
if SCHWAB_BETA:
for key in schwab_o.get_account_numbers():
print(f"Closing session for {key}")
obj: Schwab = schwab_o.get_logged_in_objects(key)
obj.close_session()

0 comments on commit 8ac5cb4

Please sign in to comment.