caishen

ADS - Analysis Data Services

RISE Framework Specification

Spec ID: 01
Version: 1.0
Document ID: caishen-rise-ads-v1.0
Last Updated: 2025-01-31

Creative Intent

What ADS Enables Users to Create:

Desired Outcomes:

  1. Users receive fully calculated ChaosDataBuilder (CDB) for any POV request
  2. Fractal initiation signals are automatically detected and reported
  3. Multiple timeframes can be analyzed simultaneously for an instrument
  4. Currency strength comparisons are calculated and exported

Core Components

ADSService

The primary service interface for analysis data operations.

Behavior:

Layout: Contains ADSComponent, FractalServiceSignalWrapper, CRSIComponent

ADSComponent

Business logic component for chart data building.

Behavior:

FractalServiceSignalWrapper

Specialized service for detecting fractal initiation signals.

Behavior:

CRSIComponent

Currency Relative Strength Index calculator.

Behavior:


Service Contracts

IADSService

Interface IADSService:

  Method GetCDB:
    Input:
      - instrument: string (e.g., "EUR/USD")
      - timeframe: string (e.g., "H4")
      - dtCreated: string ("now" or datetime string)
      - nbBars: int (default: 300)
      - saveCDS: bool (persist to database)
      - busPublish: bool (publish to service bus)
    Output: ChaosDataBuilderDTO
    Behavior: Creates and returns complete chaos data for POV

  Method Get:
    Input: GetADSDataBuilderRequest
    Output: GetADSDataBuilderResponse
    Behavior: Simplified request/response pattern for CDB retrieval

  Method GetTimeRange:
    Input:
      - instrument: string
      - timeframe: string
      - dtPoint1: string (start date)
      - dtPoint2: string (end date)
    Output: Dictionary<DateTime, GetADSDataBuilderResponse>
    Behavior: Returns CDB snapshots for each period in range

  Method GetPriceHistoryBase:
    Input:
      - povString: string (e.g., "EUR-USD_H4")
      - nbperiods: int
      - dtLast: string
    Output: PriceHistoryBase
    Behavior: Retrieves raw price history for POV

  Method initiatingFractalCheck:
    Input:
      - instrument: string
      - timeframe: string
    Output: CheckLastFractalInitiatingInfoResultPlus
    Behavior: Checks for initiating fractal signals

  Method RefreshCRSIAllCRSIByTF:
    Input: ADSCRSIRequest
    Output: ADSCRSIResponse
    Behavior: Generates CRSI for all currency bases at specified timeframe

Request/Response DTOs

GetADSDataBuilderRequest

GetADSDataBuilderRequest:
  - Pov: string       # "EUR-USD_H4" format
  - DtString: string  # "now" or specific datetime
  - NbPeriods: int    # Number of bars to retrieve

GetADSDataBuilderResponse

GetADSDataBuilderResponse:
  - ADB: ADSDataBuilderDTO  # Contains ChaosDataBuilderDTO
  - Success: bool
  - Message: string

ADSCRSIRequest

ADSCRSIRequest:
  - CurrencyBase: string  # "USD", "EUR", "CTX" (all)
  - Timeframe: string     # "m5", "H4", "D1", etc.
  - RefreshPrices: bool   # Update price data first

ADSCRSIResponse

ADSCRSIResponse:
  - Result: ADSCRSIResult
    - Timeframe: string
    - CRSIContexData: Dictionary<string, CRSIGroup>
    - CRSIMomentumContextData: Dictionary<string, string>

Creative Advancement Scenarios

Scenario 1: Single POV Analysis

Creative Advancement Scenario: Analyze Single Instrument Timeframe

Desired Outcome: Complete chaos chart data for EUR/USD H4

Current Reality: User needs chart analysis for trading decision

Natural Progression Steps:
  1. User requests ADS.GetCDB("EUR/USD", "H4", "now", 300)
  2. ADS fetches price history from PDS
  3. ADS calculates all chaos indicators via IDS
  4. ADS assembles ChaosDataBuilderDTO
  5. GetCDBDone event fires with completed data

Achieved Outcome: User has full chaos analysis including:
  - Price bars with OHLC
  - Alligator lines (Lips, Teeth, Jaw)
  - AO (Awesome Oscillator) values
  - AC (Accelerator) values
  - Fractal buy/sell signals
  - Zone colors
  - MFI (Market Facilitation Index)
  - Gator indicator values

Supporting Features: ADSComponent, indicator calculation pipeline

Scenario 2: Initiating Fractal Detection

Creative Advancement Scenario: Detect Fractal Breakout Signal

Desired Outcome: Identification of initiating fractal for trade entry

Current Reality: Chart displays recent fractal pattern

Natural Progression Steps:
  1. User requests initiatingFractalCheck("EUR/USD", "H4")
  2. FractalServiceSignalWrapper analyzes last N bars
  3. Service identifies fractal high/low points
  4. Service checks if current price broke through fractal level
  5. Returns signal with direction (Buy/Sell) and breakout price

Achieved Outcome: User knows if a fractal breakout initiated
  - Signal direction
  - Breakout price level
  - Fractal bar date/time
  - Result validation status

Supporting Features: FractalServiceSignalWrapper, Fractal indicator

Scenario 3: Multi-Currency Strength Analysis

Creative Advancement Scenario: Compare Currency Strengths

Desired Outcome: CRSI analysis for trading currency pair selection

Current Reality: User wants to identify strongest/weakest currencies

Natural Progression Steps:
  1. User requests RefreshCRSIAllCRSIByTF with timeframe "H4"
  2. ADS updates price data for all currency pairs
  3. CRSI calculated for each base currency
  4. Momentum (AO) calculated on CRSI lines
  5. Results exported to CSV and returned

Achieved Outcome: User can compare:
  - CRSI lines for all 8 major currencies
  - Momentum direction for each currency
  - Relative strength rankings

Supporting Features: CRSIComponent, PDSEngine for price updates

Data Flow

┌─────────────────┐
│  Client/UI     │
│  Request        │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│   ADSService    │
│                 │
│  - GetCDB()     │
│  - Get()        │
│  - GetTimeRange│
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  ADSComponent   │
│                 │
│  - Orchestrates │
│  - Calculates   │
└────────┬────────┘
         │
    ┌────┴────┐
    │         │
    ▼         ▼
┌───────┐ ┌───────┐
│  PDS  │ │  IDS  │
│ Price │ │Indica-│
│ Data  │ │ tors  │
└───────┘ └───────┘

Configuration

ADSConstants

ADSConstants:
  - pdsEnginePath: string  # Path to PDSEngine executable
  - pdsExeFileName: string # "PDSEngine2203.exe"
  - savepathPto220907CRSIMomentum: string  # CRSI output directory

DTSApp.CONF

Configuration:
  - CRSIIndex: string[]  # ["USD", "EUR", "GBP", "JPY", "CHF", "AUD", "NZD", "CAD"]
  - UseStrategicWebService: bool  # Use WCF service vs local

Events

GetCDBDone

Event GetCDBDone:
  Sender: ADSService
  Args: ChaosDataBuilderDTO
  Fires: When CDB generation completes successfully
  Purpose: Allows subscribers to react to new chart data

Dependencies


Implementation Notes for Python/TypeScript

Python Implementation Approach

class ADSService:
    def __init__(self):
        self.ads_component = ADSComponent()
        self.fractal_service = FractalServiceSignalWrapper()
        self.crsi_component = CRSIComponent()
    
    async def get_cdb(
        self,
        instrument: str,
        timeframe: str,
        dt_created: str = "now",
        nb_bars: int = 300,
        save_cds: bool = False,
        bus_publish: bool = False
    ) -> ChaosDataBuilderDTO:
        """Create and return chaos data for POV"""
        pass
    
    async def initiating_fractal_check(
        self,
        instrument: str,
        timeframe: str
    ) -> CheckLastFractalInitiatingInfoResultPlus:
        """Check for initiating fractal signals"""
        pass

TypeScript Implementation Approach

interface IADSService {
  getCDB(
    instrument: string,
    timeframe: string,
    dtCreated?: string,
    nbBars?: number,
    saveCDS?: boolean,
    busPublish?: boolean
  ): Promise<ChaosDataBuilderDTO>;
  
  initiatingFractalCheck(
    instrument: string,
    timeframe: string
  ): Promise<CheckLastFractalInitiatingInfoResultPlus>;
  
  refreshCRSIAllCRSIByTF(
    request: ADSCRSIRequest
  ): Promise<ADSCRSIResponse>;
}