public void Initialize(string folderOrfile, string _symbol) { tickFile.Initialize(folderOrfile, _symbol, TickFileMode.Write); if (!CancelPending) { StartAppendThread(); } isInitialized = true; }
public override void Run(string[] args) { string symbolString; if (args.Length == 1) { string filePath = args[0]; reader.Initialize(filePath, TickFileMode.Read); } else if (args.Length == 2) { string filePath = args[0]; symbolString = args[1]; reader.Initialize(filePath, symbolString, TickFileMode.Read); } else if (args.Length == 3) { string filePath = args[0]; reader.Initialize(filePath, TickFileMode.Read); startTime = new TimeStamp(args[1]); endTime = new TimeStamp(args[2]); } else if (args.Length == 4) { string filePath = args[0]; symbolString = args[1]; reader.Initialize(filePath, symbolString, TickFileMode.Read); startTime = new TimeStamp(args[2]); endTime = new TimeStamp(args[3]); } else { Output("Export Usage:"); Usage(); return; } ReadFile(); }
public override void Run(string[] args) { if (args.Length != 2 && args.Length != 1) { stringBuilder.AppendLine("Query Usage:"); stringBuilder.AppendLine("tzdata query <symbol> <file>"); stringBuilder.AppendLine("tzdata query <file>"); return; } if (args.Length > 1) { string symbol = args[0]; string filePath = args[1]; reader.Initialize(filePath, symbol, TickFileMode.Read); ReadFile(); } else { string filePath = args[0]; reader.Initialize(filePath, TickFileMode.Read); ReadFile(); } }
public SimulateSymbolPlayback(FIXSimulatorSupport fixSimulatorSupport, QuoteSimulatorSupport quoteSimulatorSupport, string symbolString, Action <Message, SymbolInfo, Tick> onTick, Action <PhysicalFill, CreateOrChangeOrder> onPhysicalFill, Action <CreateOrChangeOrder, string> onRejectOrder) { log.Register(this); this.fixSimulatorSupport = fixSimulatorSupport; this.quoteSimulatorSupport = quoteSimulatorSupport; this.onTick = onTick; this.symbol = Factory.Symbol.LookupSymbol(symbolString); reader = Factory.TickUtil.TickFile(); this.symbolString = symbolString; reader.Initialize("Test\\MockProviderData", symbolString, TickFileMode.Read); fillSimulator = Factory.Utility.FillSimulator("FIX", Symbol, false, true, null); fillSimulator.EnableSyncTicks = SyncTicks.Enabled; FillSimulator.OnPhysicalFill = onPhysicalFill; FillSimulator.OnRejectOrder = onRejectOrder; }
public SimulateSymbolSyncTicks(FIXSimulatorSupport fixSimulatorSupport, QuoteSimulatorSupport quoteSimulatorSupport, string symbolString, PartialFillSimulation partialFillSimulation, TimeStamp endTime, long id) { log.Register(this); this.id = id; this.fixSimulatorSupport = fixSimulatorSupport; this.quoteSimulatorSupport = quoteSimulatorSupport; this.onTick = quoteSimulatorSupport.OnTick; this.onEndTick = quoteSimulatorSupport.OnEndTick; this.PartialFillSimulation = partialFillSimulation; this.symbolString = symbolString; this.symbol = Factory.Symbol.LookupSymbol(symbolString); fillSimulator = Factory.Utility.FillSimulator("FIX", Symbol, false, true, null); fillSimulator.EnableSyncTicks = SyncTicks.Enabled; FillSimulator.OnPhysicalFill = fixSimulatorSupport.OnPhysicalFill; FillSimulator.OnRejectOrder = fixSimulatorSupport.OnRejectOrder; fillSimulator.PartialFillSimulation = partialFillSimulation; tickSync = SyncTicks.GetTickSync(Symbol.BinaryIdentifier); latency = new LatencyMetric("SimulateSymbolSyncTicks-" + symbolString.StripInvalidPathChars()); diagnoseMetric = Diagnose.RegisterMetric("Simulator"); if (debug) { log.Debug("Opening tick file for reading."); } reader = Factory.TickUtil.TickFile(); try { reader.Initialize("Test\\MockProviderData", symbolString, TickFileMode.Read); reader.EndTime = endTime; } catch (FileNotFoundException ex) { log.Info("File for symbol " + symbolString + " not found: " + ex.Message); } }
private void writeATick(double insertPrice, int volume) { if (tsBits[1].Length <= 3) { tickTime = new TimeStamp(tsBits[0] + " " + tsBits[1] + ":00"); } else { tickTime = new TimeStamp(tsBits[0] + " " + tsBits[1]); } utcTime = tickTime; utcTime.AddSeconds(-GetUtcOffset(tickTime)); double price = insertPrice; tickIO.SetTime(utcTime); if (volume >= 1) { tickIO.SetTrade(price, volume); } else { // tickIO.SetQuote(price, price); tickIO.SetTrade(price, volume); } if (tickWriter == null) { tickWriter = Factory.TickUtil.TickFile(); string folder = "DataCache"; tickWriter.EraseFileToStart = true; tickWriter.Initialize(folder, symbol.Symbol, TickFileMode.Write); } // Console.WriteLine(tickIO); tickWriter.WriteTick(tickIO); countTicksOut++; }
public void Initialize(string folderOrfile, string symbolFile) { tickFile.Initialize(folderOrfile, symbolFile, TickFileMode.Read); PrepareTask(); }