How can I connect the Custom Bridge with Python code?

Asked by Radhesh Joshi · SOLVED
1 reply 767 views Jump to solution Reply
Radhesh Joshi Original Post
Strategy Builder

I am a developer and have built my own strategy in Python that monitors NIFTY.

What I want is that whenever my Python code generates a Buy signal, AlgoDelta should execute whatever is configured in the Up Side Execution of the Custom Bridge.

Similarly, when my Python code generates a Sell signal, I want the Down Side Execution to happen automatically.

How can I achieve this?

Posted Jul 7
Reply

    1 Reply

    Support AlgoDelta
    Support AlgoDelta AlgoDelta Support ·

    Yes sir, you can definitely do that.

    The Custom Bridge is designed exactly for these kinds of integrations.

    You simply need to send a webhook request from your Python code whenever your trading conditions are satisfied.

    The important part is:

    -UP → Executes the configured Upside Execution

    -DOWN → Executes the configured Downside Execution

    -EXIT → Squares off the existing position

    Below is a simple Python example:

    import requests
    
    WEBHOOK_URL = "https://apiv4.algodelta.com/api/v4/users/bridge/webhook/151841/Test123"
    
    def send_signal(signal):
        response = requests.post(
            WEBHOOK_URL,
            data=signal,
            headers={
                "Content-Type": "text/plain"
            }
        )
        print(response.status_code)
        print(response.text)
    
    # Buy Signal
    send_signal("UP")
    
    # Sell Signal
    send_signal("DOWN")
    
    # Exit Existing Position
    send_signal("EXIT")

    Now you just have to call the function wherever your strategy conditions are met.

    Example:

    if buy_signal:
        send_signal("UP")
    
    elif sell_signal:
        send_signal("DOWN")
    
    elif exit_signal:
        send_signal("EXIT")

    That’s it.

    Whenever your Python strategy sends:

    -UP → AlgoDelta executes the Upside configuration

    -DOWN → AlgoDelta executes the Downside configuration

    -EXIT → AlgoDelta exits the active position

    This is one of the easiest ways to integrate Python strategies with AlgoDelta’s Custom Bridge.

    Verified Solution
    • Appreciate your answer and with the code it’s super easy to integrate the custom bridge with python, now I can be able to integrate the Custom bridge easily. Thanks for code and explanation. – Radhesh Joshi Jul 28
    Markdown supported · ```json for code blocks · paste or drop screenshots

    Be specific and kind. Never share API keys, passwords or personal account details.

    Welcome to the community

    Log in or create your account in under a minute.

    1. 1Mobile
    2. 2E-mail
    3. 3Password
    +91

    Have a password?

    By continuing you agree to the community guidelines. We’ll send a one-time code by SMS.