Exemplo n.º 1
0
        /// <summary>
        /// Make a call to a private (authenticated) API
        /// </summary>
        /// <param name="url">Endpoint to make a request to</param>
        /// <returns>The raw JSON returned from Coins-E</returns>
        private async Task <JObject> CallPrivate(CoinsEMethod method, CoinsEOrderFilter filter,
                                                 string cursor, int?limit, string url)
        {
            List <KeyValuePair <string, string> > kvPairs = new List <KeyValuePair <string, string> >(
                new[] {
                new KeyValuePair <string, string>(PARAM_METHOD, Enum.GetName(method.GetType(), method)),
                new KeyValuePair <string, string>(PARAM_NONCE, GetNextNonce()),
                new KeyValuePair <string, string>(PARAM_FILTER, Enum.GetName(typeof(CoinsEOrderFilter), filter).ToLower())
            }
                );

            if (null != cursor)
            {
                kvPairs.Add(new KeyValuePair <string, string>(PARAM_CURSOR, cursor));
            }
            if (null != limit)
            {
                kvPairs.Add(new KeyValuePair <string, string>(PARAM_LIMIT, limit.ToString()));
            }

            FormUrlEncodedContent request = new FormUrlEncodedContent(kvPairs.ToArray());

            this.SignRequest(request);

            return(await CallPrivate(request, url));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Make a call to a private (authenticated) API
        /// </summary>
        /// <param name="url">Endpoint to make a request to</param>
        /// <returns>The raw JSON returned from Coins-E</returns>
        private async Task <JObject> CallPrivate(CoinsEMethod method, string url)
        {
            FormUrlEncodedContent request = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>(PARAM_METHOD, Enum.GetName(method.GetType(), method)),
                new KeyValuePair <string, string>(PARAM_NONCE, GetNextNonce())
            });

            this.SignRequest(request);

            return(await CallPrivate(request, url));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Make a call to a private (authenticated) API
        /// </summary>
        /// <param name="url">Endpoint to make a request to</param>
        /// <returns>The raw JSON returned from Coins-E</returns>
        private async Task <JObject> CallPrivate(CoinsEMethod method, OrderType orderType, decimal quantity, decimal price,
                                                 string url)
        {
            FormUrlEncodedContent request = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>(PARAM_METHOD, Enum.GetName(method.GetType(), method)),
                new KeyValuePair <string, string>(PARAM_NONCE, GetNextNonce()),
                new KeyValuePair <string, string>(PARAM_ORDER_TYPE, Enum.GetName(typeof(OrderType), orderType)),
                new KeyValuePair <string, string>(PARAM_RATE, price.ToString()),
                new KeyValuePair <string, string>(PARAM_QUANTITY, quantity.ToString())
            });

            this.SignRequest(request);

            return(await CallPrivate(request, url));
        }