Skip to content

Authentication

Authentication

Python SDK V3

This authentication guide is for Nubra Python SDK 0.5.3 and the V3 trading flow on Nubra Cloud.

Use the authenticated SDK client across instruments, market data, portfolio, and trading workflows.

Authentication creates a logged-in SDK session that can be reused across instruments, market data, portfolio, and trading classes.

Use this page when you need to:

  • initialize the SDK on Nubra Cloud using API key login
  • reuse the authenticated client across instruments, market data, and trading workflows
  • reset an existing auth session

LLM guidance

Treat authentication as a process-level prerequisite, not a per-request action. Initialize the SDK once, then reuse the authenticated client across instruments, market data, and trading workflows. On Nubra Cloud, authentication never prompts for a phone number, OTP, MPIN, or TOTP — the API key is provisioned and injected by the Cloud runtime automatically, and the SDK captures it internally.

Basic Usage

Nubra Cloud authenticates with api_key_login=True. The API key itself is injected into the runtime environment by Nubra Cloud and read by the SDK internally — do not read it, print it, or pass it manually.

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv

<a id="page-authentication--use-nubraenvprod-with-api-key-login-on-nubra-cloud"></a>
# Use NubraEnv.PROD with api_key_login=True on Nubra Cloud.
nubra = InitNubraSdk(NubraEnv.PROD, api_key_login=True)

<a id="page-authentication--reuse-the-authenticated-client-across-modules"></a>
# Reuse the authenticated client across modules.
<a id="page-authentication--example"></a>
# Example:
<a id="page-authentication--instruments-instrumentdatanubra"></a>
# instruments = InstrumentData(nubra)
<a id="page-authentication--market-data-marketdatanubra"></a>
# market_data = MarketData(nubra)
<a id="page-authentication--trader-nubratradernubra"></a>
# trader = NubraTrader(nubra)

If you want to fully reset the session:

nubra.logout()

SDK Surface

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv

InitNubraSdk(
    env: NubraEnv,
    api_key_login: bool = False,
)

V3 enablement

Trading requests require the account-side Sentinel/OMS flag to be enabled by Nubra. If the account is not enabled yet, the client will not reach the V3 trading backend.

Session helpers exposed on the initialized client include:

  • logout()

Authentication Modes

Mode Trigger User inputs Best use case
API key login api_key_login=True none — the API key is injected automatically by the Nubra Cloud runtime all Nubra Cloud strategies and integrations

Session Behavior

Authentication creates a reusable session for the initialized client.

  • Reuse the same nubra client across SDK modules
  • Avoid re-initializing authentication for every small task
  • Use logout() when you intentionally want to clear the active session

Important Rules

  • Nubra Cloud only runs against NubraEnv.PROD. There is no separate sandbox environment.
  • Always initialize with api_key_login=True. Phone/OTP, TOTP, and institutional login flows are not used on Nubra Cloud.
  • Never read, print, hardcode, or pass the API key yourself — the Cloud runtime injects it and the SDK captures it internally.
  • logout() resets the active session, so the next initialization may require re-running InitNubraSdk(...).
  • After authentication, reuse the initialized client across reference-data, market-data, portfolio, and trading modules.

After authentication, the most common next pages are:

  1. Get Instruments
  2. Current Price
  3. Place Order

NEO Assistant