Python Library
Follow these Tutorial video to add and use the algomojo extension:
Video Tutorial
Follow these steps to set up and send a trading signal using the algomojo-webhook-signal library:
Step 1: Check Python Installation
Open the Command Prompt (CMD).
Type the following command and press Enter:
shCopyEditpython --version
If Python is installed, you will see the version number.
Step 2: Install Python (If Not Installed)
If Python is not installed, download it from python.org.
Run the installer and enable the "Add Python to PATH" option during installation.
Once installed, verify by running:
shCopyEditpython --version
Step 3: Install the algomojo-webhook-signal
Library
Open Command Prompt (CMD).
Run the following command to install the required library:
shCopyEditpip install algomojo-webhook-signal
Step 4: Create a Python Script
Open a text editor (e.g., Notepad, VS Code, or PyCharm).
Copy and paste the following code:
from algomojo_webhook_signal import place_strategy_signal from datetime import datetime # Replace with your actual Algomojo webhook URL webhook_url = "<YOUR_WEBHOOK_URL>" # Get the current date and time in YYYY-MM-DD HH:MM:SS format date = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Define the action ('BUY' or 'SELL') action = "BUY" # Change to "SELL" for a sell signal # Place the strategy signal response = place_strategy_signal(webhook_url, date, action) # Print the response print(response)
Replace
"YOUR_WEBHOOK_URL"
with your actual strategy webhook URL from Algomojo.Set the action as
"BUY"
or"SELL"
as required.
Step 5: Save the Script
Click File > Save As.
Name the file send_signal.py and save it in a preferred directory.
Step 6: Run the Script
Open Command Prompt (CMD) or Terminal.
Navigate to the directory where the file is saved using the
cd
command:shCopyEditcd path\to\your\directory
Execute the script by running:
shCopyEditpython send_signal.py
Step 7: Verify the Signal Response
If the execution is successful, you will see a response with a signal ID, confirming that the signal has been sent.
Last updated
Was this helpful?