Esempio n. 1
0
        protected void debugOFSM_Send(IWrite iwrite, string cmdName, object[] cmdArguments)
        {
            //usage:    send B/S   id   Q    P
            //          send B   629014 10 20000

            //parse the order:
            if (cmdArguments.Length != 5)
            {
                iwrite.WriteLine("Missing or incorrect args to send command");
                iwrite.WriteLine("type: send B|S id Q P");
            }
            else
            {
                LMTOrderParameters p = new LMTOrderParameters();
                bool _continue       = false;
                switch (cmdArguments[1].ToString().ToLower())
                {
                case "b":
                    p.TransactionType = TransactionType.BUY;
                    _continue         = true;
                    break;

                case "s":
                    p.TransactionType = TransactionType.SELL;
                    _continue         = true;
                    break;

                default:
                    iwrite.WriteLine("Illegal transaction code '" + cmdArguments[1].ToString() + "' use B for buy, S for sell");
                    break;
                }

                _continue = (_orderCookie == null);

                if (_continue)
                {
                    //initialize the order's parameters
                    p.Security       = new Stock();
                    p.Security.IdNum = JQuant.Convert.StrToInt(cmdArguments[2].ToString());
                    p.Quantity       = JQuant.Convert.StrToInt(cmdArguments[3].ToString());
                    p.Price          = JQuant.Convert.StrToDouble(cmdArguments[4].ToString());
                    _orderCookie     = new object();

                    //and pass the order for processing by the orders FSM
                    _rzFSM.Create(p, OrderEventNotifier, null, out _orderCookie);
                }
                else
                {
                    Console.WriteLine("no more than a single order is allowed in SIM mode. Cancel existing order first.");
                }
            }
            //wait for all the messages to be printed out, then print the command prompt
            Thread.Sleep(750);
        }
        protected FMROrder(LMTOrderParameters orderParams, Connection connection)
            : base(orderParams)
        {
            //initialize FMR-specific data to be defualt values
            //if order processing logic will require, either FSM
            //or TaskBar will set them to something else
            this.VBMsg = default(string);
            this.ErrNO = default(int);
            this.ErrorType = default(OrdersErrorTypes);
            this.OrderID = 0;   //make sure that the broker's tests don't fail - start from the begining
            this.AuthUser = default(string);
            this.AuthPassword = default(string);
            this.ReEnteredValue = default(string);

            //initialize the state
            this.OrderState = OrderFSMState.IDLE;
        }
Esempio n. 3
0
 //constructor
 public LimitOrderBase(LMTOrderParameters orderParams)
 {
     this.orderParameters = orderParams;
 }
Esempio n. 4
0
 //constructor
 public LimitOrderBase(LMTOrderParameters orderParams)
 {
     this.orderParameters = orderParams;
 }