Yes sir, you can definitely do that.
The JSON Bridge is designed exactly for this type of integration.
You simply need to generate your JSON syntax from the JSON Bridge and send the appropriate JSON payload to the JSON Bridge webhook whenever your strategy conditions are satisfied.
For example, suppose you have generated the following syntaxes.
Buy Signal Syntax:
{
"type": "strategy_order",
"exit_on_opposite": true,
"is_tgt": false,
"is_sl": false,
"is_trail_set": false,
"position_size": "{{strategy.position_size}}",
"transaction_type": "BUY",
"script_type": "CE",
"is_rollover": false,
"option_selection": "ATM_BASED",
"script": "NIFTY-N",
"atm_gap": 0,
"expiry_gap": 0,
"expiry_type": "weekly",
"product": "CARRYFORWARD",
"quantity": 1
}
Sell Signal Syntax:
{
"type": "strategy_order",
"exit_on_opposite": true,
"is_tgt": false,
"is_sl": false,
"is_trail_set": false,
"position_size": "{{strategy.position_size}}",
"transaction_type": "BUY",
"script_type": "PE",
"is_rollover": false,
"option_selection": "ATM_BASED",
"script": "NIFTY-N",
"atm_gap": 0,
"expiry_gap": 0,
"expiry_type": "weekly",
"product": "CARRYFORWARD",
"quantity": 1
}
Then you can integrate it with Python like below:
import requests
WEBHOOK_URL = "https://apiv4.algodelta.com/api/v4/users/jsonbridge/webhook/212602030/0b73f099933"
BUY_JSON = {
"type": "strategy_order",
"exit_on_opposite": True,
"is_tgt": False,
"is_sl": False,
"is_trail_set": False,
"position_size": "{{strategy.position_size}}",
"transaction_type": "BUY",
"script_type": "CE",
"is_rollover": False,
"option_selection": "ATM_BASED",
"script": "NIFTY-N",
"atm_gap": 0,
"expiry_gap": 0,
"expiry_type": "weekly",
"product": "CARRYFORWARD",
"quantity": 1
}
SELL_JSON = {
"type": "strategy_order",
"exit_on_opposite": True,
"is_tgt": False,
"is_sl": False,
"is_trail_set": False,
"position_size": "{{strategy.position_size}}",
"transaction_type": "BUY",
"script_type": "PE",
"is_rollover": False,
"option_selection": "ATM_BASED",
"script": "NIFTY-N",
"atm_gap": 0,
"expiry_gap": 0,
"expiry_type": "weekly",
"product": "CARRYFORWARD",
"quantity": 1
}
def send_signal(payload):
response = requests.post(
WEBHOOK_URL,
json=payload
)
print(response.status_code)
print(response.text)
if buy_signal:
send_signal(BUY_JSON)
elif sell_signal:
send_signal(SELL_JSON)
That’s it.
Now whenever your Python strategy generates a Buy signal, the Call Option syntax will be executed automatically.
Similarly, whenever a Sell signal is generated, the Put Option syntax will be sent to AlgoDelta and executed.
This is one of the easiest ways to integrate your Python strategies directly with AlgoDelta’s JSON Bridge.