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

  1. Open the Command Prompt (CMD).

  2. Type the following command and press Enter:

    shCopyEditpython --version
  3. If Python is installed, you will see the version number.

Step 2: Install Python (If Not Installed)

  1. If Python is not installed, download it from python.org.

  2. Run the installer and enable the "Add Python to PATH" option during installation.

  3. Once installed, verify by running:

    shCopyEditpython --version

Step 3: Install the algomojo-webhook-signal Library

  1. Open Command Prompt (CMD).

  2. Run the following command to install the required library:

    shCopyEditpip install algomojo-webhook-signal

Step 4: Create a Python Script

  1. Open a text editor (e.g., Notepad, VS Code, or PyCharm).

  2. 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)
  3. Replace "YOUR_WEBHOOK_URL" with your actual strategy webhook URL from Algomojo.

  4. Set the action as "BUY" or "SELL" as required.

Step 5: Save the Script

  1. Click File > Save As.

  2. Name the file send_signal.py and save it in a preferred directory.

Step 6: Run the Script

  1. Open Command Prompt (CMD) or Terminal.

  2. Navigate to the directory where the file is saved using the cd command:

    shCopyEditcd path\to\your\directory
  3. 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?