Example #1
0
 public KeyBinding(Key key, bool onKeyDown,
                   TradeOp operation, BaseQuote quote, double value, int quantity)
 {
     this.Key       = key;
     this.OnKeyDown = onKeyDown;
     this.Action    = new OwnAction(operation, quote, value, quantity);
 }
Example #2
0
        // **********************************************************************
        // *                        Пользовательские ф-ции                      *
        // **********************************************************************

        public Transaction ExecAction(OwnAction action)
        {
            Transaction nt = null;

            if (Connected != TermConnection.None)
            {
                lock (tlist)
                {
                    if (action.Operation == TradeOp.Cancel)
                    {
                        if (action.Quote == BaseQuote.Absolute)
                        {
                            foreach (Transaction t in tlist)
                            {
                                if (t.Price == action.Value && t.Status != TStatus.Canceled)
                                {
                                    t.Status = TStatus.Cancel;
                                }
                            }

                            stopOrders.KillOrder(0, action.Value);
                        }
                        else
                        {
                            foreach (Transaction t in tlist)
                            {
                                if (t.Status != TStatus.Canceled)
                                {
                                    t.Status = TStatus.Cancel;
                                }
                            }

                            stopOrders.Clear();
                        }
                    }
                    else
                    {
                        if (action.Operation == TradeOp.Close || action.Operation == TradeOp.Reverse)
                        {
                            foreach (Transaction t in tlist)
                            {
                                if (t.Status != TStatus.Canceled)
                                {
                                    t.Status = TStatus.Cancel;
                                }
                            }

                            stopOrders.Clear();
                        }

                        tlist.AddLast(nt = new Transaction(action));
                    }

                    ProcessTList();
                }
            }

            return(nt);
        }
Example #3
0
 public Transaction(OwnAction action)
 {
     this.Status = TStatus.Execute;
     this.Action = action;
 }