Indian stock market • Open source

GTT Trigger Price Calculator

Enter a stock's current price to prepare candidate buy and sell trigger prices before placing a GTT order with your broker.

Problem

Setting up a Good Till Triggered (GTT) order can involve checking the trigger distance, rounding the price correctly, and translating an investment amount into shares. This tool brings those steps together for Indian stock-market orders and shows the candidate values before anything is entered with a broker.

Architecture

Decision support, deliberately separated from trade executionThe Streamlit app applies visible rules and returns candidate values for the visitor to verify.
  • Visitor inputCurrent price, rounding multiple, amount, or share count
  • Streamlit applicationValidation, calculation, rounding, and synchronized fields
  • Broker remains separateNo credentials, live prices, account access, or trade execution

Prepare candidate GTT values

Inputs become reviewable values without crossing into a brokerage account.

  1. InputCurrent pricePositive numeric value
  2. RuleDistance bufferThreshold-based adjustment
  3. RulePrice roundingSelected multiple
  4. StateAmount or sharesSynchronized calculation
  5. ReviewCandidate valuesVisitor verifies before use

Execution boundaryThe calculator prepares values only; it does not place orders or confirm current broker rules.

Current implementation

  • Accepts a positive current stock price and a configurable rounding multiple.
  • For prices at or above ₹50, the code applies a 0.256% distance buffer; below ₹50, it applies ₹0.09.
  • Rounds candidate buy and sell triggers to the selected multiple, with ₹0.05 as the interface default.
  • Uses Streamlit session state and callbacks to calculate share count from amount, or amount from share count.
  • Rejects non-numeric and non-positive price input with visible feedback.

Engineering decisions

  • Keep the rule visible. The calculation stays in a short, inspectable Python function, so its thresholds, rounding operation, and fallback behavior can be reviewed directly in app.py.
  • Keep calculation separate from trading. The application does not connect to a brokerage account, place a trade, retrieve a live market price, or collect credentials. The visitor verifies the result before using it.
  • Keep amount and share inputs synchronized. Streamlit callbacks track which value changed last, clear the paired field, and calculate the corresponding value with conservative floor operations.

Trade-offs and limits

  • Broker rules and allowed tick sizes can change; the repository contains hard-coded assumptions rather than a versioned authoritative rules source.
  • The public repository contains no automated tests, so boundary values and rounding behavior are not protected against regression.
  • requirements.txt names Streamlit without pinning a version, which weakens reproducibility.
  • The hosted Streamlit app currently redirects through Streamlit authentication, so some visitors may be asked to sign in before using it.
  • This utility is not financial advice and does not guarantee that a broker will accept a calculated value.

Evidence: public source, README, license, and repository metadata reviewed July 12, 2026. No claims are made about trading outcomes, usage, current broker-policy accuracy, or production scale.

Review the repository

Have a workflow that needs clearer rules and fewer manual calculations?