Skip to content

Strategy Portfolio

Use strategy portfolio APIs to view positions, holdings, PnL, and orders grouped by stratTag.

A strategy tag is created when an order is placed or updated with a tag. In V3, one order can carry only one strategy tag.

Strategy tag rules

  • Use only one tag inside stratTags.
  • Use hyphen-separated tag names only, such as momentum-breakout.
  • Do not use underscores, spaces, colons, plus signs, timestamps, or other special characters.
  • Maximum tag length is 64 characters.

Basic Setup

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.portfolio.portfolio_data import NubraPortfolio
from nubra_python_sdk.portfolio.validation import StratOrderUpdate

nubra = InitNubraSdk(NubraEnv.PROD, env_creds=True)
portfolio = NubraPortfolio(nubra)

List Active Strategy Tags

result = portfolio.strategy_tags()

print(result.stratTags)

Example response:

stratTags=["momentum-breakout", "weekly-hedge"]

Get Positions By Strategy Tag

Use strategy_positions() to fetch filled portfolio positions grouped by strategy tag.

result = portfolio.strategy_positions(tags=["momentum-breakout"])

for item in result.stratPortfolios:
    print(item.stratTag)
    print(item.portfolio.positionStats.totalPnl)
    for position in item.portfolio.positions:
        print(position.symbol, position.netQty, position.pnl)

Get Holdings By Strategy Tag

result = portfolio.strategy_holdings(tags=["delivery-portfolio"])

for item in result.stratPortfolios:
    print(item.stratTag)
    print(item.portfolio.holdingStats.totalPnl)
    for holding in item.portfolio.holdings:
        print(holding.symbol, holding.qty, holding.netPnl)

Get PnL Summary By Strategy Tag

result = portfolio.strategy_summary(tags=["momentum-breakout"])

print(result.totalPnl)

for item in result.stratPortfolios:
    print(item.stratTag, item.totalPnl, item.todayPnl)

Example response shape:

stratPortfolios=[
    {
        "stratTag": "momentum-breakout",
        "totalPnl": 12500,
        "todayPnl": 3400,
        "startOfDayRealisedPnl": 0
    }
]
totalPnl=12500

Get Orders By Strategy Tag

Use strategy_orders() when you need tagged intent orders grouped by order status.

result = portfolio.strategy_orders("momentum-breakout")

entry = result.get("momentum-breakout")
if entry and entry.intentOrders:
    open_orders = entry.intentOrders.orders.get("open", [])
    executed_orders = entry.intentOrders.orders.get("executed", [])

    print("open:", len(open_orders))
    print("executed:", len(executed_orders))

You can also flatten orders across buckets:

orders = result.orders_for("momentum-breakout")
executed_orders = result.orders_for("momentum-breakout", "executed")

Add Or Move A Tag On An Order

Use update_strategy_tags() to add, move, or clear a tag on existing intent orders.

result = portfolio.update_strategy_tags([
    StratOrderUpdate(
        orderId=123456,
        oldStratTags=[],
        newStratTags=["momentum-breakout"]
    )
])

print(result.results)

To move an order from one tag to another, pass the current tag in oldStratTags and the new tag in newStratTags.

result = portfolio.update_strategy_tags([
    StratOrderUpdate(
        orderId=123456,
        oldStratTags=["momentum-breakout"],
        newStratTags=["weekly-hedge"]
    )
])

Clear A Tag From An Order

result = portfolio.update_strategy_tags([
    StratOrderUpdate(
        orderId=123456,
        clearTags=True
    )
])

Apply One Tag To Multiple Orders

Use set_strategy_tag_orders() to apply one strategy tag to a list of intent order IDs.

result = portfolio.set_strategy_tag_orders(
    order_ids=[123456, 123457],
    tag="weekly-hedge"
)

print(result.results)

Delete A Strategy Portfolio

Deleting a strategy portfolio removes the tag from the portfolio view. The orders themselves are not deleted.

portfolio.delete_strategy_portfolio("weekly-hedge")

Response Scope

API Scope
strategy_tags() Active strategy tags for the account
strategy_positions() Filled portfolio positions grouped by tag
strategy_holdings() Holdings grouped by tag
strategy_summary() Strategy-level PnL summary
strategy_orders() Intent orders grouped by tag and status

Important Rules

Important Rules

  • Strategy portfolio is available for V3 mapped accounts.
  • One order can have only one strategy tag.
  • Portfolio views such as positions, holdings, and summary reflect filled portfolio data.
  • strategy_orders() is an intent-order view and can show open, executed, cancelled, rejected, expired, and GTT buckets.
  • Monetary fields are typically returned in exchange-native integer units such as paise for NSE instruments.
  1. Positions
  2. Holdings
  3. Get Orders
NEO Assistant