Skip to main content

Build Nubra flexi basket payloads from grouped option legs

Project description

nubra_flexi_payload

Build Nubra flexi basket payloads from grouped option strategy input.

Install

pip install nubra-flexi-payload

Public API

  • build_option_strategy(...)
  • build_flexi_payload(...)
  • quote_fetcher_factory(md_instance)

Usage

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)

Leg Input

Each leg can be passed as either:

  • [strike, option_type, expiry_type, side, lots]
  • {"strike": 302.5, "option_type": "PE", "expiry_type": "week1", "side": "BUY", "lots": 1}

Supported expiry_type values:

  • week0: current or nearest live expiry
  • week1: next expiry after week0
  • week2: next expiry after week1
  • week3: next expiry after week2
  • month: current month's monthly expiry

If a requested weekly expiry is not available for that underlying, the module falls back to the current month's monthly expiry.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nubra_flexi_payload-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nubra_flexi_payload-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file nubra_flexi_payload-0.1.1.tar.gz.

File metadata

  • Download URL: nubra_flexi_payload-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for nubra_flexi_payload-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c6d5d7fa0cbde596aaf7b481803c24d85cd6f01a4ba0a3e66d74231c3340744
MD5 439a76a430165c4aa6a9bec3720e1141
BLAKE2b-256 0e28f28c2d9dc02c56bd1d7790b5c08d788a86db06f5cc36299510c66f66ea75

See more details on using hashes here.

File details

Details for the file nubra_flexi_payload-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nubra_flexi_payload-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebaf7a1c52fad1039c9af15e9417d8c6bb15386f381ad15eb273bac104cc75db
MD5 b010778774bf22ba9079ec7bb441c409
BLAKE2b-256 b723aaf5a74b6b9395fc8f088634605a9395e5dcd069673658956c97958117f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page