Skip to content

Strategies

Your first paper strategy ​

Start with a strategy that observes minute events. This lets you verify the feed, market clock and runner before adding leg or order logic.

Prepare a data source ​

Connect a market-data account, select the underlying you want to observe and verify that its minute candles appear in Connections → Data streaming. Use the same market and underlying in the strategy settings.

Create the strategy ​

Open Strategies → New strategy. Name it Session observer, then paste the following class into Strategy code (Python).

python
from eventManagerV2 import Strategy


class SessionObserver(Strategy):
    def init(self):
        self.minutes = 0

    def onNewDay(self):
        self.minutes = 0

    def minTrigger(self):
        self.minutes += 1

The runner calls init at initialization and onNewDay at the beginning of a session. The minTrigger hook updates a counter in the strategy process. This example creates no legs, so an empty orders list is expected.

Check and run ​

  1. Select Check code. Resolve any validation message before saving.
  2. Set the symbol to the underlying you selected for streaming. For this example, choose an Indian index.
  3. Choose Paper execution, review the run days and times, then select Create strategy.
  4. Open the saved strategy and start it. Inspect its state and run history. The configured session and run days determine when it can run.

Open Updates if initialization fails. If the strategy is waiting, check the calendar, session time and availability of candles. Stop the strategy before editing its code or execution settings.

Add trading logic later ​

Use the SDK’s leg interface when a strategy needs an entry, exit, stop or target. Paper legs are tracked against market prices. Live execution routes intents to the selected broker accounts.

Read the strategy SDK and leg reference for supported hooks and leg settings.