Skip to Content
Getting StartedAPI GuidesPositions, Funds & Risk

Manage positions, funds and risk

Build account-aware workflows by reading current exposure and available funds before deciding what action to take.

Before you begin

Step-by-step workflow

  1. Read open positions

    Retrieve current positions and identify net quantity, side, product type and available action for each position.

  2. Read holdings and available funds

    Read holdings and funds separately. Holdings represent owned instruments, while funds show the balances available for account activity.

  3. Check supported margin information

    Use the supported margin calculation before submitting an order when the workflow depends on available margin.

  4. Decide whether to exit or convert a position

    Confirm the position, quantity and intended outcome before choosing exit or conversion. Treat these as separate account-changing actions.

  5. Submit the supported position action

    Send the exit or conversion request with the verified attributes. Store the response and avoid repeating the action while its outcome is uncertain.

  6. Refresh and verify account state

    Read positions and funds again after the action. Confirm that the resulting account state matches the intended change.

  7. Verify the result

    Check the relevant API response and account or market-data state to confirm that the workflow completed successfully. If the result is partial or unsuccessful, review the returned status and message before deciding whether to retry or take another action.

Common issues

Authentication or permission failure401 Unauthorized

The access token is missing, expired, or the app does not have the required permission. Generate a fresh token and retry the request.

HTTP/1.1 401 Unauthorized
{"s":"error","code":-8,"message":"Could not authenticate the user"}
View Authentication →
Incorrect request inputs400 Bad Request

A required field is missing or invalid (symbol, quantity, side, or product type). Read the response message, correct the payload, then retry.

HTTP/1.1 400 Bad Request
{"s":"error","code":-50,"message":"Please provide valid order parameters"}
View Error Code Reference →
Plan or rate-limit restriction429 Too Many Requests

The request exceeded the plan’s rate limit or an entitlement. Back off before retrying and confirm the Standard vs Prime limits for the API you are calling.

HTTP/1.1 429 Too Many Requests
Retry-After: 1
{"s":"error","message":"Rate limit exceeded"}
Learn exponential backoff →
Temporary network or socket interruptionTimeout

The connection dropped before a response arrived. Check the latest order, position, or socket state before sending the same request again.

Error: socket hang up
ECONNRESET
View WebSocket Overview →

Prefer a guided AI workflow? Use FYERS MCP or FYERS GPT for supported portfolio and account questions through a conversational interface.

Continue with AI

Last updated on