A CLI tool and Discord bot to buy, sell, and monitor holdings across multiple accounts!
You already know what Reverse Split Arbitrage is, that's not why you're here. If you do know what it is, then you know why a tool like this would be valuable. If you're a big player, even more so...
This program uses APIs to interface with your brokerages. When available, official APIs are always used. If an official API is not available, then a third-party API is used. As a last resort, Selenium or Playwright Stealth are used to automate the browser.
To create your Discord bot and get your DISCORD_TOKEN
, follow this guide.
- Create a
.env
file for your brokerage variables using .env.example as a template, and add your bot usingDISCORD_TOKEN
andDISCORD_CHANNEL
- Using the provided docker-compose.yml file, run the command
docker compose up -d
inside the project directory. - The bot should appear online (You can also do
!ping
to check).
Make sure python3-pip is installed
- Clone this repository and cd into it
- Run
pip install -r requirements.txt
- Create a
.env
file for your brokerage variables using .env.example as a template, and add your bot usingDISCORD_TOKEN
andDISCORD_CHANNEL
- Run
python autoRSA.py
(See below for more command explanations)
Note: If you are using Windows, you will need to install playwright manually. See this guide for more information.
- Clone this repository and cd into it
- Run
pip install -r requirements.txt
- Create a
.env
file for your brokerage variables using .env.example as a template. - Run the script using
python autoRSA.py
plus the command you want to run (See below for more command explanations)
Note: If you are using Windows, you will need to install playwright manually. See this guide for more information.
If running as a Discord bot, append !rsa
to the beginning of each command.
If running from the CLI Tool, append python autoRSA.py
to the beginning of each command.
To buy and sell stocks, use this command:
<action> <amount> <ticker> <accounts> <dry>
For example, to buy 1 AAPL in all accounts:
buy 1 AAPL all false
For a dry run of the above command in Robinhood only:
buy 1 AAPL robinhood true
For a real run on Fidelity and Robinhood, but not Schwab:
buy 1 AAPL fidelity,robinhood not schwab false
For a real run on Fidelity and Robinhood but not Schwab buying both AAPL and GOOG:
buy 1 AAPL,GOOG fidelity,robinhood not schwab false
To check your account holdings:
holdings <accounts>
To restart the Discord bot:
!restart
(without appending !rsa
)
For help:
!help
(without appending !rsa
)
Note: There are two special keywords you can use when specifying accounts: all
and day1
. all
will use every account that you have set up. day1
will use "day 1" brokers, which are Robinhood, Schwab, Tastytrade, and Tradier. This is useful for brokers that provide quick turnaround times, hence the nickname "day 1".
<action>
: string, "buy" or "sell"<amount>
: integer, Amount to buy or sell.<ticker>
: string, The stock ticker to buy or sell. Separate multiple tickers with commas and no spaces.<accounts>
: string, What brokerage to run command in (robinhood, schwab, etc, or all). Separate multiple brokerages with commas and no spaces.<not accounts>
: string proceedingnot
, What brokerages to exclude from command. Separate multiple brokerages with commas and no spaces.<dry>
: boolean, Whether to run indry
mode (in which no transactions are made. Useful for testing). Set toTrue
,False
, or just writedry
forTrue
. Defaults toTrue
, so if you want to run a real transaction, you must set this explicitly.
More detailed guides for some of the difficult setups:
Found or fixed a bug? Have a feature request? Want to add support for a new brokerage? Feel free to open an issue or pull request!
Enjoying the project? Feel free to Sponsor me on GitHub or Ko-fi!
DISCLAIMER: I am not a financial advisor and not affiliated with any of the brokerages listed below. Use this tool at your own risk. I am not responsible for any losses or damages you may incur by using this project. This tool is provided as-is with no warranty.
All brokers: separate account credentials with a colon (":"). For example, SCHWAB_USERNAME:SCHWAB_PASSWORD
. Separate multiple logins with the same broker with a comma (","). For example, SCHWAB_USERNAME:SCHWAB_PASSWORD,SCHWAB_USERNAME2:SCHWAB_PASSWORD2
.
Some brokerages require Playwright
to run. On Windows, the playwright install
command might not be recognized. If this is the case, run python -m playwright install
instead.
Made by MaxxRK using the chaseinvest-api. Go give them a ⭐
CHASE_USERNAME
CHASE_PASSWORD
CELL_PHONE_LAST_FOUR
.env
file format:
CHASE=CHASE_USERNAME:CHASE_PASSWORD:CELL_PHONE_LAST_FOUR
Made by yours truly using Selenium (and many hours of web scraping).
Required .env
variables:
FIDELITY_USERNAME
FIDELITY_PASSWORD
.env
file format:
FIDELITY=FIDELITY_USERNAME:FIDELITY_PASSWORD
Made by MaxxRK using the firstrade-api. Go give them a ⭐
Required .env
variables:
FIRSTRADE_USERNAME
FIRSTRADE_PASSWORD
FIRSTRADE_PIN
.env
file format:
FIRSTRADE=FIRSTRADE_USERNAME:FIRSTRADE_PASSWORD:FIRSTRADE_PIN
Made by yours truly using using public-invest-api. Consider giving me a ⭐
Required .env
variables:
PUBLIC_USERNAME
PUBLIC_PASSWORD
.env
file format:
PUBLIC_BROKER=PUBLIC_USERNAME:PUBLIC_PASSWORD
Note: Because Windows already has a PUBLIC
environment variable, you will need to use PUBLIC_BROKER
instead.
Made using robin_stocks. Go give them a ⭐
Required .env
variables:
ROBINHOOD_USERNAME
ROBINHOOD_PASSWORD
ROBINHOOD_TOTP
(If 2fa enabled, else NA)
.env
file format:
- With 2fa:
ROBINHOOD=ROBINHOOD_USERNAME:ROBINHOOD_PASSWORD:ROBINHOOD_TOTP
- Without 2fa:
ROBINHOOD=ROBINHOOD_USERNAME:ROBINHOOD_PASSWORD:NA
Configuring 2fa can be tricky, so follow this guide.
Made using the schwab-api. Go give them a ⭐
Required .env
variables:
SCHWAB_USERNAME
SCHWAB_PASSWORD
SCHWAB_TOTP_SECRET
(If 2fa is enabled, else NA)
.env
file format:
- With 2fa:
SCHWAB=SCHWAB_USERNAME:SCHWAB_PASSWORD:SCHWAB_TOTP_SECRET
- Without 2fa:
SCHWAB=SCHWAB_USERNAME:SCHWAB_PASSWORD:NA
To get your TOTP secret, follow this guide.
Note 1: Think or Swim must be enabled on all accounts. To enable, go to Trade
> Trading Platforms
> Learn how to enable thinkorswim
. Then press Continue
and expand the thinkorswim Access Agreement
and accept it. Then press Continue
again. Then select the checkbox for all available accounts and press Submit
. It may take a day or two for the accounts to be enabled.
Made by yours truly using the official Tradier API. Consider giving me a ⭐
Required .env
variables:
TRADIER_ACCESS_TOKEN
.env
file format:
TRADIER=TRADIER_ACCESS_TOKEN
To get your access token, go to your Tradier API settings.
Made by MaxxRK using the tastytrade-api. Go give them a ⭐
Required .env
variables:
TASTYTRADE_USERNAME
TASTYTRADE_PASSWORD
.env
file format:
TASTYTRADE=TASTYTRADE_USERNAME:TASTYTRADE_PASSWORD
Made using the webull library. Go give them a ⭐
Required .env
variables:
WEBULL_USERNAME
WEBULL_PASSWORD
WEBULL_DID
WEBULL_TRADING_PIN
.env
file format:
WEBULL=WEBULL_USERNAME:WEBULL_PASSWORD:WEBULL_DID:WEBULL_TRADING_PIN
Your WEBULL_USERNAME
can be your email or phone number. If using a phone number, it must be formatted as: +1-XXXXXXXXXX or +86-XXXXXXXXXXX.
To get your Webull DID, follow this guide.
Ally disabled their official API, so all Ally packages don't work. I am attempting to reverse engineer their API, and will add it if I get it working. Otherwise, I will use Selenium or Playwright.
Will be added using Selenium or Playwright.
Will be added using Selenium or Playwright.
Why.