/// <summary> /// /// </summary> private int SaveCandleInfile(string filename, CandleLib.CandleData candle) { FileLib.WFile file = new FileLib.WFile(filename); char split = '\t'; string text = candle.Time.ToString() + split + candle.FirstId.ToString() + split + candle.Open.ToString().Replace(',', '.') + split + candle.Close.ToString().Replace(',', '.') + split + //3 candle.High.ToString().Replace(',', '.') + split + candle.Low.ToString().Replace(',', '.') + split + candle.LastId.ToString() + split + //6 candle.LastTime.ToString() + split; //7 if (candle.HorVolumes.HVolCollection.Count > 0) { candle.HorVolumes.HVolCollection.CollectionArray.ForEach <ChartVol>((vol) => { if (vol.VolBuy > 0) { text += "b:" + vol.Price.ToString().Replace(',', '.') + ":" + vol.VolBuy.ToString() + split; } if (vol.VolSell > 0) { text += "s:" + vol.Price.ToString().Replace(',', '.') + ":" + vol.VolSell.ToString() + split; } }); } LastSaveCandle = candle; if (file.Append(text) == -1) { return(-1); } return(0); }
private void AppendTradeFile(Trade trade) { FileLib.WFile f = new FileLib.WFile(GetFilePath(trade.DateTrade)); //if (!f.Exists()) f.Append(""); string text = trade.Number.ToString() + '\t' + trade.DateTrade.ToString() + '\t' + trade.Price.ToString() + '\t' + trade.Volume.ToString() + '\t' + (trade.Direction == OrderDirection.Buy ? 'B' : 'S') + '\t' + trade.Sec.Code + ':' + trade.Sec.Class.Code; f.Append(text); }