예제 #1
0
        public void OnQuoteAdded(MtQuote quote)
        {
            Log.DebugFormat("OnQuoteAdded: begin. quote = {0}", quote);

            QuoteAdded?.Invoke(quote);

            Log.Debug("OnQuoteAdded: end.");
        }
예제 #2
0
        private void expert_QuoteChanged(MtExpert expert, MtQuote quote)
        {
            Log.DebugFormat("expert_QuoteChanged: begin. expert = {0}, quote = {1}", expert, quote);

            _service.QuoteUpdate(quote);

            Log.Debug("expert_QuoteChanged: end.");
        }
예제 #3
0
        public void OnQuoteRemoved(MtQuote quote)
        {
            Debug.WriteLine("[INFO] MtClient::OnQuoteRemoved");

            if (QuoteRemoved != null)
            {
                QuoteRemoved(quote);
            }
        }
예제 #4
0
파일: MtExpert.cs 프로젝트: ecakirman/mtapi
        private void FireOnQuoteChanged(MtQuote quote)
        {
            var handler = QuoteChanged;

            if (handler != null)
            {
                handler(this, quote);
            }
        }
예제 #5
0
        public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
        {
            if (mtHandler == null)
            {
                throw new ArgumentNullException(nameof(mtHandler));
            }

            Quote     = quote;
            Handle    = handle;
            _mtHadler = mtHandler;
        }
예제 #6
0
        public void OnQuoteUpdate(MtQuote quote)
        {
            if (quote != null)
            {
                if (QuoteUpdated != null)
                {
                    QuoteUpdated(quote);
                }

                Debug.WriteLine("[INFO] MtClient::OnQuoteUpdate: " + quote);
            }
        }
예제 #7
0
파일: MtClient.cs 프로젝트: zhao0876/mtapi
        public void OnQuoteUpdate(MtQuote quote)
        {
            Log.DebugFormat("OnQuoteUpdate: begin. quote = {0}", quote);

            if (quote == null)
            {
                return;
            }

            QuoteUpdated?.Invoke(quote);

            Log.Debug("OnQuoteUpdate: end.");
        }
예제 #8
0
        public MtExpert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
        {
            if (mtHandler == null)
            {
                throw new ArgumentNullException(nameof(mtHandler));
            }

            _quote = new MtQuote {
                ExpertHandle = handle, Instrument = symbol, Bid = bid, Ask = ask
            };
            Handle    = handle;
            _mtHadler = mtHandler;
        }
예제 #9
0
        public override void UpdateQuote(MtQuote quote)
        {
            Log.Debug("UpdateQuote: begin.");

            base.UpdateQuote(quote);

            if (IsTestMode)
            {
                //reset timer
                _stopTimer.Stop();
                _stopTimer.Start();
            }

            Log.Debug("UpdateQuote: end.");
        }
예제 #10
0
        public void OnQuoteRemoved(MtQuote quote)
        {
            try
            {
                mClientsLocker.AcquireReaderLock(2000);

                List <IMtApiCallback> crashedClientsCallback = null;

                try
                {
                    foreach (var callback in mClientCallbacks)
                    {
                        try
                        {
                            callback.OnQuoteRemoved(quote);
                        }
                        catch (Exception)
                        {
                            if (crashedClientsCallback == null)
                            {
                                crashedClientsCallback = new List <IMtApiCallback>();
                            }

                            crashedClientsCallback.Add(callback);
                        }
                    }
                }
                finally
                {
                    mClientsLocker.ReleaseReaderLock();
                }

                removeCrashedClientCallbacks(crashedClientsCallback);
            }
            catch (ApplicationException)
            {
            }
        }
예제 #11
0
 public void OnQuoteRemoved(MtQuote quote)
 {
     ExecuteCallbackAction(a => a.OnQuoteRemoved(quote));
 }
예제 #12
0
 public void QuoteUpdate(MtQuote quote)
 {
     ExecuteCallbackAction(a => a.OnQuoteUpdate(quote));
 }
예제 #13
0
 private void FireOnQuoteChanged(MtQuote quote)
 {
     QuoteChanged?.Invoke(this, quote);
 }
예제 #14
0
 public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
 {
     Quote = quote;
     Handle = handle;
     mMtHadler = mtHandler;
 }
예제 #15
0
 private void expert_QuoteChanged(MtExpert expert, MtQuote quote)
 {
     mService.QuoteUpdate(quote);
 }
예제 #16
0
        public void OnQuoteRemoved(MtQuote quote)
        {
            try
            {
                mClientsLocker.AcquireReaderLock(2000);

                List<IMtApiCallback> crashedClientsCallback = null;

                try
                {
                    foreach (var callback in mClientCallbacks)
                    {
                        try
                        {
                            callback.OnQuoteRemoved(quote);
                        }
                        catch (Exception)
                        {
                            if (crashedClientsCallback == null)
                                crashedClientsCallback = new List<IMtApiCallback>();

                            crashedClientsCallback.Add(callback);
                        }
                    }
                }
                finally
                {
                    mClientsLocker.ReleaseReaderLock();
                }

                removeCrashedClientCallbacks(crashedClientsCallback);
            }
            catch (ApplicationException)
            {
            }
        }
예제 #17
0
        public void OnQuoteUpdate(MtQuote quote)
        {
            if (quote != null)
            {                
                if (QuoteUpdated != null)
                {
                    QuoteUpdated(quote);
                }

                Debug.WriteLine("[INFO] MtClient::OnQuoteUpdate: " + quote);
            }
        }
예제 #18
0
파일: MtServer.cs 프로젝트: plexzhang/mtapi
 private void expert_QuoteChanged(MtExpert expert, MtQuote quote)
 {
     mService.QuoteUpdate(quote);
 }
예제 #19
0
파일: MtExpert.cs 프로젝트: ychaim/mtapi
 public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
 {
     Quote     = quote;
     Handle    = handle;
     _mtHadler = mtHandler;
 }
예제 #20
0
        public void OnQuoteRemoved(MtQuote quote)
        {
            Debug.WriteLine("[INFO] MtClient::OnQuoteRemoved");

            if (QuoteRemoved != null)
            {
                QuoteRemoved(quote);
            }
        }
예제 #21
0
파일: MtClient.cs 프로젝트: ychaim/mtapi
        public void OnQuoteRemoved(MtQuote quote)
        {
            Debug.WriteLine("[INFO] MtClient::OnQuoteRemoved");

            QuoteRemoved?.Invoke(quote);
        }