cep training n.
Skip this Video
Loading SlideShow in 5 Seconds..
CEP TRAINING PowerPoint Presentation
Download Presentation


224 Vues Download Presentation
Télécharger la présentation


- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript


  2. Development Training Logistics Introduction to CEP and Aleri Lab: Install Aleri Studio – REFERENCE ONLY Studio Development Topics with Labs Source, Aggregation, and Filter Streams Copy Streams and Input Windows Compute and Extend Streams Join and Union Streams Flex Streams radio button z SPLASH Data Connectors Playback Event Cache Pattern Streams Wrap-up and Q&A TRAINING AGENDA - DAY 1

  3. Development Review Flex Streams and SPLASH Studio Debugging Publish and Subscribe API Example in Java Excel RTD Adapter Performance Factors and Application Tuning Advanced Installation and Configuration Enterprise Features – HA and Cluster Foreign Functions Open Q&A (as time allows) TRAINING AGENDA – DAY 2

  4. REVIEW Flex Streams And Pattern Streams

  5. Most advanced stream One or more input streams Ideal for custom logic Can “call out” to Java and C++ methods Each input stream requires a “SPLASH method” Output per SPLASH methods SPLASH (Streaming Platform LAnguage SHell) C Like procedural scripting language FLEX STREAMS

  6. Simple ex: print (‘generating new order\n’); If-then-else while Iterators For (rec in MktData_stream) vectors Event caches Dictionaries Built-in functions, ex: firstnonnull(null,3,4,8); Declarations, ex: int32 eventCt; eventCt := 4; Int32 eventCt := 4; Cast typedef SPLASH

  7. typedef money euros; euros price := 10.70d; typeof(price) newPrice := 10.70d; equivalent to money newPrice := 10.70d; if (temperature < 0) { display := 'below zero'; } else if (temperature = 0) { display := 'zero'; } else { display := 'above zero'; } SPLASH - continued

  8. int32 i := 0, squares := 0; while (i < 10) { squares := squares + (i * i); i++; } SPLASH - continued

  9. Records, with primary key before | [ Market = 'NYSE'; Symbol='T'; | Shares=10; Price=22.88; ] [ Market = 'NYSE'; Symbol='GM'; | Shares=5; Price=16.81; ] Using typeof(myFlexStream) arec – so arec will be output: typeof(BuyThis) arec; Next page will have arec set. SPLASH - continued

  10. arec :=[ ID=aID++; symbol= FilterBuy.symbol;side= FilterBuy.side;Symbol= FilterBuy.Symbol;| volume= FilterBuy.volume; slice= FilterBuy.slice; venue= FilterBuy.venue; stale= FilterBuy.stale; ask= FilterBuy.ask; askSz= FilterBuy.askSz; askTime= FilterBuy.askTime; askCond= FilterBuy.askCond; bid=; bidSz= FilterBuy.bidSz; bidTime= FilterBuy.bidTime; bidCond= FilterBuy.bidCond;OrderQty = aproduct; ]; setOpcode(arec,upsert); output arec; SPLASH - continued

  11. Code Function, even recursive: int32 factorial(int32 x) { if (x <= 0) { return 1; } else { return factorial(x-1) * x; } } SPLASH - continued

  12. Vector Example: vector(double) roots; int32 i := 0; double pi := 3.1415926, e := 2.7182818, sum1 := 0; resize(roots, 8); // new size is 8, with each element set to null while (i < 8) { roots[i] := e ^ ((pi * i) / 4); i++; } SPLASH - continued

  13. Dictionaries “map” keys to “values”. Example: dictionary(string, money) convertFromUSD; convertFromUSD ['EUR'] := 1.272d; Loop through all Dictionary elements: for (currency in convertFromUSD) { if (convertFromUSD[currency] > 1) { Print ('currency ', currency, ' is worth more than one USD.\n'); } } SPLASH - continued

  14. Event Cache special SPLASH data structure for grouping and storing events from an input stream. Events are grouped into buckets. run aggregate operations like count, sum, and max Declare event cache in Local block of a stream using name of the input stream. For example: eventCache(Trades) events; the declaration SPLASH - continued

  15. Group events into buckets by specifying columns, say by Trades that have the same number of shares: shareseventCache(Trades[Shares]) eventsByShares; Maximum “window” or latest events of X seconds: eventCache(Trades[Symbol], 20 seconds) eventsBySymbol20Seconds; Maximum “window” or latest X events: eventCache(Trades[Symbol], 10 events) eventsBySymbol10Events; SPLASH - continued

  16. Can sort and also designate records with “coalesce” instead of events: eventCache(Trades, coalesce, Price desc) eventsOrderByPrice; eQ is event cache of quotes ranking ask or sell price from lowest to highest. With nth, can retrieve aask0 := nth(0,eQ.ask); // from eventCache aaskPrior1 := nth(1,eQ.ask); // from eventCache aaskPrior2 := nth(2,eQ.ask); // from eventCache SPLASH - continued

  17. Another use of ‘nth’ -vector(int32) vec; resize (vec,3); // 3 elements - int32 r; int32 max := 3; - for (r in eQ) { if (r < max) { vec[r] := nth(r,eQ.ask); r++; } } SPLASH - continued

  18. Call-out to Java method Retrieve a result(double) as input to options pricing Sy6 is input stream; note its columns as input to method signature // callout for Volatility d_volatility := foreignJava ("com/g/bottomline/TheoryPrice", GImpliedVol,'(Ljava/lang/String;DDIDDDD)D‘, sy6.stcode,d_stockprice,sy6.strike,n_daystomaturity,sy6.LastPrice,sy6.noriskrate,0.0,0.005); SPLASH - continued

  19. Instructor will demo PropTrade model Focus on Flex Streams: FlexQuotesAsk, SellThis, NewOrderSingle, FlexAck1, EMS, Cancel Also focus on global declarations that create dictionaries that multiple streams use for state and trading position Mgt. LAB4 – FLEX STREAMS


  21. PATTERN STREAMS This example identifies a high probability of a pending terror event. Three “derived” streams are created with a rating (0 to 10) based on word matching with many dictionaries to match related translated words such as “bomb” with “walk” and “bridge” implying Brooklyn Bridge is a target given its famous walkway. The three streams are then evaluated together by a Pattern Stream. The output with pertinent information is then directed to NYPD. within 30 seconds from NY[Rep=NYPD;Rate=10;K=bomb;M1=walk;M2=bridge] as Brooklyn, Eur1[Rep=LON;Rate=7; K=bomb; M1=Brooklyn] as Plan, Eur2[Rep=Bank; Rate=7; K=bomb; M1=New York] as Finance, on Plan fby Finance fby Brooklyn output [Rep=NYPD; Rate=8; K=bomb; M1=‘Brooklyn Bridge’;]; 21

  22. Pattern Stream Options Straddle: 1 call, 1 put, all attributes same PATTERN STREAM within 300 seconds from MktRef[Security=sym; OPT_EXPIRE_DT=e1; OPT_STRIKE_PX=sp1; OPT_PUT_CALL='Call'; OPT_CONT_SIZE=c1 ] as call, MktRef[Security=sym; OPT_EXPIRE_DT=e1; OPT_STRIKE_PX=sp1; OPT_PUT_CALL='Put'; OPT_CONT_SIZE=c1 ] as put on call and put { aATMcall := (call.UNDL_PX_AT_OPT_TRADE-sp1)/call.UNDL_PX_AT_OPT_TRADE; aATMput := (sp1-put.UNDL_PX_AT_OPT_TRADE)/put.UNDL_PX_AT_OPT_TRADE; s_trd1 := makeDetail('1', call.Topic, call.LAST_TRADE, call.SIZE_LAST_TRADE, c1); s_trd2 := makeDetail('2', put.Topic, put.LAST_TRADE, put.SIZE_LAST_TRADE, c1); aAlertText := concat('Possible At the Money Straddle in ',sym); if ( (abs(aATMcall) < 0.05) and (abs(aATMput) < 0.05) ) { output setOpcode ([Topic=call.Topic; Topic2=put.Topic; Security=sym; Security2=sym; OPT_PUT_CALL='Call'; OPT_PUT_CALL2='Put'; Strategy='straddle'; | StrategyA = aStraddle; SIZE_LAST_TRADE = call.SIZE_LAST_TRADE; ATMcall=aATMcall; ATMput=aATMput; AlertID=idNum++; AlertText=aAlertText; Sec1=s_trd1; Sec2=s_trd2; ],upsert); } } . 22

  23. Aleri Platform Beyond Basics Pattern Streams Demo Options Strategies DEVELOPMENT

  24. Lab: create strangle and put spread patterns LAB – PATTERN STREAMS . LAB Details: Strangle: same as straddle except different strike price. Call Puts: 2 puts, same symbol, expiry, different strike price, same or different contract sizes, last trade price and sizes 24

  25. Performance Aleri Platform Monitoring Dev, QA, and Prod Environments ADMINISTRATION

  26. Studio has integrated “streams” performance monitor Very useful to assist in optimizing model designs Key metrics include: Individual Stream CPU utilization, rows processed, queues Useful in Dev, QA, and Production SERVER MONITORING

  27. Data Connector Platform to Platform DEVELOPMENT

  28. Plug-Ins Real Time Excel ADAPTERS

  29. Allows one to publish to and subscribe to Aleri Platform Can also dynamically change model inputs Ex: increase amount to trade (a stock position) half way through trading Return to Prop Trade model for in depth examination of integrating both Pub and Sub aspects of Excel RT EXCEL RT

  30. To demo pub and sub features in one model, return to Prop Trade model. Start PropTrade.xml.  Open Excel 2003 with C:\Aleri_Demo\apps\PropTrade\excel\PropTrade.xls. Open Aleri RT Excel Plug-In in Excel; then connect to Platform.  Click on input sheet. Highlight / Select A1:D4 and copy. Return to plug in. Select Publish then upsert and ellipsis. It should show A1:D4. Make sure on right that you select source stream Input stream. Click Publish. You should see “successfully published data”. This publishes our beginning trading positions to the Platform. PUB-SUB

  31. Repeat similarly for ID sheet but select A1:B2 and ClOrdIDInput as the source stream. This publishes our starting ID to the model; the ID will be used for unique Client Order ID’s. Return to ID sheet. Next, just click on A2. Then in plug-in, select subscribe. Select A2 and stream FlexID. Click apply then start the query. Excel will thus now subscribe to model output in from FlexID stream. This stream tracks latest ID which needs to increment. EXCEL RT

  32. Excel RT

  33. Excel RT

  34. Excel RT

  35. Excel RT

  36. Excel RT

  37. Excel RT

  38. Excel RT

  39. Excel RT

  40. Excel RT

  41. Excel RT

  42. Excel RT

  43. Aleri Platform Beyond Basics User Defined Functions Development

  44. To demo performance monitoring: Run C:\Aleri_Demo\apps\PatternsOptionStrategies\models\PatternOptionStrategies. Open C:\Aleri_Demo\apps\PatternsOptionStrategies\excelBook2e.xls with Aleri RT Plug-In. Connect to the Platform then open Subscription Wizard. Click on sheet alerts at A5. Subscribe to stream FlexExcel at A5 cell in alerts sheet. Enter 500 for Max Rows. Check off Get Base Transactions; click apply and then start. In the Studio, click on Playback-Record and start playback of C:\Aleri_Demo\apps\PatternsOptionStrategies\recordings\recorded_data_PatternsOptionsStrategies.rec. In Run-Test tab, click on Monitor, then icon with 3 streams connected, then the green arrow. Alternate between Queue Depth and Rows Processed/Sec for full suite of performance metrics. SERVER MONITORING

  45. ADMIN – Server Monitoring (cont) The Studio has a Repository where it looks for source code for projects. This repository is specified at install and then can be changed in the Studio: Tools Menu→Settings option.

  46. ADMIN – Server Monitoring (cont)

  47. ADMIN – Server Monitoring (cont)

  48. ADMIN – Server Monitoring (cont)

  49. Enterprise Features HIGH AVAILABILITY

  50. Configurable to your level of availability and flexibility needs Rapid failover "hot" spare highest degree of availability recovery in seconds Shared resources "warm" spares flexible configurations recovery in minutes parallel & pipeline configurations All managed by fault tolerant cluster manager HA / CLUSTER CONFIG