Ejemplo n.º 1
0
        public async Task <OrderResponse> PutMarketOrder(SideType side, ProductType productType, decimal amount, Guid?clientId)
        {
            var order = new MarketOrder
            {
                Side        = side,
                ProductType = productType.EnumToString(),
                Size        = amount,
                ClientGuid  = clientId
            };

            return(await SendPostRequest <OrderResponse>(Constants.RestUrl.Orders, order));
        }
Ejemplo n.º 2
0
        public async Task <OrderResponse> PutLimitOrder(SideType side, ProductType productType, decimal price, decimal size, Guid?clientId, bool?postOnly)
        {
            var order = new LimitOrder
            {
                Side        = side,
                Price       = price,
                Size        = size,
                ProductType = productType.EnumToString(),
                ClientGuid  = clientId,
                PostOnly    = postOnly
            };

            return(await SendPostRequest <OrderResponse>(Constants.RestUrl.Orders, order));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Historic rates for a product. Rates are returned in grouped buckets based on requested granularity.
        /// </summary>
        /// <param name="productType"></param>
        /// <param name="start">Start time in ISO 8601</param>
        /// <param name="end">End time in ISO 8601</param>
        /// <param name="granularity">Desired timeslice in seconds</param>
        /// <returns></returns>
        public async Task <List <Candle> > GetProductCandle(ProductType productType, DateTime start, DateTime end, long granularity)
        {
            var parameters = new[]
            {
                new KeyValuePair <string, string>("start", start.ToString("o")),
                new KeyValuePair <string, string>("end", end.ToString("o")),
                new KeyValuePair <string, string>("granularity", granularity.ToString())
            };

            var client = new RestClient(ApiUrl)
            {
                Authenticator = GetAuthenticator()
            };

            var req = CreateRequest(string.Format(Constants.RestUrl.ProductCandle, productType.EnumToString()), Method.GET, parameters);

            var resp = await Execute(client, req);

            return(Candle.Parse(resp.Content));
        }
Ejemplo n.º 4
0
 public async Task <ProductTicker> GetProductTicker(ProductType productType)
 {
     return(await SendGetRequest <ProductTicker>(string.Format(Constants.RestUrl.ProductTicker, productType.EnumToString()), Method.GET));
 }
Ejemplo n.º 5
0
        public async Task <ProductBook> GetProductBook(ProductType productType, BookLevel level)
        {
            var parameters = new [] { new KeyValuePair <string, string>("level", ((int)level).ToString()) };

            return(await SendGetRequest <ProductBook>(string.Format(Constants.RestUrl.ProductBook, productType.EnumToString()), Method.GET, parameters));
        }
Ejemplo n.º 6
0
 public async Task <PageResult <List <Trade> > > GetProductTrades(ProductType productType, long?before, long?after, int?limit)
 {
     return(await SendGetRequestPaged <List <Trade> >(string.Format(Constants.RestUrl.ProductTrades, productType.EnumToString()), Method.GET, before, after, limit));
 }