public bool CanselOrder(int order_id)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(false);
            }

            WebConector wc                       = new WebConector();
            string      api_name                 = "private/CancelOrder";
            Int64       nonce                    = DateTime.Now.Ticks;
            string      data_transmit            = string.Format("nonce={0}&txid={1}", nonce, order_id);
            var         signature                = SignatureFormat(api_name, data_transmit, nonce);
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();

            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));

            var jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            var jsonRezaltArray = JObject.Parse(jsonRezalt);

            if (jsonRezaltArray["error"] == null)
            {
                LastErrorInfo = "";
                return(true);
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["error"].ToString();
                return(false);
            }
        }
        public bool CanselOrder(BaseCurrencyPair cp, int order_id)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(false);
            }
            WebConector wc       = new WebConector();
            string      api_name = "/api/v3/order";
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();
            var    jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            string timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();

            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            string data_for_encript = "symbol=" + cp.PairName + "&orderId=" + order_id + "&timestamp=" + timestamp;

            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            string jsonRezalt      = wc.ReqwestDeleteAsync(string.Format("{0}{1}", base_url, api_name), heder, data_for_encript).Result;
            var    jsonRezaltArray = JObject.Parse(jsonRezalt);

            if (jsonRezaltArray["msg"] == null)
            {
                LastErrorInfo = "";
                return(true);
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["msg"].ToString();
                return(false);
            }
        }
        public List <BaseOrder> GetOrdersHistory(BaseCurrencyPair currencyPair, int top_count = 100)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(new List <BaseOrder>());
            }
            if (top_count > 1000)
            {
                top_count = 1000;
            }
            WebConector wc       = new WebConector();
            string      api_name = "/api/v3/allOrders";
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();
            var    jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            string timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();

            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            string data_for_encript = "symbol=" + currencyPair.PairName + "&limit=" + top_count + "&recvWindow=" + "50000" + "&timestamp=" + timestamp;

            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            string jsonRezalt = wc.ReqwestPostAsync(string.Format("{0}{1}", base_url, api_name), heder, data_for_encript).Result;

            try
            {
                var jsonRezaltArray = JArray.Parse(jsonRezalt);
                LastErrorInfo = "";
                var rezalt = new List <BaseOrder>();
                foreach (var order in jsonRezaltArray)
                {
                    BaseOrder bo = new BaseOrder();
                    bo.Id       = order["orderId"].ToObject <int>();
                    bo.Pair     = new BaseCurrencyPair(order["symbol"].ToString());
                    bo.Quantity = order["origQty"].ToObject <double>();
                    bo.Price    = order["price"].ToObject <double>();
                    bo.Type     = BinanceOrderType.SetValue(order["type"].ToString());
                    bo.Amount   = order["executedQty"].ToObject <int>();
                    rezalt.Add(bo);
                }
                return(rezalt);
            }
            catch (Exception ex)
            {
                LastErrorInfo = jsonRezalt;
                return(new List <BaseOrder>());
            }
        }
        public List <BaseAccount> GetAccountsList()
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(new List <BaseAccount>());
            }
            WebConector wc       = new WebConector();
            string      api_name = "/api/v3/account";
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();
            var    jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            string timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();

            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            string data_for_encript = "&timestamp=" + timestamp;

            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            var    url_me     = string.Format("{0}{1}?{2}", base_url, api_name, data_for_encript);
            string jsonRezalt = wc.ReqwestGetAsync(string.Format("{0}{1}?{2}", base_url, api_name, data_for_encript), heder, data_for_encript).Result;

            try
            {
                var jsonRezaltArray = JObject.Parse(jsonRezalt);
                if (jsonRezaltArray["msg"] == null)
                {
                    var jsonAccounts = JArray.Parse(jsonRezaltArray["balances"].ToString());
                    var rezalt       = new List <BaseAccount>();
                    foreach (var json_acc in jsonAccounts)
                    {
                        var ba = new BaseAccount(json_acc["asset"].ToString(), json_acc["free"].ToObject <double>());
                        rezalt.Add(ba);
                    }
                    return(rezalt);
                }
                else
                {
                    LastErrorInfo = jsonRezaltArray["msg"].ToString();
                    return(new List <BaseAccount>());
                }
            }catch (Exception ex)
            {
                LastErrorInfo = jsonRezalt;
                return(new List <BaseAccount>());
            }
        }
        public List <BaseCurrencyPair> GetCurrencyPair()
        {
            WebConector             wc              = new WebConector();
            string                  api_name        = "/api/v3/ticker/price";
            string                  jsonRezalt      = wc.ReqwestGetAsync(string.Format("{0}{1}", base_url, api_name), new List <Tuple <string, string> >(), "").Result;
            var                     jsonRezaltArray = JArray.Parse(jsonRezalt);
            List <BaseCurrencyPair> rezalt          = new List <BaseCurrencyPair>();

            if (jsonRezaltArray.Count > 0)
            {
                foreach (var cp_json in jsonRezaltArray)
                {
                    BaseCurrencyPair cp = new BaseCurrencyPair(cp_json["symbol"].ToString());
                    rezalt.Add(cp);
                }
            }

            return(rezalt);
        }
        public List <BaseBookWarrant> GetBookWarrants(List <BaseCurrencyPair> pairs, int limit = 100)
        {
            List <BaseBookWarrant> rezalt = new List <BaseBookWarrant>();

            if (limit > 5000)
            {
                limit = 5000;
            }
            WebConector wc       = new WebConector();
            string      api_name = "/api/v3/depth";

            foreach (var pair in pairs)
            {
                string pair_name       = pair.PairName;
                string paramtr         = "?&symbol=" + pair_name + "&limit=" + limit;
                string jsonRezalt      = wc.ReqwestGetAsync(string.Format("{0}{1}{2}", base_url, api_name, paramtr), new List <Tuple <string, string> >(), "").Result;
                var    jsonRezaltArray = JObject.Parse(jsonRezalt);
                if (jsonRezaltArray.Count > 0)
                {
                    BaseBookWarrant bbw = new BaseBookWarrant();
                    bbw.Name = pair_name;
                    bbw.Ask  = JArray.Parse(jsonRezaltArray["asks"].ToString()).ToObject <double[, ]>();
                    bbw.Bid  = JArray.Parse(jsonRezaltArray["bids"].ToString()).ToObject <double[, ]>();
                    double ask_amount = 0.0;
                    for (int i = 0; i < bbw.Ask.GetLength(0); i++)
                    {
                        ask_amount += bbw.Ask[i, 1];
                    }
                    bbw.Ask_amount   = ask_amount;
                    bbw.Ask_quantity = ask_amount / bbw.Ask.GetLength(0);
                    double bid_amount = 0.0;
                    for (int i = 0; i < bbw.Bid.GetLength(0); i++)
                    {
                        bid_amount += bbw.Bid[i, 1];
                    }
                    bbw.Bid_amount   = bid_amount;
                    bbw.Bid_quantity = bid_amount / bbw.Bid.GetLength(0);
                    rezalt.Add(bbw);
                }
            }
            return(rezalt);
        }
        public List <BaseBookWarrant> GetBookWarrants(List <BaseCurrencyPair> pairs, int limit)
        {
            if (pairs.Count > 1)
            {
                LastErrorInfo = "Suport only one pairs";
                return(new List <BaseBookWarrant>());
            }
            WebConector wc       = new WebConector();
            string      api_name = "public/Depth?pair=";

            foreach (ICurrencyPair pair in pairs)
            {
                api_name += pair.PairName;
            }
            if (limit > 0 && limit <= 1000)
            {
                api_name += "&count=" + limit.ToString();
            }
            string jsonRezalt             = wc.ReqwestGetAsync(string.Format(base_url, api_name), new List <Tuple <string, string> >(), "").Result;
            var    jsonRezaltArray        = JObject.Parse(jsonRezalt);
            var    books_json             = JObject.Parse(jsonRezaltArray["result"].ToString());
            List <BaseBookWarrant> rezalt = new List <BaseBookWarrant>();

            if (books_json.Count > 0)
            {
                foreach (ICurrencyPair cp in pairs)
                {
                    JToken          jwarant     = books_json[cp.PairName];
                    var             jasks       = JArray.Parse(jwarant["asks"].ToString());
                    var             jbids       = JArray.Parse(jwarant["bids"].ToString());
                    BaseBookWarrant bookWarrant = new BaseBookWarrant();
                    bookWarrant.Name = cp.PairName;
                    bookWarrant.Ask  = JArray.Parse(jasks.ToString()).ToObject <double[, ]>();
                    bookWarrant.Bid  = JArray.Parse(jbids.ToString()).ToObject <double[, ]>();
                    rezalt.Add(bookWarrant);
                }
            }

            return(rezalt);
        }
        public int PostOrder(IOrder order)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(-1);
            }
            if (!(order is KrakenOrder))
            {
                LastErrorInfo = "Use KrakenOrder type";
                return(-1);
            }
            WebConector wc            = new WebConector();
            string      api_name      = "private/AddOrder";
            Int64       nonce         = DateTime.Now.Ticks;
            string      data_transmit = "nonce=" + nonce + "&pair=" + order.Pair.PairName + "&" + "type=" + order.Type.Value + "&"
                                        + "ordertype=" + ((KrakenOrder)order).Ordertype.Value + "&" + "volume=" + order.Quantity + "&"
                                        + "price=" + order.Price;
            var signature = SignatureFormat(api_name, data_transmit, nonce);
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();

            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));

            string jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            var    jsonRezaltArray = JObject.Parse(jsonRezalt);

            if (jsonRezaltArray["error"] == null)
            {
                LastErrorInfo = "";
                return(Int32.Parse(jsonRezaltArray["txid"].ToString()));
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["error"].ToString();
                return(-1);
            }
        }
        public int PostOrder(IOrder order)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(-1);
            }
            if (!(order is BinanceOrder))
            {
                LastErrorInfo = "Use BinanceOrder type";
                return(-1);
            }
            WebConector wc       = new WebConector();
            string      api_name = "/api/v3/order";
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();
            var    jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            string timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();

            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            string data_for_encript = "symbol=" + order.Pair.PairName + "&side=" + ((BinanceOrder)order).Side.Value + "&type=" + order.Type.Value + "&timeInForce=" + ((BinanceOrder)order).TimeInForce.ToString("G") + "&quantity=" + order.Quantity + "&price=" + order.Price + "&timestamp=" + timestamp;

            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            string jsonRezalt      = wc.ReqwestPostAsync(string.Format("{0}{1}", base_url, api_name), heder, data_for_encript).Result;
            var    jsonRezaltArray = JObject.Parse(jsonRezalt);

            if (jsonRezaltArray["orderId"] != null)
            {
                LastErrorInfo = "";
                return(Int32.Parse(jsonRezaltArray["orderId"].ToString()));
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["msg"].ToString();
                return(-1);
            }
        }
        //Kraken not suport get input info
        public List <BaseAccount> GetAccountsList()
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(null);
            }
            WebConector wc                       = new WebConector();
            string      api_name                 = "private/Balance";
            Int64       nonce                    = DateTime.Now.Ticks;
            string      data_transmit            = string.Format("nonce={0}", nonce);
            var         signature                = SignatureFormat(api_name, data_transmit, nonce);
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();

            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));

            var jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            var jsonRezaltArray = JObject.Parse(jsonRezalt);

            if (jsonRezaltArray["error"] == null)
            {
                LastErrorInfo = "";
                List <BaseAccount> rezalt = new List <BaseAccount>();
                foreach (var record in jsonRezaltArray)
                {
                    rezalt.Add(new BaseAccount(record.Key, double.Parse(record.Value.ToString())));
                }
                return(rezalt);
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["error"].ToString();
                return(null);
            }
        }
        public List <BaseHistoryRecord> GetHistoryRecords(DateTime dateTime)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(new List <BaseHistoryRecord>());
            }
            WebConector wc       = new WebConector();
            string      api_name = "wapi/v3/depositHistory.html";
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();
            var    jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            string timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();

            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            string data_for_encript = "&startTime=" + dateTime.ToUnixTimestamp() + "&recvWindow=" + "50000" + "&timestamp=" + timestamp;

            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            string jsonRezalt   = wc.ReqwestPostAsync(string.Format("{0}{1}", base_url, api_name), heder, data_for_encript).Result;
            var    jarrayRezalt = JObject.Parse(jsonRezalt);
            var    rezalt       = new List <BaseHistoryRecord>();

            if (jarrayRezalt["msg"] == null)
            {
                var jsonArrayRecords = JArray.Parse(jarrayRezalt["depositList"].ToString());
                foreach (var record in jsonArrayRecords)
                {
                    BaseHistoryRecord bhr = new BaseHistoryRecord();
                    bhr.Id        = 0;
                    bhr.Provaider = record["txId"].ToString();
                    bhr.Status    = record["status"].ToString();
                    bhr.Time      = (new DateTime()).FromUnixTimestamp(record["insertTime"].ToObject <Int64>());
                    bhr.Txit      = record["txId"].ToString();
                    bhr.Type      = "deposit";
                    bhr.Account   = record["address"].ToString();;
                    bhr.Amount    = record["amount"].ToString();;
                    bhr.Currency  = record["asset"].ToString();;
                    rezalt.Add(bhr);
                }
            }
            else
            {
                LastErrorInfo = jarrayRezalt["msg"].ToString();
                return(new List <BaseHistoryRecord>());
            }
            api_name      = "/wapi/v3/withdrawHistory.html";
            heder         = new List <Tuple <string, string> >();
            jsontimestamp = wc.ReqwestGetAsync(string.Format("{0}/api/v3/time", base_url), new List <Tuple <string, string> >(), "").Result;
            timestamp     = (JObject.Parse(jsontimestamp))["serverTime"].ToString();
            heder.Add(new Tuple <string, string>("X-MBX-APIKEY", Username));
            data_for_encript = "&startTime=" + dateTime.ToUnixTimestamp() + "&recvWindow=" + "50000" + "&timestamp=" + timestamp;
            heder.Add(new Tuple <string, string>("signature", SignatureHelper.Sign(Password, data_for_encript, 256)));
            data_for_encript += "&signature=" + SignatureHelper.Sign(Password, data_for_encript, 256);
            jsonRezalt        = wc.ReqwestPostAsync(string.Format("{0}{1}", base_url, api_name), heder, data_for_encript).Result;
            jarrayRezalt      = JObject.Parse(jsonRezalt);
            if (jarrayRezalt["msg"] == null)
            {
                var jsonArrayRecords = JArray.Parse(jarrayRezalt["withdrawList"].ToString());
                foreach (var record in jsonArrayRecords)
                {
                    BaseHistoryRecord bhr = new BaseHistoryRecord();
                    bhr.Id        = 0;
                    bhr.Provaider = record["txId"].ToString();
                    bhr.Status    = record["status"].ToString();
                    bhr.Time      = (new DateTime()).FromUnixTimestamp(record["insertTime"].ToObject <Int64>());
                    bhr.Txit      = record["txId"].ToString();
                    bhr.Type      = "withdraw";
                    bhr.Account   = record["address"].ToString();;
                    bhr.Amount    = record["amount"].ToString();;
                    bhr.Currency  = record["asset"].ToString();;
                    rezalt.Add(bhr);
                }
            }
            else
            {
                LastErrorInfo += jarrayRezalt["msg"].ToString();
                return(new List <BaseHistoryRecord>());
            }
            throw new NotImplementedException();
        }
        public List <KrakenOrder> GetOrdersHistory(BaseCurrencyPair currencyPair, int top_count = -1)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(null);
            }

            List <KrakenOrder> rezalt = new List <KrakenOrder>();

            WebConector wc                       = new WebConector();
            string      api_name                 = "private/OpenOrders";
            Int64       nonce                    = DateTime.Now.Ticks;
            string      data_transmit            = string.Format("nonce={0}", nonce);
            var         signature                = SignatureFormat(api_name, data_transmit, nonce);
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();

            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));

            var jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            var jsonRezaltArray = JArray.Parse(jsonRezalt);

            if (jsonRezaltArray["error"] == null)
            {
                LastErrorInfo = "";
                foreach (JObject record in jsonRezaltArray.Children <JObject>())
                {
                    KrakenOrder     ko = new KrakenOrder();
                    BaseOrderStatus os = BaseOrderStatus.Exsist;
                    os.Value     = record["order_id"].ToString().FirstCharToUpper();
                    ko.Status    = os;
                    ko.Pair      = new BaseCurrencyPair(record["descr"]["pair"].ToString());
                    ko.Type      = KrakenOrderType.SetValue(record["descr"]["type"].ToString().FirstCharToUpper());
                    ko.Ordertype = KrakenOrderType.SetValue(record["descr"]["ordertype"].ToString().FirstCharToUpper());
                    ko.Price     = double.Parse(record["descr"]["price"].ToString());
                    ko.Quantity  = double.Parse(record["vol"].ToString());
                    ko.OpenTm    = UnixTimestampToDateTime(double.Parse(record["opentm "].ToString()));
                    rezalt.Add(ko);
                }
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["error"].ToString();
            }

            api_name      = "private/OpenOrders";
            nonce         = DateTime.Now.Ticks;
            data_transmit = string.Format("nonce={0}", nonce);
            signature     = SignatureFormat(api_name, data_transmit, nonce);
            heder         = new List <Tuple <string, string> >();
            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));

            jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            jsonRezaltArray = JArray.Parse(jsonRezalt);
            if (jsonRezaltArray["error"] == null)
            {
                foreach (JObject record in jsonRezaltArray.Children <JObject>())
                {
                    KrakenOrder     ko = new KrakenOrder();
                    BaseOrderStatus os = BaseOrderStatus.Exsist;
                    os.Value     = record["order_id"].ToString().FirstCharToUpper();
                    ko.Status    = os;
                    ko.Pair      = new BaseCurrencyPair(record["descr"]["pair"].ToString());
                    ko.Type      = KrakenOrderType.SetValue(record["descr"]["type"].ToString().FirstCharToUpper());
                    ko.Ordertype = KrakenOrderType.SetValue(record["descr"]["ordertype"].ToString().FirstCharToUpper());
                    ko.Price     = double.Parse(record["descr"]["price"].ToString());
                    ko.Quantity  = double.Parse(record["vol"].ToString());
                    ko.Amount    = double.Parse(record["count"].ToString());
                    ko.OpenTm    = UnixTimestampToDateTime(double.Parse(record["opentm "].ToString()));
                    rezalt.Add(ko);
                }
            }
            else
            {
                LastErrorInfo += jsonRezaltArray["error"].ToString();
            }
            rezalt = rezalt.Where(x => x.Pair.PairName == currencyPair.PairName).ToList();
            rezalt.OrderBy(x => x.OpenTm);
            return((top_count > 0)?rezalt.Take(top_count).ToList():rezalt);
        }
        public List <BaseHistoryRecord> GetHistoryRecords(DateTime dateTime)
        {
            if (Username == null || Password == null)
            {
                LastErrorInfo = "Not Autorizated";
                return(null);
            }
            List <BaseHistoryRecord> rezalt = new List <BaseHistoryRecord>();
            WebConector wc                       = new WebConector();
            string      api_name                 = "private/WithdrawStatus";
            Int64       nonce                    = DateTime.Now.Ticks;
            string      data_transmit            = string.Format("nonce={0}", nonce);
            var         signature                = SignatureFormat(api_name, data_transmit, nonce);
            List <Tuple <string, string> > heder = new List <Tuple <string, string> >();

            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));
            var jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            var jsonRezaltArray = JArray.Parse(jsonRezalt);

            if (jsonRezaltArray["error"] == null)
            {
                LastErrorInfo = "";
                foreach (var record in jsonRezaltArray.Children <JObject>())
                {
                    BaseHistoryRecord bhr = new BaseHistoryRecord();
                    bhr.Time      = UnixTimestampToDateTime(double.Parse(record["time"].ToString()));
                    bhr.Type      = "Withdraw";
                    bhr.Id        = int.Parse(record["refid"].ToString());
                    bhr.Currency  = "";
                    bhr.Status    = record["status"].ToString();
                    bhr.Provaider = record["info "].ToString();
                    bhr.Amount    = record["amount"].ToString();
                    bhr.Account   = "";
                    bhr.Txit      = record["txid"].ToString();
                }
            }
            else
            {
                LastErrorInfo = jsonRezaltArray["error"].ToString();
                return(null);
            }
            api_name      = "private/DepositStatus";
            nonce         = DateTime.Now.Ticks;
            data_transmit = string.Format("nonce={0}", nonce);
            signature     = SignatureFormat(api_name, data_transmit, nonce);
            heder         = new List <Tuple <string, string> >();
            heder.Add(new Tuple <string, string>("API-Key", Username));
            heder.Add(new Tuple <string, string>("API-Sign", signature));
            jsonRezalt      = wc.ReqwestPostAsync(string.Format(base_url, api_name), heder, data_transmit).Result;
            jsonRezaltArray = JArray.Parse(jsonRezalt);
            if (jsonRezaltArray["error"] == null)
            {
                foreach (var record in jsonRezaltArray.Children <JObject>())
                {
                    BaseHistoryRecord bhr = new BaseHistoryRecord();
                    bhr.Time      = UnixTimestampToDateTime(double.Parse(record["time"].ToString()));
                    bhr.Type      = "Deposit";
                    bhr.Id        = int.Parse(record["refid"].ToString());
                    bhr.Currency  = "";
                    bhr.Status    = record["status"].ToString();
                    bhr.Provaider = record["info "].ToString();
                    bhr.Amount    = record["amount"].ToString();
                    bhr.Account   = "";
                    bhr.Txit      = record["txid"].ToString();
                }
            }
            else
            {
                LastErrorInfo += jsonRezaltArray["error"].ToString();
                return(null);
            }
            return(rezalt);
        }