CCL for the Sample Project

The CCL for the Portfolio Valuation sample project created in the Studio Visual editor is shown here, with the corresponding shape in the diagram for each element. Line breaks are added for readability.

Portfolio Valuation Project CCL and Diagram Elements
CCL Diagram
CREATE INPUT WINDOW PriceFeed 
SCHEMA 
 ( Id integer ,
   Symbol string , 
   TradeTime date , 
   Price float , 
   Shares integer ) 
PRIMARY KEY ( Id )
KEEP 10 MIN ;

PriceFeed_input_window_verbose.png
/**@SIMPLEQUERY=AGGREGATE*/
CREATE OUTPUT WINDOW VWAP 
PRIMARY KEY DEDUCED
 AS 
 SELECT 
 	PriceFeed.Symbol Symbol ,  
 	PriceFeed.TradeTime LastTime ,
 	PriceFeed.Price LastPrice , 
 	sum ( PriceFeed.Price * PriceFeed.Shares ) / 
     sum ( PriceFeed.Shares ) VWAP 
 FROM PriceFeed 
 GROUP BY PriceFeed.Symbol ;

vwap_aggregate_simple_query_verbose.png
CREATE INPUT WINDOW Positions 
  SCHEMA 
   ( BookId string , 
     Symbol string , 
     SharesHeld integer ) 
  PRIMARY KEY ( BookId, Symbol) ;

Positions_input_window_verbose.png
/**@SIMPLEQUERY=JOIN*/
CREATE OUTPUT WINDOW IndividualPositions 
PRIMARY KEY DEDUCED 
 AS 
 SELECT 
   VWAP.LastTime LastTime , 
   VWAP.LastPrice LastPrice , 
   VWAP.VWAP VWAP ,
   Positions.BookId BookId , 
   Positions.Symbol Symbol , 
   Positions.SharesHeld SharesHeld , 
   VWAP.LastPrice * 
     Positions.SharesHeld CurrentPosition , 
   VWAP.VWAP * 
     Positions.SharesHeld AveragePosition 
 FROM VWAP RIGHT JOIN Positions ON 
VWAP.Symbol = Positions.Symbol ;

IndividualPositions_join_simple_query_verbose.png
/**@SIMPLEQUERY=AGGREGATE*/
CREATE OUTPUT WINDOW ValueByBook 
PRIMARY KEY DEDUCED 
 AS 
  SELECT 
     IndividualPositions.BookId BookId , 
     sum ( IndividualPositions.CurrentPosition ) 
           CurrentPosition , 
     sum ( IndividualPositions.AveragePosition ) 
           AveragePosition 
  FROM IndividualPositions
  GROUP BY IndividualPositions.BookId ;

ValueByBook_aggregate_simple_query_verbose.png
ATTACH INPUT ADAPTER Adapter1 
TYPE xml_in 
TO 
Positions 
PROPERTIES dir =
'C:/Documents and Settings/username/My Documents/
    SybaseESP/5.1/workspace/exampledata' ,
file = 'positions.xml' ;

adapter1_file_xml_input_verbose
Related concepts
SPLASH
CCL Authoring
Related tasks
Editing in the CCL Editor
Related reference
CCL for Sample Project with Modules