Skip to content

Commit

Permalink
Merge pull request #374 from kennyboy106/main
Browse files Browse the repository at this point in the history
Rework fidelityAPI using Playwright - THANK YOU!
  • Loading branch information
NelsonDane authored Sep 27, 2024
2 parents f1ae897 + 7227497 commit d36fc8c
Show file tree
Hide file tree
Showing 5 changed files with 655 additions and 635 deletions.
5 changes: 4 additions & 1 deletion .env.example
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ DSPAC=
FENNEL=

# Fidelity
# FIDELITY=FIDELITY_USERNAME:FIDELITY_PASSWORD
# If 2fa is not enabled:
# FIDELITY=FIDELITY_USERNAME:FIDELITY_PASSWORD:NA
# If 2fa is enabled:
# FIDELITY=FIDELITY_USERNAME:FIDELITY_PASSWORD:FIDELITY_TOTP_SECRET
FIDELITY=

# Firstrade
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
*.csv
did.bin
.DS_Store
.env
*.json
*.pkl
*.png
Expand All @@ -9,4 +10,5 @@ src/
test*
*venv/
.vscode/
*workspace
*.zip
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ You should see `(autorsa-venv)` in your terminal prompt now. You will need to ac
```bash
pip install -r requirements.txt
```
5. Add `DISCORD_TOKEN` and `DISCORD_CHANNEL` to your `.env` file.
6. Start the bot using the following command:
5. Install Playwright's dependencies:
```bash
playwright install
```
6. Add `DISCORD_TOKEN` and `DISCORD_CHANNEL` to your `.env` file.
7. Start the bot using the following command:
```bash
python autoRSA.py discord
```
7. The bot should appear online in Discord (You can also do `!ping` to check).
8. The bot should appear online in Discord (You can also do `!ping` to check).

### CLI Tool Installation 💻
To run the CLI tool, follow these steps:
Expand Down
15 changes: 4 additions & 11 deletions autoRSA.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,8 @@ def fun_run(orderObj: stockOrder, command, botObj=None, loop=None):
try:
# Initialize broker
fun_name = broker + first_command
if broker.lower() == "fidelity":
# Fidelity requires docker mode argument, botObj, and loop
orderObj.set_logged_in(
globals()[fun_name](
DOCKER=DOCKER_MODE, botObj=botObj, loop=loop
),
broker,
)
elif broker.lower() == "tornado":

if broker.lower() == "tornado":
# Requires docker mode argument and loop
orderObj.set_logged_in(
globals()[fun_name](DOCKER=DOCKER_MODE, loop=loop),
Expand All @@ -144,7 +137,7 @@ def fun_run(orderObj: stockOrder, command, botObj=None, loop=None):
orderObj.set_logged_in(
globals()[fun_name](botObj=botObj, loop=loop), broker
)
elif broker.lower() in ["chase", "vanguard"]:
elif broker.lower() in ["chase", "fidelity", "vanguard"]:
fun_name = broker + "_run"
# PLAYWRIGHT_BROKERS have to run all transactions with one function
th = ThreadHandler(
Expand All @@ -167,7 +160,7 @@ def fun_run(orderObj: stockOrder, command, botObj=None, loop=None):
orderObj.set_logged_in(globals()[fun_name](), broker)

print()
if broker.lower() not in ["chase", "vanguard"]:
if broker.lower() not in ["chase", "vanguard", "fidelity"]:
# Verify broker is logged in
orderObj.order_validate(preLogin=False)
logged_in_broker = orderObj.get_logged_in(broker)
Expand Down
Loading

0 comments on commit d36fc8c

Please sign in to comment.