public MarketDataUpdateItem(MarketDataViewRow row, Quote quote, Trade trade, Bar bar) { this.Row = row; this.Quote = quote; this.Trade = trade; this.Bar = bar; }
protected void CreateNewBar(BarType barType, DateTime beginTime, DateTime endTime, double price) { if (barType == BarType.Time && this.barSize == 86400) this.bar = new Daily(beginTime, price, price, price, price, 0); else this.bar = new Bar(barType, this.barSize, beginTime, endTime, price, price, price, price, 0, 0); }
public void SetNewBarOpen(FreeQuant.Instruments.Instrument instrument, FreeQuant.Data.Bar bar) { try { if (this.stops.Count != 0) { List <ATSStop> list = (List <ATSStop>)null; if (this.activeStops.TryGetValue(instrument, out list)) { foreach (ATSStop atsStop in new ArrayList((ICollection)list)) { if (atsStop.Connected) { atsStop.OnNewBarOpen(bar); } } } } Strategy strategy = (Strategy)null; if (!this.strategies.TryGetValue(instrument, out strategy)) { return; } strategy.OnBarOpen((OpenQuant.API.Bar) this.objectConverter.Convert(bar)); } catch (Exception ex) { this.EmitError(ex); } }
private void EmitBar(IFIXInstrument instrument, FreeQuant.Data.Bar bar) { if (this.NewBar == null) { return; } this.NewBar((object)this, new BarEventArgs(bar, instrument, (IMarketDataProvider)this)); }
internal void Add(Instrument instrument, Bar bar) { BarSlice barSlice = null; if (!this.data.TryGetValue(bar.Size, out barSlice)) { barSlice = new BarSlice(this.InstrumentsCount); this.data.Add(bar.Size, barSlice); } barSlice.Add(instrument, bar); }
public void TestCase() { Bar bar = new Bar(); ba.Add(bar); Assert.AreEqual(1, ba.Count); Assert.AreSame(ba[0], bar); Assert.AreEqual(ba[0].GetType(), typeof(Bar)); ba.Remove(bar); Assert.AreEqual(0, ba.Count); }
protected override void OnUpdateBar(Bar bar) { this.Cells[1].Value = !(bar is Daily) ? (!(bar.BeginTime != DateTime.MinValue) ? "" : string.Format("{0:T} - {1:T}", bar.BeginTime, bar.EndTime)) : bar.DateTime.ToShortDateString(); this.Cells[2].Value = (object)bar.Open; this.Cells[3].Value = (object)bar.High; this.Cells[4].Value = (object)bar.Low; this.Cells[5].Value = (object)bar.Close; this.Cells[6].Value = (object)bar.Volume; this.Cells[7].Value = (object)new BarSizeInfo(bar.BarType, bar.Size); }
public void Update(Quote quote, Trade trade, Bar bar) { if (!this.enabled) return; if (quote != null) this.OnUpdateQuote(quote); if (trade != null) this.OnUpdateTrade(trade); if (bar == null) return; this.OnUpdateBar(bar); }
public void EmitBar(Instrument instrument, BarType barType, long barSize, DateTime beginDateTime, DateTime endDateTime, double open, double high, double low, double close, long volume) { FreeQuant.Data.Bar bar = new FreeQuant.Data.Bar(EnumConverter.Convert(barType), barSize, beginDateTime, endDateTime, open, high, low, close, volume, 0L); if (this.MarketDataFilter != null) { bar = this.MarketDataFilter.FilterBar(bar, instrument.Symbol); } if (bar == null) { return; } this.EmitBar((IFIXInstrument)instrument.instrument, bar); }
public void SetNewBar(FreeQuant.Instruments.Instrument instrument, FreeQuant.Data.Bar bar) { try { if (bar.BarType == FreeQuant.Data.BarType.Time) { this.barSliceManager.AddBar(instrument, bar); } else { this.OnNewBar(instrument, bar); } } catch (Exception ex) { this.EmitError(ex); } }
public void TestCase() { Bar bar1 = new Bar(); Bar bar2 = new Bar(); bs.Add(bar1); bs.Add(bar2); Assert.AreEqual(1, bs.RealCount); Assert.AreSame(bar2, bs[0]); bs.Clear(); Assert.AreEqual(0, bs.RealCount); DateTime dt1 = new DateTime(2014,1,1,12,12,12); Bar bar3 = new Bar(dt1,10,10,10,10,100,100); bs.Add(bar3); Assert.AreSame(bar3, bs[dt1]); bs.Clear(); bs.Add(bar3); Assert.AreSame(bar3, bs[dt1, EIndexOption.Next]); }
public override void Add(CompressorDataItem data) { if (data.Items.Count != 1) throw new ArgumentException(string.Format("Cannot make range bars from {0}", (object)this.dataSource.Input)); double price = data.Items[0].Price; if (this.bar == null) { this.CreateNewBar((BarType)4, data.DateTime, data.DateTime, price); } else { this.AddDataToBar(data.Items); this.bar.EndTime = data.DateTime; bool flag = false; while (!flag) { if (10000.0 * (this.bar.High - this.bar.Low) >= (double)this.barSize) { Bar bar = new Bar(BarType.Range, this.barSize, data.DateTime, data.DateTime, price, price, price, price, 0, 0); if (this.bar.High == price) { this.bar.High = this.bar.Low + (double)this.barSize / 10000.0; this.bar.Close = this.bar.High; bar.Low = this.bar.High; } if (this.bar.Low == price) { this.bar.Low = this.bar.High - (double)this.barSize / 10000.0; this.bar.Close = this.bar.Low; bar.High = this.bar.Low; } this.EmitNewCompressedBar(); this.bar = bar; flag = 10000.0 * (this.bar.High - this.bar.Low) < (double)this.barSize; } else flag = true; } } }
protected override IDataObject Process() { DateTime dateTime = this.GetDateTime(); double doubleValue1 = this.GetDoubleValue(ColumnType.High); double doubleValue2 = this.GetDoubleValue(ColumnType.Low); double doubleValue3 = this.GetDoubleValue(ColumnType.Open); double doubleValue4 = this.GetDoubleValue(ColumnType.Close); long int64Value1 = this.GetInt64Value(ColumnType.Volume); long int64Value2 = this.GetInt64Value(ColumnType.OpenInt); IDataObject idataObject; if (this.makeDaily) { idataObject = (IDataObject)new Daily(dateTime, doubleValue3, doubleValue1, doubleValue2, doubleValue4, int64Value1, int64Value2); } else { if (this.template.DataOptions.BarDateTime == BarDateTime.EndTime) dateTime = dateTime.AddSeconds((double)-this.template.DataOptions.BarSize); Bar bar = new Bar(dateTime, doubleValue3, doubleValue1, doubleValue2, doubleValue4, int64Value1, this.template.DataOptions.BarSize); bar.OpenInt = int64Value2; idataObject = (IDataObject)bar; } return idataObject; }
public void Add(Bar bar) { DataManager.Add(this, bar); }
protected override void OnNewBar(Instrument instrument, Bar bar) { foreach (ATSStop atsStop in new ArrayList((ICollection) this.activeStops[instrument])) { if (atsStop.Connected) atsStop.OnNewBar(bar); } this.marketManager.OnBar(instrument, bar); this.klBiFcxZsD.OnBar(instrument, bar); this.csNiLdTRqH[instrument].OnBar(bar); }
public object Convert(FreeQuant.Data.Bar bar) { return(new Bar(bar)); }
internal void t2b63VoTkG(Bar obj0) { if (!this.fTraceOnBar || this.fFilterBarSize >= 0L && (this.fFilterBarSize != obj0.Size || this.fFilterBarType != BarType.Time)) return; this.fTrailPrice = obj0.Close; switch (this.fSide) { case PositionSide.Long: this.fCurrPrice = obj0.Low; this.fFillPrice = obj0.Low; if (this.fTrailOnHighLow) { this.fTrailPrice = obj0.High; break; } else break; case PositionSide.Short: this.fCurrPrice = obj0.High; this.fFillPrice = obj0.High; if (this.fTrailOnHighLow) { this.fTrailPrice = obj0.Low; break; } else break; } switch (this.fFillMode) { case StopFillMode.Close: this.fFillPrice = obj0.Close; break; case StopFillMode.Stop: this.fFillPrice = this.fStopPrice; break; } this.XqY6FAU6Mj(); }
internal void M2g6st8BRD(Bar obj0) { if (!this.fTraceOnBar || !this.fTraceOnBarOpen || this.fFilterBarSize >= 0L && (this.fFilterBarSize != obj0.Size || this.fFilterBarType != BarType.Time)) return; this.fCurrPrice = obj0.Open; this.fFillPrice = obj0.Open; if (this.fTrailOnOpen) this.fTrailPrice = obj0.Open; this.XqY6FAU6Mj(); }
public void OnNewBarOpen(Bar bar) { if (!this.fTraceOnBar || !this.fTraceOnBarOpen || this.fFilterBarSize >= 0L && (this.fFilterBarSize != bar.Size || this.fFilterBarType != BarType.Time)) return; this.fCurrPrice = bar.Open; this.fFillPrice = bar.Open; if (this.fTrailOnOpen) this.fTrailPrice = bar.Open; this.oEtiRP16ys(); }
public void SetUp() { double open = 1.0; bar = new Bar(); }
private void Y18FFPmDy5(Quote obj0, Trade obj1, Bar obj2) { SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder; if (singleOrder.OrdStatus != OrdStatus.New && singleOrder.OrdStatus != OrdStatus.PendingNew && (singleOrder.OrdStatus != OrdStatus.PartiallyFilled && singleOrder.OrdStatus != OrdStatus.Replaced)) return; double num1 = this.CcXFPEywDQ(obj0, obj1, obj2); double num2 = this.VirF0ddUxQ(singleOrder, obj0, obj1, obj2); if (num1 == 0.0 || num2 == 0.0) return; if (singleOrder.OrdType == OrdType.Market || singleOrder.OrdType == OrdType.TrailingStop && singleOrder.IsStopLimitReady) this.D35FmNWSPm(num1, num2); else this.wYBFLwFB4S(num1, num2); }
public void OnNewBar(Bar bar) { if (this.fTraceOnBar && (this.fFilterBarSize < 0L || this.fFilterBarSize == bar.Size && this.fFilterBarType == BarType.Time)) { this.fTrailPrice = bar.Close; switch (this.fSide) { case PositionSide.Long: this.fCurrPrice = bar.Low; this.fFillPrice = bar.Low; if (this.fTrailOnHighLow) { this.fTrailPrice = bar.High; break; } else break; case PositionSide.Short: this.fCurrPrice = bar.High; this.fFillPrice = bar.High; if (this.fTrailOnHighLow) { this.fTrailPrice = bar.Low; break; } else break; } switch (this.fFillMode) { case StopFillMode.Close: this.fFillPrice = bar.Close; break; case StopFillMode.Stop: this.fFillPrice = this.fStopPrice; break; } this.oEtiRP16ys(); } if (this.fType != StopType.Trailing) return; this.series.Add(bar.DateTime, this.fStopPrice); }
public void Add(string series, Bar bar) { DataManager.Add(this, series, bar); }
public static void Add(Instrument instrument, string suffix, Bar bar) { DataManager.Add(instrument.Symbol + SERIES_SEPARATOR + suffix, bar); }
public bool CrossesAbove(TimeSeries series, Bar bar) { return this.Crosses(series, bar.DateTime) == ECross.Above; }
public ECross Crosses(TimeSeries series, Bar bar) { return this.Crosses(series, bar.DateTime); }
public ECross Crosses(TimeSeries series, Bar bar, int row) { return this.Crosses(series, bar.DateTime, row); }
public ECross Crosses(TimeSeries series, Bar bar, BarData barData) { return this.Crosses(series, bar.DateTime, barData); }
protected override void OnNewBar(Instrument instrument, Bar bar) { foreach (Stop stop in new ArrayList((ICollection) this.activeStops[instrument])) { if (stop.Connected) stop.t2b63VoTkG(bar); } this.A6MpF2380O.OnBar(instrument, bar); this.HeHpDewVKD.OnBar(instrument, bar); this.marketManager.OnBar(instrument, bar); this.exits[instrument].OnBar(bar); this.entries[instrument].OnBar(bar); this.moneyManagers[instrument].OnBar(bar); this.riskManagers[instrument].OnBar(bar); }
public bool CrossesBelow(TimeSeries series, Bar bar) { return this.Crosses(series, bar.DateTime) == ECross.Below; }
public EntryEventArgs(Instrument instrument, char side, Bar bar) : base() { this.Instrument = instrument; this.Side = side; this.Bar = bar; }
public static void Add(string series, Bar bar) { DataManager.server.Update(series, bar); }
private double VirF0ddUxQ(SingleOrder obj0, Quote obj1, Trade obj2, Bar obj3) { bool flag = !obj0.IsStopLimitReady && (obj0.OrdType == OrdType.TrailingStop || obj0.OrdType == OrdType.TrailingStopLimit || obj0.OrdType == OrdType.StopLimit); if (obj1 != null && this.A8bFJItyyx.PartialFills && (this.A8bFJItyyx.FillOnQuote && !flag || this.A8bFJItyyx.TriggerOnQuote && flag)) { if (!this.A8bFJItyyx.FillAtWorstQuoteRate || obj1.Bid <= obj1.Ask) { switch (obj0.Side) { case Side.Buy: if (obj1.AskSize > 0) return (double) obj1.AskSize; else break; case Side.Sell: case Side.SellShort: if (obj1.BidSize > 0) return (double) obj1.BidSize; else break; default: return obj0.OrderQty; } } else { switch (obj0.Side) { case Side.Buy: if (obj1.BidSize > 0) return (double) obj1.BidSize; else break; case Side.Sell: case Side.SellShort: if (obj1.Ask > 0.0) return (double) obj1.AskSize; else break; default: return obj0.OrderQty; } } } if ((this.A8bFJItyyx.FillOnTrade && !flag || this.A8bFJItyyx.TriggerOnTrade && flag) && obj2 != null) { if ((obj0.OrdType == OrdType.Limit || (obj0.OrdType == OrdType.StopLimit || obj0.OrdType == OrdType.TrailingStopLimit) && obj0.IsStopLimitReady) && (obj0.CumQty == 0.0 && Math.Abs(obj2.Price - obj0.Price) < 0.001 && (obj0.TradeVolumeDelay != 0 && !this.gxTF8gufMx))) { this.w02FZf7vnP += obj2.Size; if (this.w02FZf7vnP <= obj0.TradeVolumeDelay) return 0.0; this.gxTF8gufMx = true; if (this.A8bFJItyyx.PartialFills) return (double) (this.w02FZf7vnP - obj0.TradeVolumeDelay); else return obj0.OrderQty; } else if (this.A8bFJItyyx.PartialFills) return (double) obj2.Size; } return obj0.OrderQty; }
public static void Add(Instrument instrument, Bar bar) { string suffix = SUFFIX_BAR + SERIES_SEPARATOR + bar.BarType.ToString() + SERIES_SEPARATOR + bar.Size.ToString(); DataManager.Add(instrument, suffix, bar); }
private double CcXFPEywDQ(Quote obj0, Trade obj1, Bar obj2) { SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder; if (singleOrder.ContainsField(11103) && singleOrder.StrategyFill) return singleOrder.StrategyPrice; bool flag = !singleOrder.IsStopLimitReady && (singleOrder.OrdType == OrdType.TrailingStop || singleOrder.OrdType == OrdType.TrailingStopLimit || singleOrder.OrdType == OrdType.StopLimit); if (obj0 != null && (this.A8bFJItyyx.FillOnQuote && !flag || this.A8bFJItyyx.TriggerOnQuote && flag)) { if (!this.A8bFJItyyx.FillAtWorstQuoteRate || obj0.Bid <= obj0.Ask) { switch (singleOrder.Side) { case Side.Buy: case Side.BuyMinus: if (obj0.Ask != 0.0) return obj0.Ask; else break; case Side.Sell: case Side.SellShort: if (obj0.Bid != 0.0) return obj0.Bid; else break; default: throw new NotSupportedException("" + ((object) singleOrder.Side).ToString()); } } else { switch (singleOrder.Side) { case Side.Buy: case Side.BuyMinus: if (obj0.Bid != 0.0) return obj0.Bid; else break; case Side.Sell: case Side.SellShort: if (obj0.Ask != 0.0) return obj0.Ask; else break; default: throw new NotSupportedException("" + ((object) singleOrder.Side).ToString()); } } } if (obj1 != null && (this.A8bFJItyyx.FillOnTrade && !flag || this.A8bFJItyyx.TriggerOnTrade && flag) && obj1.Price != 0.0) return obj1.Price; if (obj2 != null && (this.A8bFJItyyx.FillOnBar && !flag || this.A8bFJItyyx.TriggerOnBar && flag)) { if (singleOrder.StrategyComponent == "which") return singleOrder.StrategyPrice; if (singleOrder.ForceMarketOrder) { if (obj2.Close != 0.0) return obj2.Close; if (obj2.Open != 0.0) return obj2.Open; } switch (this.kUyFaL3cQu) { case FillOnBarMode.LastBarClose: case FillOnBarMode.NextBarClose: return obj2.Close; case FillOnBarMode.NextBarOpen: return obj2.Open; } } return 0.0; }