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.
CCL | Diagram |
---|---|
CREATE INPUT WINDOW PriceFeed SCHEMA ( Id integer , Symbol string , TradeTime date , Price float , Shares integer ) PRIMARY KEY ( Id ) KEEP 10 MIN ; |
|
/**@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 ; |
|
CREATE INPUT WINDOW Positions SCHEMA ( BookId string , Symbol string , SharesHeld integer ) PRIMARY KEY ( BookId, Symbol) ; |
|
/**@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 ; |
|
/**@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 ; |
|
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' ; |
|