public static string FormatDeal(this CIMTDeal deal, decimal balance, string serverName) { if (deal == null) { throw new ArgumentNullException(nameof(deal)); } return($"Deal #{deal.Deal()}, Server '{serverName}', User '{deal.Login()}', Balance '{balance}', {FormatDealAction(deal)} {deal.Symbol()} {deal.Volume() / 10000.00} " + $"lots at {DateTimeOffset.FromUnixTimeMilliseconds(deal.TimeMsc()).ToString("dd.MM.yyyy HH:mm:ss.fff")}"); }
private void DealEvents_DealAddEventHandler(object control, CIMTDeal deal) { var info = new RawTradeEvent() { Id = deal.Deal(), Action = deal.Action(), Symbol = deal.Symbol(), Volume = deal.Volume(), TimeMsc = deal.TimeMsc(), Login = deal.Login(), Description = deal.Print() }; _rawTradeEvents.Enqueue(info); Console.WriteLine($"Deal event received ({_connection.Name}): {deal.Print()}"); Console.WriteLine(); }
public Deal(CIMTDeal cimtDeal, string serverName) { if (cimtDeal == null) { throw new ArgumentNullException(nameof(cimtDeal)); } if (string.IsNullOrWhiteSpace(serverName)) { throw new ArgumentException($"{nameof(serverName)} cannot be null or whitespace."); } DealId = cimtDeal.Deal(); UserId = cimtDeal.Login(); Volume = cimtDeal.Volume(); Action = cimtDeal.Action() <= 1 ? (DealAction)cimtDeal.Action() : DealAction.Unknown; Symbol = cimtDeal.Symbol(); Timestamp = cimtDeal.TimeMsc(); ServerName = serverName; }