Exemplo n.º 1
0
        public IAvapiResponse_TIME_SERIES_WEEKLY QueryPrimitive(
            string symbol)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            queryString += UrlUtility.AsQueryString(getParameters);

            // Sent the Request and get the raw data from the Response
            string response = RestClient?.
                              GetAsync(queryString)?.
                              Result?.
                              Content?.
                              ReadAsStringAsync()?.
                              Result;

            IAvapiResponse_TIME_SERIES_WEEKLY ret = new AvapiResponse_TIME_SERIES_WEEKLY
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
Exemplo n.º 2
0
        public async Task <IAvapiResponse_TIME_SERIES_WEEKLY> QueryPrimitiveAsync(
            string symbol)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            queryString += UrlUtility.AsQueryString(getParameters);

            string response;

            using (var result = await RestClient.GetAsync(queryString))
            {
                response = await result.Content.ReadAsStringAsync();
            }
            IAvapiResponse_TIME_SERIES_WEEKLY ret = new AvapiResponse_TIME_SERIES_WEEKLY
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
        public async Task <IAvapiResponse_CURRENCY_EXCHANGE_RATE> QueryPrimitiveAsync(
            string from_currency,
            string to_currency)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("from_currency", from_currency));
            getParameters.Add(new KeyValuePair <string, string>("to_currency", to_currency));
            queryString += UrlUtility.AsQueryString(getParameters);

            string response;

            using (var result = await RestClient.GetAsync(queryString))
            {
                response = await result.Content.ReadAsStringAsync();
            }
            IAvapiResponse_CURRENCY_EXCHANGE_RATE ret = new AvapiResponse_CURRENCY_EXCHANGE_RATE
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
Exemplo n.º 4
0
        public async Task <IAvapiResponse_SMA> QueryPrimitiveAsync(
            string symbol,
            string interval,
            int time_period,
            string series_type)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            getParameters.Add(new KeyValuePair <string, string>("interval", interval));
            getParameters.Add(new KeyValuePair <string, string>("time_period", time_period.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("series_type", series_type));
            queryString += UrlUtility.AsQueryString(getParameters);

            string response;

            using (var result = await RestClient.GetAsync(queryString))
            {
                response = await result.Content.ReadAsStringAsync();
            }
            IAvapiResponse_SMA ret = new AvapiResponse_SMA
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
        public IAvapiResponse_CURRENCY_EXCHANGE_RATE QueryPrimitive(
            string from_currency,
            string to_currency)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("from_currency", from_currency));
            getParameters.Add(new KeyValuePair <string, string>("to_currency", to_currency));
            queryString += UrlUtility.AsQueryString(getParameters);

            // Sent the Request and get the raw data from the Response
            string response = RestClient?.
                              GetAsync(queryString)?.
                              Result?.
                              Content?.
                              ReadAsStringAsync()?.
                              Result;

            IAvapiResponse_CURRENCY_EXCHANGE_RATE ret = new AvapiResponse_CURRENCY_EXCHANGE_RATE
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
Exemplo n.º 6
0
        public async Task <IAvapiResponse_SAR> QueryPrimitiveAsync(
            string symbol,
            string interval,
            float acceleration = -1,
            float maximum      = -1)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            getParameters.Add(new KeyValuePair <string, string>("interval", interval));
            getParameters.Add(new KeyValuePair <string, string>("acceleration", acceleration.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("maximum", maximum.ToString()));
            queryString += UrlUtility.AsQueryString(getParameters);

            string response;

            using (var result = await RestClient.GetAsync(queryString))
            {
                response = await result.Content.ReadAsStringAsync();
            }
            IAvapiResponse_SAR ret = new AvapiResponse_SAR
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
        public IAvapiResponse_MACDEXT QueryPrimitive(
            string symbol,
            string interval,
            string series_type,
            int fastperiod   = -1,
            int slowperiod   = -1,
            int signalperiod = -1,
            int fastmatype   = -1,
            int slowmatype   = -1,
            int signalmatype = -1)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            getParameters.Add(new KeyValuePair <string, string>("interval", interval));
            getParameters.Add(new KeyValuePair <string, string>("series_type", series_type));
            getParameters.Add(new KeyValuePair <string, string>("fastperiod", fastperiod.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("slowperiod", slowperiod.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("signalperiod", signalperiod.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("fastmatype", fastmatype.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("slowmatype", slowmatype.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("signalmatype", signalmatype.ToString()));
            queryString += UrlUtility.AsQueryString(getParameters);

            // Sent the Request and get the raw data from the Response
            string response = RestClient?.
                              GetAsync(queryString)?.
                              Result?.
                              Content?.
                              ReadAsStringAsync()?.
                              Result;

            IAvapiResponse_MACDEXT ret = new AvapiResponse_MACDEXT
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
Exemplo n.º 8
0
        public IAvapiResponse_ULTOSC QueryPrimitive(
            string symbol,
            string interval,
            int timeperiod1 = -1,
            int timeperiod2 = -1,
            int timeperiod3 = -1)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            getParameters.Add(new KeyValuePair <string, string>("interval", interval));
            getParameters.Add(new KeyValuePair <string, string>("timeperiod1", timeperiod1.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("timeperiod2", timeperiod2.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("timeperiod3", timeperiod3.ToString()));
            queryString += UrlUtility.AsQueryString(getParameters);

            // Sent the Request and get the raw data from the Response
            string response = RestClient?.
                              GetAsync(queryString)?.
                              Result?.
                              Content?.
                              ReadAsStringAsync()?.
                              Result;

            IAvapiResponse_ULTOSC ret = new AvapiResponse_ULTOSC
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }
Exemplo n.º 9
0
        public IAvapiResponse_SAR QueryPrimitive(
            string symbol,
            string interval,
            float acceleration = -1,
            float maximum      = -1)
        {
            // Build Base Uri
            string queryString = AvapiUrl + "/query";

            // Build query parameters
            IDictionary <string, string> getParameters = new Dictionary <string, string>();

            getParameters.Add(new KeyValuePair <string, string>("function", s_function));
            getParameters.Add(new KeyValuePair <string, string>("apikey", ApiKey));
            getParameters.Add(new KeyValuePair <string, string>("symbol", symbol));
            getParameters.Add(new KeyValuePair <string, string>("interval", interval));
            getParameters.Add(new KeyValuePair <string, string>("acceleration", acceleration.ToString()));
            getParameters.Add(new KeyValuePair <string, string>("maximum", maximum.ToString()));
            queryString += UrlUtility.AsQueryString(getParameters);

            // Sent the Request and get the raw data from the Response
            string response = RestClient?.
                              GetAsync(queryString)?.
                              Result?.
                              Content?.
                              ReadAsStringAsync()?.
                              Result;

            IAvapiResponse_SAR ret = new AvapiResponse_SAR
            {
                RawData         = response,
                Data            = ParseInternal(response),
                LastHttpRequest = queryString
            };

            return(ret);
        }