예제 #1
0
        public LastQuote RequestLastQuote(string Symbol)
        {
            LastQuote LastQuote = null;

            try
            {
                string Url = $@"{PolygonUrl}/v1/last_quote/stocks/{Symbol}";
                Debug.WriteLine($"RequestLastQuote: {Url}");

                Url = AddApiKey(Url);

                string JSONText = JsonSecureGet(Url);

                LastQuote = JsonConvert.DeserializeObject <LastQuote>(JSONText);
                if (LastQuote != null)
                {
                    OnLastQuoteEvent?.Invoke(LastQuote);
                }
            }
            catch (Exception ex)
            {
                string Message = $"RequestLastQuote: error {ex.Message}";
                FireOnExecJsonSecureGetEvent(Message);

                HandleJSONTextException("RequestLastQuote", "", ex);
            }

            return(LastQuote);
        }
예제 #2
0
        public void OnRequestLastQuote(string JSONText)
        {
            LastQuote LastQuoteRef = JsonConvert.DeserializeObject <LastQuote>(JSONText);

            if (LastQuoteRef != null)
            {
                OnLastQuoteEvent?.Invoke(LastQuoteRef);
            }
        }