Coding Prompts Archive
This page archives effective AI prompts used during development of the TradeEntry platform.
Feature: Bhav Downloader Progress Polling
Context: Frontend polling for background task completion without WebSocket.
Prompt:
The FastAPI BackgroundTasks dispatches after the HTTP response is sent,
so the frontend polling can see stale stats.json. How do I implement
a hasSeenRunning guard so the React interval doesn't stop prematurely?
Key Insight: Close over a mutable hasSeenRunning boolean inside the setInterval callback. Only stop polling after you have seen at least one RUNNING state.
Feature: AMI Multi-File Download
Context: Allow users to select multiple AMI export files and download as ZIP.
Prompt:
FastAPI endpoint that accepts a list of filenames, validates each with
regex, and returns a single ZIP file via StreamingResponse using in-memory BytesIO.
Solution: Used zipfile.ZipFile(buf, "w", ZIP_DEFLATED) into an io.BytesIO buffer, then returned StreamingResponse(buf).
Feature: NSE Working Days Calculation
Context: Determine which dates to sync bhav copies for.
Prompt:
How do I compute NSE trading days between two dates, excluding weekends
and NSE holidays, using pandas?
Bug Fix: Unicode in Windows Print
Context: → and … characters in log messages failed on Windows cp1252.
Prompt:
'charmap' codec can't encode character '→' on Windows when printing
to console. How to fix without changing the system locale?
Solution: Replace Unicode characters with ASCII equivalents (→ → to, … → ...).
Placeholder: Add More Prompts Here
Add new effective prompts as you develop features. Include context, the prompt text, and the key solution or insight gained.