public static IEnumerable<BreakdownLine> Get(LivePortfolioPnl lpp_) { return lpp_.InnerList.Select(x => new BreakdownLine { ExposureName=x.ExposureName, Wt=x.Weight, Pnl=x.Pnl, Mode=x.UnderlyingLiveInstrument==null?0: x.UnderlyingLiveInstrument.Mode, YestFix=x.UnderlyingLiveInstrument==null ? 0d : x.UnderlyingLiveInstrument.Fix, Today = x.UnderlyingLiveInstrument == null ? 0d : x.UnderlyingLiveInstrument.Mode == LiveInstrumentMode.Fixed ? x.UnderlyingLiveInstrument.LiveFix : x.UnderlyingLiveInstrument.Live, Change = x.UnderlyingLiveInstrument == null ? 0d : x.UnderlyingLiveInstrument.Change, PnlMethod = x.UnderlyingLiveInstrument == null ? 0d : x.UnderlyingLiveInstrument.PnlMethod, Inverted = x.UnderlyingLiveInstrument != null && Math.Abs(x.UnderlyingLiveInstrument.Convention - (-1)) < 1e-2, BbgTicker = x.UnderlyingLiveInstrument == null ? null : x.UnderlyingLiveInstrument.Ticker }); }
public async Task<LivePortfolioPnl> GetLiveUnAllocatedPnl(CarbonClient cc_, bool forceRefresh_ = false) { if (m_liveUnallocatedPnl != null) { if (forceRefresh_) m_liveUnallocatedPnl.Dispose(); else return m_liveUnallocatedPnl; } var exp = await GetLatestUnAllocatedExposure(cc_, forceRefresh_); if (exp == null) { Logger.Error(string.Format("Cannot generate live pnl object for portfolio as no exposures [{0}]", RootName), typeof(Portfolio)); return null; } m_liveUnallocatedPnl = new LivePortfolioPnl(RootName, exp.Item1, exp.Item2); await m_liveUnallocatedPnl.Start(cc_, PnlMultiplier); return m_liveUnallocatedPnl; }
public async Task BindToLive(string text_, LivePortfolioPnl pnl_, CarbonClient cc_) { ClearData(text_); if (pnl_ == null || !pnl_.InnerList.Any()) return; m_livePnlConsolidated = new LivePortfolioPnlConsolidated(pnl_); await m_livePnlConsolidated.Populate(cc_,m_overrides); simpleWtsColumnChart1.Create(Helper.StripBbgEndings(m_livePnlConsolidated.List.Select(x => x.PnlName).ToArray()), m_livePnlConsolidated.List.Select(x => x.Pnl).ToArray()); subscribeToPnl(); simpleWtsColumnChart1.SetYAxixTickStyle(Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart); m_yAxisFormat = "#,###;(#,###);-"; simpleWtsColumnChart1.SetYAxisFormat(m_yAxisFormat,false); }
public void Dispose() { foreach (var m in m_items) m.Dispose(); m_source = null; }
public LivePortfolioPnlConsolidated(LivePortfolioPnl source_) { m_source = source_; }