private void LoadMajorIndexes() { _majorIndexService.GetMajorIndex(MajorIndexType.DowJones).ContinueWith(task => { if (task.Exception == null) { DowJones = task.Result; } }); _majorIndexService.GetMajorIndex(MajorIndexType.Nasdaq).ContinueWith(task => { if (task.Exception == null) { Nasdaq = task.Result; } }); _majorIndexService.GetMajorIndex(MajorIndexType.SP500).ContinueWith(task => { if (task.Exception == null) { SP500 = task.Result; } }); }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { string uri = "majors-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await _client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (FinancialModelingPreHttpClient client = new FinancialModelingPreHttpClient()) { string uri = "major-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <MajorIndex> GetMajorIndexAsync(MajorIndexType indexType) { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = "majors-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (FinancialModelingPrepHttpClient client = new FinancialModelingPrepHttpClient()) { string uri = "majors-indexes/" + GetUriSuffix(indexType) + @"?apikey=b346753a14deb665d5489815d0a56b42"; MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public void majorIndexTest() { var m = new MajorIndex(); Assert.AreEqual(0, m.majorIndex("0")); Assert.AreEqual(7, m.majorIndex("83")); Assert.AreEqual(3, m.majorIndex("100")); Assert.AreEqual(9, m.majorIndex("85")); Assert.AreEqual(32, m.majorIndex("1000000")); Assert.AreEqual(8, m.majorIndex("1979")); Assert.AreEqual(1, m.majorIndex("5")); Assert.AreEqual(0, m.majorIndex("2016")); }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (HttpClient client = new HttpClient()) { String uri = "https://financialmodelingprep.com/api/v3/majors-indexes/.DJI" + GetUriSuffix(indexType); HttpResponseMessage response = await client.GetAsync(uri); string jsonResponse = await response.Content.ReadAsStringAsync(); MajorIndex majorIndex = JsonConvert.DeserializeObject <MajorIndex>(jsonResponse); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (FinancialModelingPrepHttpClient client = new FinancialModelingPrepHttpClient()) { string uri = @"majors-indexes/" + GetUriSuffix(indexType) + "?apikey=618edc49f868d97ae7a519ed762c4bf7"; MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <MajorIndex> GetMajorIndex(MajorIndexType IndexType) { using (ApiHttpClient client = new ApiHttpClient()) { string uri = "majors-indexes/" + GetUriSfx(IndexType) + "?apikey=" + APIKey; MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = IndexType; Debug.Write("\r\n************************************"); Debug.Write("\r\nURI: " + uri); Debug.Write("\r\nIndexName: " + majorIndex.IndexName); Debug.Write("\r\nIndexPrice: " + majorIndex.Price); Debug.Write("\r\nIndexChange: " + majorIndex.Changes); Debug.Write("\r\nIndexType: " + majorIndex.Type.ToString()); Debug.Write("\r\n************************************"); return(majorIndex); } }