FillToAlert is a Python script that monitors a user's Webull brokerage account for option trades, and sends alerts corresponding to Discord using a webhook. This guide will walk you through the steps to set up and run the script.
The script will call alerts as such:
BTO TICKER STRIKESIDE EXP @ FILLPRICE
and will call sells and exits according to your open position QT as well:
TRIM TICKER STRIKESIDE EXP @ FILLPRICE
STC TICKER STRIKESIDE EXP @ FILLPRICE
This script is built to seamlessly integrate with Nyria's Trade Bot. This script will ensure that your alerts are 100% accurate and interpretable by the bot, and that everything is correct for stat tracking, formatting, etc. Additionally, your users will be able to get into the same plays within a split second of your order fill in Webull, when using these two in combination.
Before you begin, you must have the following:
- A Webull brokerage account
- Python 3.7 or higher installed on your system. Install here.
- Chrome or Firefox web browser installed on your system
- Clone or download the repository to your local machine.
- Open the
_secrets.py
file in a text editor. - Enter your Webull login information and device ID in the file:
WEBULL_LOGIN_EMAIL: str = "your_email"
WEBULL_LOGIN_PWD: str = "your_password"
WEBULL_TRADING_PIN: str = "your_trading_pin"
WEBULL_DEVICE_ID: str = "Trader-Bot" # Change this if desired
WEBULL_SECURITY_DID: str = "your_device_id"
You can retrieve your device ID by following the instructions in the next section.
- Save and close the _secrets.py file.
To retrieve your Webull device ID:
- Open a private window in your Chrome or Firefox web browser.
- Navigate to https://app.webull.com.
- Visit the paper trading tab.
- Open the developer tools using the keyboard shortcut Ctrl + Shift + I for Chrome or Ctrl + Shift + K for Firefox.
- Click on the Network tab in the developer tools.
- Click on any line listing 'getQuote'.
- Scroll down to the 'Request Headers' section and copy the 'did' value.
- Paste the 'did' value into the WEBULL_SECURITY_DID field in the _secrets.py file with 0 spaces between any of the quotes.
By passing the image verification on Webull, after saving the DID created on your initial load of the Webull page, that DID is logged as having succesfully completed that verification. So, we need to pass this ID with your credentials, so that Webull doesn't require image verification when accessing the account via this script - which we cannot handle progmatically.
Using this method, you will seldom need to redo your login. The script should continue to work for a period of time - I will update this section if an expiration time is discovered.
To read the original post on this process provided by the package used in this script, please visit them here.
To configure the Discord webhook:
- Open the settings.json file in a text editor.
- Enter the Discord webhook URL and webhook author name in the file:
{
"Webhook URL": "your_discord_webhook_url_here",
"Username": "XyzTradez"
}
To run the script:
- Ensure that the _secrets.py file is saved and closed.
- Open a command prompt or terminal window in the project directory.
- Run the run.bat file by double-clicking on it. This will start the script and handle any unexpected script exits so that errors can be read.