protected override void OnFirstCallback() { base.OnFirstCallback(); // initialise workflow _workflow.Initialise(_workContext); // subscribe to curve definitions _curveSubs = IntClient.Target.Subscribe <QuotedAssetSet>( Expr.BoolAND( Expr.IsEQU(CurveProp.Function, FunctionProp.QuotedAssetSet.ToString()), Expr.IsEQU(CurveProp.Market, CurveConst.QR_LIVE), Expr.IsNull(CurveProp.MarketDate)), (subscription, item) => { MainThreadQueue?.Dispatch(item, BaseCurveCallback); }, null); }
protected override void OnFirstCallback() { // subscribe to import rules _ruleCache = IntClient.Target.CreateCache(delegate(CacheChangeData update) { Interlocked.Increment(ref _dispatchedEventCount); MainThreadQueue.Dispatch(update, ProcessRuleUpdate); }, null); _ruleCache.Subscribe <AlertRule>( RuleObject.MakeRuleFilter( EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv), IntClient.Target.ClientInfo.HostName, AppName, IntClient.Target.ClientInfo.UserName)); // start a 30 second timer to periodically check the rules _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); }
protected override void OnFirstCallback() { // subscribe to import rules _importRuleSet = IntClient.Target.CreateCache(delegate(CacheChangeData update) { Interlocked.Increment(ref _updateRequestsDispatched); MainThreadQueue.Dispatch(update, ProcessRuleUpdate); }, null); _importRuleSet.Subscribe <FileImportRule>( RuleObject.MakeRuleFilter( EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv), IntClient.Target.ClientInfo.HostName, AppName, IntClient.Target.ClientInfo.UserName)); // start a 1 minute timer to periodically check the rules _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); }
protected override void OnFirstCallback() { // subscribe to portfolio valuation requests and results // note: load results first _resultSubs = IntClient.Target.SubscribeNoWait <HandlerResponse>( Expr.ALL, delegate(ISubscription subs, ICoreItem item) { var pvRes = (HandlerResponse)item.Data; _manageThreadQueue.Dispatch(pvRes, ReceivePortfolioValuationResult); }, null); _requestSubs = IntClient.Target.SubscribeNoWait <PortfolioValuationRequest>( Expr.ALL, (subs, pvReqItem) => _manageThreadQueue.Dispatch(pvReqItem, ReceivePortfolioValuationRequest), null); _cancelSubs = IntClient.Target.SubscribeNoWait <CancellationRequest>( Expr.ALL, (subs, pvReqItem) => _manageThreadQueue.Dispatch(pvReqItem, ReceiveCancellationRequest), null); // start timers // - request queue manager // - request scheduler _timerRequestManager = new Timer( notUsed => MainThreadQueue.Dispatch <object>(null, RequestManagerTimeout), null, _requestManagerPeriod, _requestManagerPeriod); // hack - start the daily 4am portfolio reval schedule // todo - attach this as a workflow step to the daily file/trade import process DateTime dtNow = DateTime.Now; DateTime dtDue = DateTime.Today.Add(TimeSpan.FromHours(4)); if (dtDue <= dtNow) { dtDue += TimeSpan.FromDays(1); } //TimeSpan tsDue = dtDue - dtNow; //_TimerRequestScheduler = new Timer( // (notUsed) => _MainThreadQueue.Dispatch<object>(null, RequestSchedulerTimeout), // null, tsDue, TimeSpan.FromDays(1)); }
protected override void OnFirstCallback() { // initialise workflow _workflow.Initialise(_workContext); // subscribe to all base curves _baseCurveSubs = IntClient.Target.Subscribe <Market>( Expr.BoolAND( //Expr.BoolOR( Expr.IsEQU(CurveProp.Market, CurveConst.QR_LIVE), //Expr.IsEQU(CurveProp.Market, CurveConst.QR_EOD), //Expr.IsEQU(CurveProp.Market, CurveConst.NAB_EOD)), Expr.IsEQU(EnvironmentProp.Function, FunctionProp.Market.ToString()), Expr.IsNull(CurveProp.MarketDate), Expr.IsNull(CurveProp.StressName) //Expr.StartsWith(Expr.SysPropItemName, "Highlander.Market.") ), (subscription, item) => { MainThreadQueue?.Dispatch(item, BaseCurveCallback); }, null); }
protected override void OnFirstCallback() { // subscribe to Trade valuation requests and results // note: load results first _resultSubs = IntClient.Target.SubscribeNoWait <HandlerResponse>( Expr.ALL, delegate(ISubscription subs, ICoreItem item) { var pvRes = (HandlerResponse)item.Data; _manageThreadQueue.Dispatch(pvRes, ReceiveTradeValuationResult); }, null); _requestSubs = IntClient.Target.SubscribeNoWait <TradeValuationRequest>( Expr.ALL, (subs, pvReqItem) => _manageThreadQueue.Dispatch(pvReqItem, ReceiveTradeValuationRequest), null); // start timers // - request queue manager // - request scheduler _timerRequestManager = new Timer( notUsed => MainThreadQueue.Dispatch <object>(null, RequestManagerTimeout), null, _requestManagerPeriod, _requestManagerPeriod); }
private void RecvTimerEvent(object notUsed) { Interlocked.Increment(ref _dispatchedEventCount); MainThreadQueue.Dispatch <CacheChangeData>(null, ProcessRuleUpdate); }