Exemplo n.º 1
0
        internal virtual bool ProcessMessage(FxMessage message)
        {
            switch (message.Type)
            {
            case Native.FX_MSG_LOGON:
                this.RaiseLogon(message);
                break;

            case Native.FX_MSG_LOGOUT:
                this.RaiseLogout(message);
                break;

            case Native.FX_MSG_SESSION_INFO:
                this.RaiseSessionInfo(message);
                break;

            case Native.FX_MSG_CACHE_UPDATED:
                this.RaiseCacheUpdated(message);
                break;

            case Native.FX_MSG_TWO_FACTOR_AUTH:
                this.RaiseTwoFactorAuth(message);
                break;

            default:
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        internal override bool ProcessMessage(FxMessage message)
        {
            if (base.ProcessMessage(message))
            {
                return(true);
            }
            switch (message.Type)
            {
            case Native.FX_MSG_ACCOUNT_INFO:
                this.RaiseAccountInfo(message);
                break;

            case Native.FX_MSG_EXECUTION_REPORT:
                this.RaiseExecutionReport(message);
                break;

            case Native.FX_MSG_TRADE_TRANSACTION_REPORT:
                this.RaiseTradeTransactionReport(message);
                break;

            case Native.FX_MSG_POSITION_REPORT:
                this.RaisePositionReport(message);
                break;

            case Native.FX_MSG_NOTIFICATION:
                this.RaiseNotification(message);
                break;

            default:
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
 internal DataEventArgs(FxMessage message)
 {
     if (message.SendingTime.HasValue)
     {
         this.SendingTime = message.SendingTime;
     }
     this.ReceivingTime = message.ReceivingTime.Value;
 }
Exemplo n.º 4
0
        void RaiseCurrencyInfo(FxMessage message)
        {
            var eh = this.CurrencyInfo;

            if (eh != null)
            {
                var e = new CurrencyInfoEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 5
0
        void RaiseUnsubscribed(FxMessage message)
        {
            var eh = this.Unsubscribed;

            if (eh != null)
            {
                var e = new UnsubscribedEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 6
0
        void RaiseSymbolInfo(FxMessage message)
        {
            var eh = this.SymbolInfo;

            if (eh != null)
            {
                var e = new SymbolInfoEventArgs(message, this.UsedProtocolVersion);
                eh(this, e);
            }
        }
Exemplo n.º 7
0
        void RaiseAccountInfo(FxMessage message)
        {
            var eh = this.AccountInfo;

            if (eh != null)
            {
                var e = new AccountInfoEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 8
0
        void RaiseCacheUpdated(FxMessage message)
        {
            var eh = this.CacheInitialized;

            if (eh != null)
            {
                var e = new CacheEventArgs();
                eh(this, e);
            }
        }
Exemplo n.º 9
0
        void RaiseTradeTransactionReport(FxMessage message)
        {
            var eh = this.TradeTransactionReport;

            if (eh != null)
            {
                var e = new TradeTransactionReportEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 10
0
        void RaiseLogout(FxMessage message)
        {
            var eh = this.Logout;

            if (eh != null)
            {
                var e = new LogoutEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 11
0
        void RaiseTwoFactorAuth(FxMessage message)
        {
            var eh = this.TwoFactorAuth;

            if (eh != null)
            {
                var e = new TwoFactorAuthEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 12
0
        void RaisePositionReport(FxMessage message)
        {
            var eh = this.PositionReport;

            if (eh != null)
            {
                var e = new PositionReportEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 13
0
        void RaiseSessionInfo(FxMessage message)
        {
            var eh = this.SessionInfo;

            if (eh != null)
            {
                var e = new SessionInfoEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 14
0
        internal unsafe LogoutEventArgs(FxMessage message) : base(message)
        {
            string       text;
            LogoutReason reason;
            int          code;

            message.GetLogoutInfo(out text, out reason, out code);

            this.Text   = text;
            this.Reason = reason;
            this.Code   = code;
        }
Exemplo n.º 15
0
        void RaiseTick(FxMessage message)
        {
#if LOG_PERFORMANCE
            ulong  timestamp = loggerOut_.GetTimestamp();
            string id        = message.Quote().Id;
            loggerOut_.LogTimestamp(id, timestamp, "Tick");
#endif
            var eh = this.Tick;
            if (eh != null)
            {
                var e = new TickEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 16
0
        void SafeProcessMessage(FxMessage message)
        {
#if !DEBUG
            try
            {
#endif
            this.ProcessMessage(message);
#if !DEBUG
        }
        catch
        {
        }
#endif
            this.handle.DispatchMessage(message);
        }
Exemplo n.º 17
0
        internal override bool ProcessMessage(FxMessage message)
        {
            if (base.ProcessMessage(message))
            {
                return(true);
            }
            switch (message.Type)
            {
            case Native.FX_MSG_SUBSCRIBED:
                this.RaiseSubscribed(message);
                this.RaiseTick(message);
                break;

            case Native.FX_MSG_UNSUBSCRIBED:
                this.RaiseUnsubscribed(message);
                break;

            case Native.FX_MSG_TICK:
                this.RaiseTick(message);
                break;

            case Native.FX_MSG_SYMBOL_INFO:
                this.RaiseSymbolInfo(message);
                break;

            case Native.FX_MSG_NOTIFICATION:
                var notification = message.Notification();
                if (notification.Type == NotificationType.ConfigUpdated)
                {
                    var e = new NotificationEventArgs(notification);
                    this.RaiseNotification(e);
                }
                else
                {
                    return(false);
                }
                break;

            case Native.FX_MSG_CURRENCY_INFO:
                this.RaiseCurrencyInfo(message);
                break;

            default:
                return(false);
            }

            return(true);
        }
Exemplo n.º 18
0
        void RaiseExecutionReport(FxMessage message)
        {
#if LOG_PERFORMANCE
            if (message.ExecutionReport().ExecutionType == ExecutionType.Trade)
            {
                ulong  timestamp = loggerOut_.GetTimestamp();
                string id        = message.ExecutionReport().ClientOrderId;
                loggerOut_.LogTimestamp(id, timestamp, "ExecReport");
            }
#endif
            var eh = this.ExecutionReport;
            if (eh != null)
            {
                var e = new ExecutionReportEventArgs(message);
                eh(this, e);
            }
        }
Exemplo n.º 19
0
        unsafe void RaiseNotification(FxMessage message)
        {
            var notification = message.Notification();

            if (notification.Type == NotificationType.Balance)
            {
                var e = new NotificationEventArgs <BalanceOperation>(notification)
                {
                    Data = new BalanceOperation(notification)
                };

                this.RaiseBalanceOperationNotification(e);
            }
            else
            {
                var e = new NotificationEventArgs(notification);
                this.RaiseNotification(e);
            }
        }
Exemplo n.º 20
0
        internal unsafe SymbolInfoEventArgs(FxMessage message, string usedProtocolVersion)
        {
            var protocolVersion = new FixProtocolVersion(usedProtocolVersion);

            this.Information = message.Symbols(protocolVersion);
        }
Exemplo n.º 21
0
 internal unsafe ExecutionReportEventArgs(FxMessage message)
 {
     this.Report = message.ExecutionReport();
 }
Exemplo n.º 22
0
 internal SubscribedEventArgs(FxMessage message)
     : base(message)
 {
     this.Tick = message.Quote();
 }
Exemplo n.º 23
0
 internal unsafe CurrencyInfoEventArgs(FxMessage message)
 {
     this.Information = message.Currencies();
 }
 internal unsafe TradeTransactionReportEventArgs(FxMessage message)
 {
     this.Report = message.TradeTransactionReport();
 }
Exemplo n.º 25
0
 internal unsafe LogonEventArgs(FxMessage message)
     : base(message)
 {
     this.ProtocolVersion = message.ProtocolVersion();
 }
Exemplo n.º 26
0
 internal unsafe AccountInfoEventArgs(FxMessage message)
 {
     this.Information = message.AccountInfo();
 }
Exemplo n.º 27
0
 internal UnsubscribedEventArgs(FxMessage message)
     : base(message)
 {
     this.Symbol = message.Symbol();
 }
Exemplo n.º 28
0
 internal unsafe PositionReportEventArgs(FxMessage message)
 {
     this.Report = message.Position();
 }
Exemplo n.º 29
0
 internal TwoFactorAuthEventArgs(FxMessage message) : base(message)
 {
     this.TwoFactorAuth = message.TwoFactorAuth();
 }
Exemplo n.º 30
0
 internal TickEventArgs(FxMessage message)
     : base(message)
 {
     this.Tick = message.Quote();
 }