示例#1
0
        //get signal when new Deal is added to server
        public override void OnDealAdd(CIMTDeal ServerDeal)
        {
            var actDeal = new clsDealInfo();

            actDeal.Profit     = ServerDeal.Profit();
            actDeal.Volume     = ServerDeal.Volume();
            actDeal.Symbol     = ServerDeal.Symbol();
            actDeal.UserLogin  = ServerDeal.Login();
            actDeal.PositionID = ServerDeal.PositionID();
            actDeal.uOpenTime  = ServerDeal.Time();
            this.ExternalReport(actDeal);
        }
示例#2
0
        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();
        }
示例#3
0
        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;
        }
示例#4
0
        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")}");
        }