Strategy Management
from openalgo import Strategy
# Initialize strategy client
client = Strategy(
host_url="http://127.0.0.1:5000", # Your OpenAlgo server URL
webhook_id="your-webhook-id" # Get this from OpenAlgo strategy section
)
# Example 1: Long/Short only mode (configured in OpenAlgo)
#Trading Mode - Long/Short only mode (configured in OpenAlgo)
client.strategyorder("RELIANCE", "BUY")
client.strategyorder("RELIANCE", "SELL")
#Trading Mode - BOTH - Long Entry
client.strategyorder("RELIANCE", "BUY",10)
# Example 2: BOTH mode (configured in OpenAlgo)
#Trading Mode - BOTH - Long Exit
client.strategyorder("RELIANCE", "SELL",0)
#Trading Mode - BOTH - Short Entry
client.strategyorder("RELIANCE", "SELL",10)
#Trading Mode - BOTH - Short Exit
client.strategyorder("RELIANCE", "BUY",0)
Last updated