Project: Single Strategy trading bot integrating two Trading Accounts
Scope of Work:
The project involves creating a cloud-based trading bot with a user-friendly UI that integrates my two trading accounts and implements one trading strategy. The goal is to sync and manage trades across both accounts and execute the trading strategy through an automated, rule-based system.
Part 1: Account Integration
1. Zerodha and Shoonya Integration
Part 2: Trading Strategy Implementation
A. Single Trade Mode (with Averaging Down)
This mode focuses on adding positions as the trade moves, both in profit and loss scenarios:
Trade Initiation: The bot initiates a trade (buy/sell) at a specified time or price, setting this as the base price for subsequent moves.
Profit Booking: If the price moves above the base, the system books partial profits (using a formula) and adds more positions at the next level.
Loss Booking: If the price returns to a previous level, partial losses are booked (based on table values).
Averaging Down: If the price falls below the base level, the system automatically averages down based on pre-set rules.
Square Off: All trades are closed at the end of the trading day (based on time or manual control).
B. Flip Trade Mode (with Averaging Down)
This mode flips trades and continues trading in the opposite direction after targets are hit:
Trade Initiation: Trade is initiated as per user settings (price/time).
Close at Target: Once the target is hit, close the trade.
Reverse Trade: Immediately reverse the trade (buy -> sell, sell -> buy).
Repeat Process: Continue this process throughout the day, managing quantities and hedging as required.
C. If the Trade Moves Against the Direction
Quantity Adjustment: The system should automatically adjust quantities at pre-defined intervals if the trade moves against the user’s direction.
Hedging: If enabled, initiate hedging trades following the same rules as in Single Trade Mode.
Profit Booking and Reversal: Once a target is hit, reverse the trade and continue trading until a user-defined stop time.
Strategy Matrix Overview
The strategy will be configured to operate in a fully-automated mode. However, if the market conditions deteriorate, the strategy may need to be managed manually through a matrix which will be designed to be flexible with various trade levels and execution rules:
1. Quantity vs. Capital Allocation
The user can choose to:
Specify a fixed number of quantities for trades, or
Deploy a specified amount of capital per trade, applicable to all levels in the RTS matrix.
2. Quantity/Capital Levels
Quantities can be based on a pre-set table or entered manually at each level.
The system manages trades at different levels as the price moves, either up or down.
3. Target Setting
4. Previous Trades Management
5. Hedging
A checkbox will enable hedging, triggering opposite trades to mitigate potential losses.
The hedging leg follows the same rules but may have different quantities and levels.
Profits are managed separately, and new trades are initiated based on hedging performance.
6. Averaging Down
Users can choose to average down trades based on preset rules or manually input levels and quantities.
The system auto-populates option types (ATM, ITM, OTM), but users can override this.
7. Flip Trade Quantity Levels
8. Trade Closure & Unexecuted Orders
9. Excluding Levels
10. Notifications
11. Profit Booking & Stop-Loss
12. Base Price for Matrix Calculation
13. Option Types
Controls and Buttons
Global Controls:
Local Controls:
Level Controls:
Chart Integration:
Multiple Instruments:
System Rules
Fetch ask/bid prices, not the Last Traded Price (LTP).
No new trades within a user-specified time (e.g., 15 seconds).
Adjust gaps for averaging down based on the velocity of price changes.
Shoot orders at 5-paisa intervals to complete fills.
Allow options to be chosen as ATM/ITM/OTM.
Include Normal/Dark Mode for the UI.
Define start and stop times for trading (e.g., open at 0920 hrs, alerts post 1330 hrs).
The system should remember user-defined settings unless edited.
This system will provide automated, rule-based execution of a Strategy across two accounts, with flexibility for customization and integration of key controls to manage trades effectively.