public LastTrade RequestLastTrade(string Symbol) { LastTrade lastTrade = null; try { string Url = $@"{PolygonUrl}/v1/last/stocks/{Symbol}"; Debug.WriteLine($"RequestLastTrade: {Url}"); Url = AddApiKey(Url); string JSONText = JsonSecureGet(Url); lastTrade = JsonConvert.DeserializeObject <LastTrade>(JSONText); if (lastTrade != null) { OnLastTradeEvent?.Invoke(lastTrade); } } catch (Exception ex) { string Message = $"RequestLastTrade: error {ex.Message}"; FireOnExecJsonSecureGetEvent(Message); HandleJSONTextException("RequestLastTrade", "", ex); } return(lastTrade); }
public void OnRequestLastTrade(string JSONText) { LastTrade LastTradeRef = JsonConvert.DeserializeObject <LastTrade>(JSONText); if (LastTradeRef != null) { OnLastTradeEvent?.Invoke(LastTradeRef); } }