share-ai

byKishan Sharma

# Replit Agent Prompt: Autonomous Indian Intraday AI Paper-Trading System (PAPER TRADING ONLY) Build this complete system in one pass — no phases, no check-ins mid-build. Give one final report at the end: what was built, what was tested, what needs my attention. ## Safety rules (absolute, no exceptions) - PAPER TRADING ONLY. No real orders, ever, under any framing. - Upstox integration = **read-only market data only** (quotes/OHLC/depth/WebSocket ticks). Never request or call any order-placement/modify/cancel endpoint. No such code path anywhere, not even disabled/commented. - All trades are simulated: just a row written to our own `trades` table. - **Do NOT ask me for the Upstox API key/secret during the build.** Leave them as empty environment variables / Replit Secrets placeholders (e.g. `UPSTOX_API_KEY`, `UPSTOX_API_SECRET`) that I will fill in myself manually after the build is complete — I'm keeping these confidential. Build and test everything else (including the Market Data Agent's code) without needing real values; use mocked/dummy data for any test that would otherwise require live credentials. - Before finishing, search the codebase yourself for any broker order-placement calls and confirm zero. Report this explicitly. - Upstox tokens expire daily — login must stay a manual step each day (no stored password/TOTP). ## What it does Once I start it, it runs autonomously through NSE hours (09:15–15:30 IST, configurable) with only a manual STOP/HALT control: scan → rank → analyze → challenge → risk-check → decide → paper-execute → monitor → exit → learn → repeat. ## Parameters (config file, not hardcoded) - Starting capital ₹15,000; kill switch at ₹5,000 equity - Max 1 open position; max risk 5% of equity per trade; min net R:R 1.5 - Eligible stocks: ≤ ₹1,500/share; top 5 candidates (long + short) - Opportunity Scout re-scans every 15 min (fixed); open trades are monitored in real time regardless of scan cycle, never interrupted by a new scan - Flat cost: ₹25/transaction → ₹50 per round-trip trade; net_profit = gross − 50; R:R check uses net, not gross ## Agents (separate modules) 1. **Market Data Agent** — sole owner of the Upstox connection (read-only scope only); writes live prices to a local cache DB; everyone else reads from this cache, never from Upstox directly; flags stale data (>5–10s old) as unusable. 2. **Opportunity Scout** — deterministic ranking from the cache, filtered ≤₹1,500, top 5 long+short, rationale only via LLM. 3. **Technical Agent** — chart-based PROCEED/WAIT + entry/target/stop-loss plan. 4. **Regime Agent** — market-context classification (trending/choppy/vol). 5. **News Agent** — pluggable provider, simulated for now, tagged SIMULATED/LIVE/UNKNOWN. 6. **Trade Proposal** — deterministic merge of 3–5. 7. **Critic** — deterministic hard checks + LLM adversarial pass; can veto. 8. **Risk Manager** — 100% deterministic, hard veto, no LLM. 9. **Main AI** — final PROCEED/WAIT using net R:R vs. 1.5 minimum; low/fixed temp, strict schema, can't override Risk Manager or Final Safety Gate. 10. **Final Safety Gate** — deterministic last check. 11. **Paper Execution** — writes simulated trade to DB only. 12. **Position Manager** — real-time stop-loss/target/time exit monitoring, independent of Scout's scan cycle. 13. **Learning Engine** — logs closed trades, retrieval for agents' context; passive analytics only, no auto-changes to params/prompts. ## Upstox connection flow - OAuth2 login: I log into Upstox myself; app exchanges the returned code for a token using the Secrets I add manually post-build. - Dashboard shows Connect/Connected/Disconnected states; pipeline pauses if disconnected or data is stale. ## Dashboard (separate pages, not one long page) - Live Trading: live price chart (from cache), current position w/ entry/target/stop, equity vs. ₹15,000 and ₹5,000 kill line, STOP/HALT control. - Trade History/Journal. - Connection/Settings: Upstox connect status, config parameters. ## Do not add - Any real order placement, "for testing" or otherwise. - Stored/auto Upstox credentials bypassing daily manual login. - Auto-tuning of parameters/prompts by the Learning Engine. - Hardcoded universe/thresholds/costs outside the config file. NO need to make multiple pages. I need only one page which is dashboard. NO need to write essay in the dashboard. no need to write agent description. need option to connect to upstock in the top of the dashborad

No preview

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 7

System Requirements Document for share-ai

1. Introduction

The "share-ai" project is an autonomous Indian intraday AI paper-trading system designed to simulate trading activities on the National Stock Exchange (NSE) of India. The system operates within strict safety guidelines, ensuring that all trades are simulated and no real orders are placed. It is intended for a single operator, referred to as the Solo Trader/Operator, who manages the system through a single dashboard interface.

2. System Overview

The share-ai system is a fully autonomous paper-trading platform that operates during NSE trading hours. It integrates with Upstox for read-only market data and simulates trades based on a series of agent-driven analyses. The system is designed to be robust, with a focus on safety and compliance, ensuring no real trades are executed. The dashboard provides a comprehensive view of live trading data, trade history, and system settings, all within a single page.

2a. Product Interpretation and Delivery Boundary

The system is delivered as a single-page dashboard application, with all interactions and data visualizations contained within this interface. The Upstox integration is strictly read-only, and the system relies on a manual daily login process to maintain security. The system's primary function is to simulate trading activities, providing insights and analytics without executing real trades. The dashboard is the sole interface for the operator, ensuring simplicity and ease of use.

Page 2 of 7

2b. Source Content Inventory

Not applicable as no content source directive was provided.

2c. Page Content and Component Coverage

Dashboard

  • Upstox Connection Control

    • Connect/Disconnect toggle at the top of the dashboard.
    • Displays connection status: Connected, Disconnected, or Stale.
  • Live Trading Panel

    • Live price chart sourced from the local cache.
    • Current position details including entry, target, and stop-loss.
    • Equity display with ₹15,000 starting capital and ₹5,000 kill line.
    • STOP/HALT control for manual intervention.
  • Trade History/Journal

    • Log of all simulated trades executed by the system.
    • Details include trade entry, exit, profit/loss, and timestamps.
  • Connection/Settings Panel

    • Displays Upstox connection status.
    • Configurable parameters such as trading hours and risk settings.
Page 3 of 7

3. Functional Requirements

  • As a Solo Trader/Operator, I should be able to connect to Upstox manually each day to ensure secure access to market data. (explicit)
  • As a Solo Trader/Operator, I should be able to view live trading data and my current position on the dashboard to monitor trading activities. (explicit)
  • As a Solo Trader/Operator, I should be able to halt the trading process manually using the STOP/HALT control to manage risk effectively. (explicit)
  • As a Solo Trader/Operator, I should be able to review trade history and journal entries to analyze past trading decisions. (explicit)
  • As a Solo Trader/Operator, I should be able to configure trading parameters via a config file to customize the trading strategy. (explicit)

4. User Personas

Solo Trader / Operator

  • Product Context: The sole user responsible for operating the share-ai system. They initiate the trading session, monitor live data, and manage trading activities.
  • Primary Goal: To simulate trading activities and gain insights without executing real trades.
  • Distinct Responsibilities: Manually connect to Upstox, monitor live trading data, manage risk through the STOP/HALT control, and review trade history.
  • Interactions: Engages with the dashboard to connect to Upstox, view trading data, and manage trading activities.
  • Observable Success: A successful trading session with accurate simulation of trades and comprehensive trade history for analysis.
Page 4 of 7

5. Core User Flows

  1. Daily Connection to Upstox

    • Start: Solo Trader/Operator opens the dashboard.
    • Action: Uses the Connect toggle to initiate Upstox login.
    • Result: Connection status updates to Connected, allowing data flow.
    • Next Step: Monitor live trading data.
  2. Monitoring Live Trading Data

    • Start: Connection to Upstox is established.
    • Action: Solo Trader/Operator views the live price chart and current position.
    • Result: Real-time updates on trading data and equity status.
    • Next Step: Decide on any manual interventions if necessary.
  3. Halting the Trading Process

    • Start: Solo Trader/Operator identifies a need to halt trading.
    • Action: Engages the STOP/HALT control.
    • Result: Trading activities pause, and the system enters a safe state.
    • Next Step: Review trade history or adjust parameters as needed.
  4. Reviewing Trade History

    • Start: Trading session is complete or paused.
    • Action: Solo Trader/Operator accesses the Trade History/Journal.
    • Result: Detailed view of past trades for analysis.
    • Next Step: Use insights to adjust future trading strategies.
Page 5 of 7

6. Visuals Colors and Theme

  • Muse: MARQ by Garmin
  • Palette:
    • Background: #0D0F11
    • Surface: #16191D
    • Text: #EAE6DF
    • Primary: #E8A33D
    • Accent: #27C6B4
    • Muted: #767C84
  • Typography:
    • Headings: Barlow Condensed
    • Body: Saira
    • Scale: 96/64/40/28/20/15/12
  • Shape Language: Machined and flat-edged with 2–4px radii on controls.
  • Layout: 12-column grid, max 1440px width, 24px gutters.

7. Signature Design Concept

The dashboard serves as a trading cockpit, with a full-width instrument rail at the top. The left side features a full-bleed price chart with topographic grid lines, while the right side displays a vertical stack of trading instruments. The equity rail provides a quick visual reference for the user's financial status, with a prominent STOP/HALT control for immediate intervention.

Page 6 of 7

8. Interaction Model & Motion Direction

  • Interaction Model: Static
  • Motion Tempo: Restrained
  • Hero Dimensionality: Layered 2D
  • Landing Hero Motion Brief: The dashboard features restrained motion, with digit counters rolling on price updates and a pulsing live status dot. The panel greys out when data is stale, ensuring clarity and focus.

9. Non-Functional Requirements

  • Performance: The system must handle real-time data updates without lag.
  • Security: Manual daily login to Upstox ensures secure access.
  • Reliability: The system should operate autonomously during trading hours without failure.

10. Tech Stack

  • Frontend: React
  • Backend: Python/FastAPI
  • Database: Local cache DB for market data
  • Deployment: Docker/docker-compose

11. Assumptions and Constraints

  • The system operates within NSE trading hours (09:15–15:30 IST).
  • All trades are simulated, with no real order placement.
  • Upstox integration is strictly read-only.
Page 7 of 7

12. Glossary

  • NSE: National Stock Exchange of India
  • Upstox: A trading platform providing market data
  • R:R: Risk-to-Reward ratio
  • OAuth2: An authorization framework for secure API access

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Dashboard: Open cockpit
Dashboard: 1. Start Upstox login
Dashboard: 2. Confirm Connected state
Dashboard: 3. Review stale data warning
Dashboard: 1. Monitor live chart
Dashboard: 2. Check open position
Dashboard: 3. Track equity vs kill line
Dashboard: 4. Press and hold STOP/HALT
Dashboard: 5. Review trade journal
Dashboard: 6. Adjust config parameters
Dashboard: 7. Resume scanning pipeline

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Dashboard: Open cockpit
Dashboard: 1. Start Upstox login
Dashboard: 2. Confirm Connected state
Dashboard: 3. Review stale data warning
Dashboard: 1. Monitor live chart
Dashboard: 2. Check open position
Dashboard: 3. Track equity vs kill line
Dashboard: 4. Press and hold STOP/HALT
Dashboard: 5. Review trade journal
Dashboard: 6. Adjust config parameters
Dashboard: 7. Resume scanning pipeline