Example #1
0
        // Get datetime of last Kpis calculation.
        static void KpisUpdated()
        {
            ApiClient api = new ApiClient(_apiKey);

            KpisCalcUpdatedRespV1 kpisUpdated = api.GetKpisCalcUpdated();

            Console.WriteLine("Updated time: " + kpisUpdated.kpisCalcUpdated.ToLongDateString());
        }
Example #2
0
        /// <summary>
        /// Return last time the Kpis was recalculated.
        /// Normaly this is at night after report and Stockprices is updated.
        /// But can also be during day when new reports is added.
        /// </summary>
        /// <returns></returns>
        public KpisCalcUpdatedRespV1 GetKpisCalcUpdated()
        {
            string url = string.Format(_urlRoot + "/v1/instruments/kpis/updated");
            HttpResponseMessage response = WebbCall(url, _authKey);

            if (response.IsSuccessStatusCode)
            {
                string json = response.Content.ReadAsStringAsync().Result;
                KpisCalcUpdatedRespV1 res = JsonConvert.DeserializeObject <KpisCalcUpdatedRespV1>(json);
                return(res);
            }
            else
            {
                Console.WriteLine("GetKpisCalcUpdated {0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
            }

            return(null);
        }