public static void SetOpenValuesLittleTable(ref ObservableCollection <LittleTableViewer> table) { RaBotProgram.Qt = new QT(); RaBotProgram.Qt.LuaConnect(); try { foreach (LittleTableViewer tableViewer in table) { RaBotProgram.Qt.RegisterSecurity(TradeInstrument.GetIssuerCode(tableViewer.Instrument)); } for (int i = 0; i < table.Count; i++) { decimal?openValue = RaBotProgram.Qt.GetSecOpenVal (TradeInstrument.GetIssuerCode(table[i].Instrument)); if (openValue.HasValue) { table[i].OpenValue = openValue.Value; } } } finally { RaBotProgram.Qt.LuaDisconnect(); } }
private static void SetRomanIssuer(LittleTableViewer props) { string shortFileName = TradeInstrument.GetIssuerCode(props.Instrument); string fullPath = SetFile(shortFileName); using (ExcelClass xls = new ExcelClass()) { xls.OpenDocument(fullPath, false); int firstFreeRow = int.Parse(xls.GetCellStringValue(1, 1)); xls.SetCellValue(9, firstFreeRow, Deal.GetDirection(props.IsLong)); xls.SetCellValue(10, firstFreeRow, props.OpenValue.ToString()); xls.SetCellValue(11, firstFreeRow, props.StopValue.ToString()); xls.SetCellValue(12, firstFreeRow, props.Profit.ToString()); xls.CloseDocumentSave(); } }
public static void SaveQuotes(ObservableCollection <LittleTableViewer> list) { RaBotProgram.Qt.LuaConnect(); try { foreach (LittleTableViewer tableViewer in list) { if (tableViewer.OpenValue > 0) { string code = TradeInstrument.GetIssuerCode(tableViewer.Instrument); Quote quote = RaBotProgram.Qt.GetQuote(code); SetQuote(quote, code); } } } finally { RaBotProgram.Qt.LuaDisconnect(); } }
private static void SaveCurrentDeals() { StreamWriter streamWriter = new StreamWriter (Path.Combine (Application.StartupPath, Config.MiscFolderName, Folder, CurrentDealsFileName), false, Encoding.UTF8); try { foreach (Deal deal in _currentDeals) { streamWriter.WriteLine ("{0};{1};{2};{3};{4};{5};{6}", deal.OpenDate.ToString("dd.MM.yyyy HH:mm:ss"), TradeInstrument.GetIssuerCode(deal.Issuer), deal.OpenValue, deal.DirectionStr, deal.Volume, deal.LastStopValue, deal.LastStopDate.ToString("dd.MM.yyyy HH:mm:ss")); } streamWriter.Flush(); } finally { streamWriter.Close(); } }