Skip to content

Commit

Permalink
move schwab holdings up
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonDane committed Oct 17, 2023
1 parent 6d52ed9 commit 4cf9a41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions autoRSA.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Script to automate RSA stock purchases

# Import libraries
import asyncio
import os
import sys
import traceback
Expand Down Expand Up @@ -233,7 +234,7 @@ async def help(ctx):
@bot.command(name="rsa")
async def rsa(ctx, *args):
discOrdObj = await bot.loop.run_in_executor(None, argParser, args)
loop = asyncio.get_event_loop()
event_loop = asyncio.get_event_loop()
try:
# Login to brokers
await bot.loop.run_in_executor(None, fun_run, discOrdObj, "_init")
Expand All @@ -242,11 +243,11 @@ async def rsa(ctx, *args):
# Get holdings or complete transaction
if discOrdObj.get_holdings():
await bot.loop.run_in_executor(
None, fun_run, discOrdObj, "_holdings", loop
None, fun_run, discOrdObj, "_holdings", event_loop
)
else:
await bot.loop.run_in_executor(
None, fun_run, discOrdObj, "_transaction", loop
None, fun_run, discOrdObj, "_transaction", event_loop
)
# Kill Drivers
for b in discOrdObj.get_logged_in():
Expand Down
2 changes: 1 addition & 1 deletion schwabAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def schwab_holdings(schwab_o: Brokerage, loop=None):
schwab_o.set_holdings(key, account, sym, qty, current_price)
except Exception as e:
printAndDiscord(f"{key} {account}: Error getting holdings: {e}", loop)
printHoldings(schwab_o, loop)
if SCHWAB_BETA:
print(f"Closing session for {key}")
obj.close_session()
printHoldings(schwab_o, loop)


def schwab_transaction(schwab_o: Brokerage, orderObj: stockOrder, loop=None):
Expand Down

0 comments on commit 4cf9a41

Please sign in to comment.