Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        //+------------------------------------------------------------------+
        //|                                                                  |
        //+------------------------------------------------------------------+
        private void OnBnClickedButtonGetdeals(object sender = null, EventArgs e = null)
        {
            CIMTDealArray deal_array = null;
            CIMTDeal      deal       = null;
            UInt64        login      = 0;
            DateTime      from       = m_From.Value;
            DateTime      to         = m_To.Value;
            string        stype      = string.Empty;

            //--- user login
            UInt64.TryParse(m_User.Text, out login);
            //--- get deal array
            if (!m_manager.GetUserDeal(out deal_array, login, from, to))
            {
                //--- clear list
                m_List.Items.Clear();
                //---
                MessageBox.Show("Get user deal fail", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //--- clear list
            m_List.Items.Clear();
            //--- for all deal in array
            for (uint i = 0; i < deal_array.Total(); i++)
            {
                //--- get deal
                deal = deal_array.Next(i);
                //--- check error
                if (deal == null)
                {
                    break;
                }
                //--- check action
                switch ((CIMTDeal.EnDealAction)deal.Action())
                {
                case CIMTDeal.EnDealAction.DEAL_BALANCE:
                    stype = "Balance";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CREDIT:
                    stype = "Credit";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CHARGE:
                    stype = "Charge";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CORRECTION:
                    stype = "Correction";
                    break;

                case CIMTDeal.EnDealAction.DEAL_BONUS:
                    stype = "Bonus";
                    break;

                case CIMTDeal.EnDealAction.DEAL_COMMISSION:
                    stype = "Commission";
                    break;

                default:
                    //--- skip other actions
                    continue;
                }
                //---
                string stime = SMTTime.ToDateTime(deal.Time()).ToString("yyyy.MM.dd HH:mm:ss.fff");
                //--- insert item
                string[] row = { deal.Deal().ToString(), stype, deal.Profit().ToString() };
                var      it  = m_List.Items.Insert(0, stime);
                it.SubItems.AddRange(row);
                m_List.EnsureVisible(0);
                m_List.Update();
            }
        }