示例#1
0
文件: example.cs 项目: james-rank/cdr
    static void Main(string[] args)
    {
        long field1 = 1;
        long field2 = 2;
        long field3 = 55;

        Cdr d = new Cdr();

        d.setInteger(field1, 123);

        Console.WriteLine(d.toString());

        d.setString(field2, "Hello");
        d.setString(field3, "World");

        Console.WriteLine(d.toString());
        Console.WriteLine(d.getInt32(field1));
        Console.WriteLine(d.getString(field3));

        // this should be a string
        try {
            Console.WriteLine(d.getInt32(3));
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }

        Console.WriteLine("done");
    }
示例#2
0
        public override void onModifyAck(ulong seqno, Cdr msg)
        {
            this.logger.log(LogSeverity.level.INFO, "onModifyAck msg...");
            this.logger.log(LogSeverity.level.INFO, msg.toString());

            // cancel order
            String orderId = msg.getString(codecBinding.OrderID);

            Cdr cancel = new Cdr();

            cancel.setString(codecBinding.OriginalClientOrderID, "myorder1");
            cancel.setString(codecBinding.ClientOrderID, "myorder2");
            cancel.setString(codecBinding.OrderID, orderId);
            cancel.setInteger(codecBinding.InstrumentID, 133215);  // VOD.L
            cancel.setInteger(codecBinding.Side, 1);
            cancel.setString(codecBinding.RfqID, "XXXX");

            cancel.setInteger(codecBinding.ReservedField1, 0);
            cancel.setInteger(codecBinding.ReservedField2, 0);

            if (!this.gwc.sendCancel(cancel))
            {
                this.logger.log(LogSeverity.level.INFO, "failed to send cancel myorder1...");
            }
        }
示例#3
0
文件: example.cs 项目: ssh352/codec
    static void Main(string[] args)
    {
        Cdr d = new Cdr();

        d.setString(codecBinding.MessageType, "A");
        d.setString(codecBinding.UserName, "username");
        d.setString(codecBinding.Password, "password");
        d.setString(codecBinding.NewPassword, "password1");
        d.setInteger(codecBinding.MessageVersion, 0);

        Console.WriteLine(d.toString());

        CodecFactory cf       = new CodecFactory();
        Codec        lseCodec = cf.getCodec("lse");

        Neueda.Codecs.Buffer b = lseCodec.encode(d);

        Console.WriteLine(b);

        Cdr decoded = lseCodec.decodeBuffer(b).getCdr();

        Console.WriteLine(decoded.toString());
    }
示例#4
0
        public override void onOrderAck(ulong seqno, Cdr msg)
        {
            this.logger.log(LogSeverity.level.INFO, "onOrderAck msg...");
            this.logger.log(LogSeverity.level.INFO, msg.toString());

            // get order id from ack
            String orderId = msg.getString(codecBinding.OrderID);

            // send modify
            Cdr modify = new Cdr();

            modify.setString(codecBinding.OriginalClientOrderID, "myorder");
            modify.setString(codecBinding.ClientOrderID, "myorder1");
            modify.setString(codecBinding.OrderID, orderId);
            modify.setInteger(codecBinding.InstrumentID, 133215);  // VOD.L
            modify.setInteger(codecBinding.OrderQty, 2000);
            modify.setInteger(codecBinding.OrderType, 2);
            modify.setDouble(codecBinding.LimitPrice, 1234.56);
            modify.setInteger(codecBinding.Side, 1);
            modify.setString(codecBinding.Account, "account");
            modify.setInteger(codecBinding.ExpireDateTime, 0);
            modify.setInteger(codecBinding.DisplayQty, 0);
            modify.setDouble(codecBinding.StopPrice, 0.0);
            modify.setInteger(codecBinding.PassiveOnlyOrder, 0);
            modify.setInteger(codecBinding.ClientID, 1234);
            modify.setInteger(codecBinding.MinimumQuantity, 0);
            modify.setInteger(codecBinding.PassiveOnlyOrder, 0);
            modify.setInteger(codecBinding.ReservedField1, 0);
            modify.setInteger(codecBinding.ReservedField2, 0);
            modify.setInteger(codecBinding.ReservedField3, 0);
            modify.setInteger(codecBinding.ReservedField4, 0);

            if (!this.gwc.sendModify(modify))
            {
                this.logger.log(LogSeverity.level.ERROR, "failed to send modify");
            }
        }
示例#5
0
 public override void onAdmin(ulong seqno, Cdr msg)
 {
     this.logger.log(LogSeverity.level.INFO, "onAdmin msg...");
     this.logger.log(LogSeverity.level.INFO, msg.toString());
 }
示例#6
0
 public override void onCancelRejected(ulong seqno, Cdr msg)
 {
     this.logger.log(LogSeverity.level.INFO, "onCacnelRejected msg...");
     this.logger.log(LogSeverity.level.INFO, msg.toString());
 }