Exemplo n.º 1
0
        /// <summary>
        /// Get historical trades
        /// </summary>
        /// <param name="symoblName"></param>
        /// <param name="sort">Sort direction</param>
        /// <param name="by">Filter field</param>
        /// <param name="from">If filter by timestamp, then datetime in iso format or timestamp in millisecond otherwise trade id</param>
        /// <param name="till">If filter by timestamp, then datetime in iso format or timestamp in millisecond otherwise trade id</param>
        /// <param name="offset"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public async Task <List <TradeHistory> > GetTraders(string symoblName, string from, string till, int offset, int limit = 100,
                                                            PublicEnum.EnSort sort = PublicEnum.EnSort.Desc, PublicEnum.EnBy by = PublicEnum.EnBy.timestamp)
        {
            var request = new RestRequest("/api/2/history/trades");

            if (!string.IsNullOrEmpty(symoblName))
            {
                request.Parameters.Add(new Parameter("symbol", symoblName, ParameterType.GetOrPost));
            }

            request.Parameters.Add(new Parameter("sort", sort.ToString(), ParameterType.GetOrPost));

            request.Parameters.Add(new Parameter("by", by.ToString(), ParameterType.GetOrPost));

            if (!string.IsNullOrEmpty(from))
            {
                request.Parameters.Add(new Parameter("from", from, ParameterType.GetOrPost));
            }
            if (!string.IsNullOrEmpty(till))
            {
                request.Parameters.Add(new Parameter("till", till, ParameterType.GetOrPost));
            }
            if (offset > 0)
            {
                request.Parameters.Add(new Parameter("offset", offset, ParameterType.GetOrPost));
            }
            if (limit > 0)
            {
                request.Parameters.Add(new Parameter("limit", limit, ParameterType.GetOrPost));
            }

            return(await _hitBtcRestApi.Execute(request));
        }
Exemplo n.º 2
0
        public async Task <Order> openOrder(
            string symbol,
            string quantity,
            string side,
            string type,
            string price = "")
        {
            var request = new RestRequest($"/order", Method.POST);

            request.AddHeader("Accept", "application/json");
            request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
            request.AddParameter("undefined", $"symbol={symbol}&quantity={quantity}&side={side}&type={type}&price={price}&undefined=", ParameterType.RequestBody);
            return(await _api.Execute(request, true));
        }
Exemplo n.º 3
0
 public async Task <OrderBook> getOrderBook(string pairName)
 {
     return(await _api.Execute(new RestRequest($"/public/orderbook/{pairName}", Method.GET)));
 }
Exemplo n.º 4
0
 public async Task <List <Symbol> > GetSymbol()
 {
     return(await _hitBtcRestApi.Execute(new RestRequest("/api/2/public/symbol"), false));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Get trading balance
 /// </summary>
 /// <returns></returns>
 public async Task <List <Balance> > GetBalance()
 {
     return(await _hitBtcRestApi.Execute(new RestRequest("/api/2/trading/balance", Method.GET)));
 }
Exemplo n.º 6
0
 public async Task <Balances> GetBalance()
 {
     return(await _api.Execute(new RestRequest("/trading/balance", Method.GET), true));
 }
Exemplo n.º 7
0
        public async Task <List <Balance> > GetBalance()
        {
            var request = new RestRequest("/api/2/account/balance");

            return(await _hitBtcRestApi.Execute(request));
        }