Independent Lot Processing System
(Dual-Mode: Sell and Buy)
Developer Brief
Objective:
Design and develop a system that manages independent, autonomous trade units ("lots") based on configurable price movement, loss, gain, and time conditions.
The system must support two distinct modes of operation:
Both modes must be able to run independently, individually, or simultaneously based on user-defined inputs without requiring any change in the underlying code.
Core System Behavior
1. Independent Lot Management (Sell and Buy Modes)
Each trade lot created must be treated as an independent autonomous unit.
No linkage between lots (even across different modes).
Each lot monitors its own live market conditions for its specific trigger rules.
2. Trigger Conditions per Mode
Condition TypeSell Mode BehaviourBuy Mode BehaviourLoss TriggerCreate new lot on opposite sideCreate new lot on same sideGain TriggerExit the current lot; optional reentry on same sideExit the current lot; optional reentryRevisit PriceCreate fresh new lots on both sides if previously acted price revisitedSame behavior applies (optional config)Time + Movement ProfitClose lot after specified time+decay/move comboClose lot after specified time+move comboTrigger thresholds (₹ or %) are individually configurable for each mode
3. Scaling Logic
AspectSell Mode Buy Mode Scaling after triggersOptional, user-defined scaling after lossOptional, user-defined scaling after lossScaling multiplier (e.g., 1x, 1.5x, 2x) is configurable separately for each mode
4. Lot and Position Controls
Separate limits apply independently to Sell and Buy modes.
5. Mode Scheduling (New Requirement)
Example input possibilities:
WeekdayMode to runMondaySell Mode OnlyTuesdayBoth Sell and Buy ModesWednesdayBuy Mode Only
✅ System must auto-select based on day OR allow manual override.
✅ Both modes can run simultaneously without interfering with each other.
✅ Separate internal management of Sell Lots and Buy Lots needed.
6. Periodic Recycling and Refresh Logic
At configurable intervals (e.g., every 30 minutes): ➔ System can close a specified percentage (e.g., top 20%) of profitable lots. ➔ Fresh lots can be reentered based on current conditions if allowed by mode settings.
Separate recycling settings must exist for each mode.
7. Execution Requirements
High-frequency price monitoring (~1 sec or better if feasible).
Orders to default as Market orders unless otherwise configured.
Action logs must be maintained independently for:
Sell Mode events
Buy Mode events
8. Dashboard and Controls
Dashboard must display separately for Sell Mode and Buy Mode:
MetricDescriptionTotal active Sell lotsDisplay CountTotal active Buy lotsDisplay CountP&L per modeDisplay SeparatelyManual ControlsPause/Resume/Kill for each modeManual close top profit lotsAvailable per modeEvent LogsTimestamped Actions per mode
Input Parameters (User Configurable)
Initial lot size
Loss trigger (₹ or %)
Gain trigger (₹ or %)
Revisit Logic On/Off
Max open lots
Scaling factor
Time + Movement combo closure
Recycling interval and %
Execution type (Market/Limit)
Weekday activation
Manual override toggle
Technical Requirements and Constraints
No interlinking of lots between Sell and Buy modes.
No prediction, learning, or position inference allowed.
Only trigger-response event execution.
System must be able to function independently for each mode simultaneously.
Minimal latency preferred.
Configurable via external parameter files.
Developer Guidance
The project is purely mechanical — no assumptions about why trades are opened, exited, or scaled.
Modes are simply "operation styles," not tied to any external strategy assumptions.
System must be designed cleanly so modes can operate:
Independently
Simultaneously
Manually switchable
No business logic embedding is required beyond defined triggers.
Deliverables:
Modular codebase
Config file templates
Flow diagrams for:
Sell Mode Lot Lifecycle
Buy Mode Lot Lifecycle
Dual Mode Management
Documentation:
Parameter descriptions
Trigger-action mapping
Dashboard layout reference