예제 #1
0
 public HistoryChunk(SymbolHistoryFile_Legacy old)
 {
     this.Ticks = old.Ticks;
     ChunkId    = new HistoryChunkId(
         new SymbolHistoryId(old.Market, old.Symbol, old.Timeframe),
         old.Ticks.First().Time
         );
 }
예제 #2
0
        public static HistoryChunk Load(string filePath)
        {
            var fileExtension = Path.GetExtension(filePath);

            using (var fs = File.Open(filePath, FileMode.Open))
            {
                if (fileExtension == ".bin")
                {
                    SymbolHistoryFile_Legacy fdata = Serializer.Deserialize <SymbolHistoryFile_Legacy>(fs);
                    return(new HistoryChunk(fdata));
                }
                else if (fileExtension == ".bin2")
                {
                    HistoryChunk fdata = Serializer.Deserialize <HistoryChunk>(fs);
                    return(fdata);
                }
                else
                {
                    throw new InvalidOperationException("Wrong extension for loading HistoryChunk.");
                }
            }
        }