Exemple #1
0
        public void ToString()
        {
            var sessionId = new SessionIdentity("FIX.4.2", "EXECUTOR", "CLIENT1");
            var target    = new FixMessage(sessionId, 'A');

            target.Header.Add(34, "1");
            target.Header.Add(52, "20200925-11:05:13.797");
            target.Add(98, "0");
            target.Add(108, "30");

            var str = target.ToString();

            Assert.AreEqual("8=FIX.4.2\u00019=70\u000135=A\u000149=EXECUTOR\u000156=CLIENT1\u000134=1\u000152=20200925-11:05:13.797\u000198=0\u0001108=30\u000110=096\u0001", str);
        }
Exemple #2
0
        public void OnMessage(FixMessage msg)
        {
            Console.WriteLine(">" + msg.ToString());
            var msgType = msg.Header[Tags.MsgType] as FixField <char>;

            switch (msgType.Value)
            {
            case 'D':
                var accept = new FixMessage(_session.RevertID, '8');
                accept.Header.Add(52, DateTime.UtcNow.ToString(FixSettings.DateTimeFormat));
                accept.Add(6, 0);
                accept.Add(14, 0);
                accept.Add(17, _execId++);
                accept.Add(37, _orderId++);
                accept.Add(msg[11]);
                accept.Add(39, 2);
                accept.Add(msg[54]);
                accept.Add(msg[55]);
                accept.Add(150, 0);
                accept.Add(151, 0);
                _session.SendAsync(accept);
                return;
            }
        }
 public static FixMessage readTagValues(TcpClient client)
 {
     FixMessage ret = new FixMessage();
     int tag;
     string value;
     while (true)
     {
         tag = ReadInt(client);
         if (tag < 1)
         {
             break;
         }
         value = ReadString(client);
         ret.Add(new TagValue(tag, value));
     }
     return ret;
 }
Exemple #4
0
        public void Run()
        {
            Console.ReadLine();
            Console.WriteLine("sending");
            var msg = new FixMessage(_session.ID, 'D');

            msg.Header.Add(52, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss.fff"));
            msg.Add(60, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss.fff"));
            msg.Add(1, "test");
            msg.Add(11, 1);
            msg.Add(21, 1);
            msg.Add(54, 1);
            msg.Add(55, "APPL");
            msg.Add(40, 1);
            _session.SendAsync(msg);
            Console.ReadLine();
        }