# Pending Tasks - Multi-Strategy Implementation

**Date**: 2026-01-21  
**Status**: Ready for Live Testing (with minor updates needed)

---

## ✅ COMPLETED

### Database & Configuration
- ✅ Multi-strategy architecture (OPTIONS, SPOT, FUTURES)
- ✅ Broker-strategy mapping table
- ✅ Strategy instances for all assets
- ✅ CoinDCX INR pairs configuration (BTCINR, ETHINR, etc.)
- ✅ Delta USD pairs configuration (BTCUSD, ETHUSD)
- ✅ Asset detection service
- ✅ Multi-asset trading support

### Brokers & Execution
- ✅ CoinDCX broker implementation (LIVE)
- ✅ Delta broker implementation (TEST)
- ✅ Symbol-to-market conversion
- ✅ Balance checks
- ✅ Holdings detection
- ✅ Order execution engine

### Testing
- ✅ Multi-asset detection tested
- ✅ Order placement tested (both exchanges)
- ✅ API integration verified
- ✅ Database persistence working

---

## ⏳ PENDING (For Full Strategy-Based Trading)

### 1. **Algorithm Strategy Awareness** ⚠️ CRITICAL
**What's Missing**: Algorithm doesn't yet check which strategy to use per broker

**Current Behavior**:
- Algorithm always generates `SELL_PUT` / `SELL_CALL` (options actions)
- This doesn't work for CoinDCX spot trading

**Needed Behavior**:
- Check broker's assigned strategy type
- If OPTIONS → Generate `SELL_PUT` / `SELL_CALL`
- If SPOT → Generate `BUY` / `SELL`

**Files to Update**:
- `app/Algorithm/Strategies/SuperTrendReversalAlgorithm.php` - Add strategy type check
- `app/MarketData/Bootstrap/MarketDataBootstrap.php` - Pass strategy info to algorithm

---

### 2. **Market Data Symbol Subscription** ⚠️ IMPORTANT
**What's Missing**: Market data subscribes to wrong symbols for CoinDCX

**Current**: Subscribes to `BTCUSD, ETHUSD` (USD pairs)  
**Needed**: Subscribe to `BTCINR, ETHINR` (INR pairs) for CoinDCX

**Files to Update**:
- `app/MarketData/Bootstrap/MarketDataBootstrap.php` - Use broker-specific symbols
- OR: Run separate WebSocket clients per exchange

---

### 3. **Strategy-Based Order Routing** 🔄 NICE TO HAVE
**What's Missing**: Automatic strategy selection when placing orders

**Current**: Manual specification of action (BUY/SELL/SELL_PUT/SELL_CALL)  
**Ideal**: Automatically determine action based on strategy type

**Files to Update**:
- `app/Execution/Services/SignalToOrderConverter.php` - Check strategy type
- Create `StrategyResolver` service

---

## 🎯 MINIMUM VIABLE FOR TESTING

### What Works Right Now:
You can test immediately with manual order placement:

1. **CoinDCX (LIVE)**: 
   - Use symbols: BTCINR, ETHINR, SHIBINR
   - Actions: BUY, SELL
   - ✅ Ready to test

2. **Delta (TEST)**:
   - Use symbols: BTCUSD, ETHUSD
   - Actions: SELL_PUT, SELL_CALL (or just BUY/SELL for spot)
   - ✅ Ready to test

---

## 🚀 TESTING APPROACH

### Option A: Manual Testing (Immediate)
Test with existing scripts by specifying correct symbols:

```bash
# Test CoinDCX with INR pairs
php bin/test-live-algo-multi-asset.php
# (Update script to use BTCINR, ETHINR symbols)

# Test Delta with USD pairs
# (Already correct)
```

### Option B: Full Strategy-Aware Testing (After Updates)
Once strategy awareness is added:

```bash
# Algorithm will automatically:
# - Use SPOT strategy for CoinDCX (BUY/SELL)
# - Use OPTIONS strategy for Delta (SELL_PUT/SELL_CALL)
php bin/start-all-services.php
```

---

## 📋 QUICK FIX CHECKLIST

To enable full strategy-based trading:

- [ ] 1. Update `SuperTrendReversalAlgorithm` to check strategy type (30 mins)
- [ ] 2. Create `StrategyResolver` service (20 mins)
- [ ] 3. Update `MarketDataBootstrap` to use correct symbols (15 mins)
- [ ] 4. Update `.env` with INR pairs for CoinDCX (5 mins)
- [ ] 5. Create comprehensive test script (15 mins)
- [ ] 6. Test on both exchanges (30 mins)

**Total Estimated Time**: 2 hours

---

## 💰 READY FOR LIVE TESTING NOW?

### **YES** - You can test now with these caveats:

✅ **What Works:**
- Order placement on both exchanges
- Balance checks
- Holdings detection
- Database persistence
- Telegram notifications

⚠️ **Manual Work Required:**
- Specify correct symbols for each exchange (BTCINR for CoinDCX, BTCUSD for Delta)
- Specify correct actions (BUY/SELL for CoinDCX, SELL_PUT/SELL_CALL for Delta)
- Run test scripts with explicit parameters

### **Later** - After strategy updates:

✅ **Fully Automated:**
- Algorithm automatically determines strategy type
- Correct symbols used per exchange
- Correct actions generated per strategy
- No manual intervention needed

---

## 🎬 RECOMMENDED NEXT STEPS

### Immediate (Test Now):
1. Create a manual test script with correct symbols/actions
2. Test small orders on both exchanges
3. Verify execution and database logging

### Short-term (This Week):
1. Implement strategy awareness in algorithm
2. Update market data subscriptions
3. Full automated testing

### Medium-term (Next Week):
1. Performance optimization
2. Additional exchanges
3. Advanced strategies

---

*Last Updated: January 21, 2026*
