Exemple #1
0
        public void handleHBEmail(AppTimeEvent timeEvent)
        {
            if (lastHBEmailTime.Equals(AppConstant.INVALID_TIME) || lastHBEmailTime.AddMinutes(AppConstant.HB_EMAIL_ELPASED_TIME) <= timeEvent.eventTime)
            {
                UserPref pref        = stgManager.ParentUI.getUserPref();
                Boolean  isSendEmail = pref.sendEmail;
                Boolean  isPlaySound = pref.playSound;
                if (!isSendEmail)
                {
                    return;
                }
                lastHBEmailTime = Utils.convertToNearestTime(timeEvent.eventTime, lastHBEmailTime, AppConstant.HB_EMAIL_ELPASED_TIME);
                ISendMailManager manager = SendMailManager.getManager();

                List <String[]> summary   = stgManager.getPositionSummary();
                String          emailBody = "";
                foreach (String[] row in summary)
                {
                    String template = "Name:[0], Position=[1], Unrealized PnL=[2], Total PnL=[3]\n";
                    emailBody += template.Replace("[0]", row[0]).Replace("[1]", row[1]).Replace("[2]", row[2]).Replace("[3]", row[3]);
                }

                if (emailBody.Equals(""))
                {
                    emailBody = "[No Content]";
                }

                manager.SendEmail("<AlgoEdge Alert> [HeartBeat] : from " + System.Environment.MachineName + " " + lastHBEmailTime, emailBody);
            }
        }
Exemple #2
0
        public void handOrderExeEvent(AppOrderExecutedEvent exeEvent)
        {
            UserPref pref        = stgManager.ParentUI.getUserPref();
            Boolean  isSendEmail = pref.sendEmail;
            Boolean  isPlaySound = pref.playSound;

            if (!isSendEmail)
            {
                return;
            }
            ISendMailManager manager   = SendMailManager.getManager();
            String           emailBody = "";
            String           template  = "Ticker Name:[0], BQty=[1], SQty=[2], Price=[3], Time=[4], Status=[5], SNo=[6]\n";

            emailBody += template.Replace("[0]", exeEvent.TickerName).Replace("[1]", exeEvent.BQty).Replace("[2]", exeEvent.SQty).Replace("[3]", exeEvent.Price)
                         .Replace("[4]", exeEvent.Time).Replace("[5]", exeEvent.Status).Replace("[6]", exeEvent.SNo);
            manager.SendEmail("<AlgoEdge Alert> ***Execution*** : from " + System.Environment.MachineName + " " + exeEvent.Time, emailBody);
            if (isPlaySound)
            {
                playTradeAlertSound();
            }
        }