Placing multi-leg option strategies through broker APIs is usually harder than it should be.
A trader may know exactly what they want to deploy, such as a straddle, strangle, iron condor, or another hedged F&O structure. But turning that idea into an executable API payload often becomes a separate engineering problem.
That is the gap this blog addresses.
Why Multi-Leg Order Payloads Become Painful#
Across most broker APIs, placing a multi-leg options strategy usually means doing all of the following manually:
- identify the correct contracts for every leg
- resolve the correct expiry format
- fetch the correct
ref_idfor each option - calculate quantity using the contract lot size
- assemble basket-level parameters
- derive a realistic entry price so the basket gets accepted and executed cleanly
This creates friction even for simple two-leg strategies.
The problem is not that traders do not understand strategies. The problem is that strategy intent and execution payloads are too far apart.
Where Nubra Flexi Orders Help#
Nubra solves this with Flexi Orders.
A Flexi Order is not just a batch of separate orders. It is a basket-level strategy order where the legs and the basket parameters are sent together in one API call.
That means you can define:
- multiple legs in one basket
- basket-level execution parameters
- entry price
- stop loss
- exit price
- multiplier
- time-based controls
So instead of thinking in terms of disconnected leg-by-leg placement, you can think in terms of strategy execution.
The Real Problem: Building the Payload#
Even with a Flexi Order API, one issue still remains:
the final payload still needs to be built correctly.
In practice, that means a developer still has to:
- map the underlying to the right contracts
- pick the intended expiry
- decide the buy or sell side for each leg
- fetch quotes
- calculate basket pricing
- build the final
trade.flexi_order(...)request object
This is exactly where repetitive boilerplate keeps showing up in trading code.
Introducing Options Strategies Payload#
To make this easier, we built nubra-flexi-payload.
PyPI package: https://pypi.org/project/nubra-flexi-payload/
The package helps build a ready-to-send Nubra Flexi Order payload from high-level strategy inputs.
Instead of manually constructing the final basket request every time, you provide the strategy definition at a much simpler level, such as:
- underlying
- expiry selection
- side
- leg structure
From there, the package helps resolve the contracts, calculate quantities, and build the final payload that can be submitted in one go.
What the Package Handles#
According to the current PyPI package description for nubra-flexi-payload version 0.1.2 released on March 12, 2026, it helps with:
- building grouped strategy input from one underlying and multiple option legs
- resolving correct option instruments from the instrument master
- supporting relative expiry inputs like
week0,week1,week2,week3, andmonth - calculating per-leg quantity from lot size and requested lots
- building the final
trade.flexi_order(...)payload - setting an aggressive basket limit price so the flexi order can be placed without manually deriving strategy premium
Install#
pip install nubra-flexi-payloadA Simple Workflow#
With Nubra, the workflow becomes much cleaner:
- Define the strategy at a higher level.
- Let the payload builder resolve contracts and quantities.
- Generate the Flexi Order payload.
- Send the basket through
trade.flexi_order(...).
That reduces the amount of hand-built execution code needed for every strategy deployment.
Example: Build and Place a Flexi Basket#
from nubra_python_sdk.marketdata.market_data import MarketData
from nubra_python_sdk.refdata.instruments import InstrumentData
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.trading.trading_data import NubraTrader
from nubra_python_sdk.trading.trading_enum import DeliveryTypeEnum, ExchangeEnum
from nubra_flexi_payload import (
build_option_strategy,
build_flexi_payload,
quote_fetcher_factory,
)
nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
instruments = InstrumentData(nubra)
md = MarketData(nubra)
trade = NubraTrader(nubra, version="V2")
symbols = build_option_strategy(
underlying="NIFTY",
legs=[
[23500, "PE", "week0", "SELL", 1],
[23900, "CE", "week0", "SELL", 1],
],
)
payload = build_flexi_payload(
symbols=symbols,
instruments_df=instruments.get_instruments_dataframe(exchange="NSE"),
quote_fetcher=quote_fetcher_factory(md),
basket_name="AutoBuiltFlexiStrategy",
tag="auto_entry",
exchange=ExchangeEnum.NSE,
multiplier=3,
order_delivery_type=DeliveryTypeEnum.ORDER_DELIVERY_TYPE_CNC,
limit_buffer_paise=500,
)
trade.flexi_order(payload)Why This Matters#
This matters because multi-leg strategy execution usually fails at the interface between:
- what the trader wants to do
- what the broker API expects
If every strategy requires manual contract resolution, quote handling, basket pricing logic, and per-leg quantity assembly, then strategy deployment becomes slow, error-prone, and difficult to scale.
With Nubra:
- the broker supports strategy-level execution through Flexi Orders
- the payload builder reduces the effort needed to prepare that order
That is a practical improvement for both traders and developers building live F&O systems.
Typical Use Cases#
This is especially useful when building and deploying:
- short straddles
- short strangles
- iron condors
- iron butterflies
- hedged directional option structures
- repeatable basket-based execution systems
Final Take#
Multi-leg order placement has always been one of the more frustrating parts of broker API integration.
Nubra reduces that friction in two layers:
- Flexi Orders let you place complex F&O strategies in one API call
nubra-flexi-payloadmakes it easier to build that payload from simpler strategy inputs
So instead of spending time assembling every execution detail manually, you can focus more on the actual strategy logic.
If your workflow depends on repeatable multi-leg options execution, this is one of the cleanest ways to move from strategy idea to strategy payload to live placement with much less boilerplate.
