# Python Library

Follow these Tutorial video to   add and use  the algomojo extension:

Video Tutorial

{% embed url="<https://youtu.be/6UIo_rLazAs>" %}

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**:

   ```sh
   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](https://www.python.org/).
2. Run the installer and **enable the "Add Python to PATH" option** during installation.
3. Once installed, verify by running:

   ```sh
   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:

   ```sh
   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:

   ```python
   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:

   ```sh
   shCopyEditcd path\to\your\directory
   ```
3. Execute the script by running:

   ```sh
   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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.algomojo.com/algomojo/bridge/python-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
