Exemplo n.º 1
0
        /// <summary>
        /// 用户还全款
        /// </summary>
        /// <param name="borrow_id">借款单ID</param>
        /// <returns></returns>
        public String repayment(String borrow_id)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(borrow_id))
                {
                    paras.Add("borrow_id", borrow_id);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, REPAYMENT_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 未还款列表
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 usd: 美元 </param>
        /// <param name="current_page">当前页数</param>
        /// <param name="page_length">每页数据条数,最多不超过50条</param>
        /// <returns></returns>
        public String unrepayments_info(String symbol, String current_page, String page_length)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(current_page))
                {
                    paras.Add("current_page", current_page);
                }
                if (!StringUtil.isEmpty(page_length))
                {
                    paras.Add("page_length", page_length);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, UNREPAYMENTS_INFO_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        ///  查询用户借款信息
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 usd: 美元 </param>
        /// <returns></returns>
        public String borrows_info(String symbol)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, BORROWS_INFO_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 撤销订单
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币</param>
        /// <param name="order_id">订单ID(多个订单ID中间以","分隔,一次最多允许撤消3个订单)</param>
        /// <returns></returns>
        public String cancel_order(String symbol, String order_id)
        {
            String result = "";

            try
            {// 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(order_id))
                {
                    paras.Add("order_id", order_id);
                }

                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);

                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, CANCEL_ORDER_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 取消提币BTC/LTC
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 </param>
        /// <param name="withdraw_id">提币申请Id </param>
        /// <returns></returns>
        public String cancel_withdraw(String symbol, String withdraw_id)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(withdraw_id))
                {
                    paras.Add("withdraw_id", withdraw_id);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, CANCEL_WITHDRAW_RUL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 批量下单
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币</param>
        /// <param name="type">买卖类型: 限价单(buy/sell) 市价单(buy_market/sell_market)</param>
        /// <param name="orders_data">JSON类型的字符串 例:[{price:3,amount:5},{price:3,amount:3}]   最大下单量为5,price和amount参数参考trade接口中的说明</param>
        /// <returns></returns>
        public String batch_trade(String symbol, String type,
                                  String orders_data)
        {
            String result = "";

            try
            { // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(type))
                {
                    paras.Add("type", type);
                }
                if (!StringUtil.isEmpty(orders_data))
                {
                    paras.Add("orders_data", orders_data);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);

                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, BATCH_TRADE_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 现货历史交易信息
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <param name="since">不加since参数时,返回最近的60笔交易</param>
        /// <returns></returns>
        public String trades(String symbol, String since)
        {
            String result = "";

            try
            {
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                String          param    = "";
                if (!StringUtil.isEmpty(symbol))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "symbol=" + symbol;
                }
                if (!StringUtil.isEmpty(since))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "since=" + since;
                }
                result = httpUtil.requestHttpGet(url_prex, TRADES_URL, param);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        ///  获取历史交易信息
        /// </summary>
        /// <param name="symbol">btc_usd:比特币 ltc_usd :莱特币 </param>
        /// <param name="since">从某一tid开始访问600条数据(必填项) </param>
        /// <returns></returns>
        public String trade_history(String symbol, String since)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(since))
                {
                    paras.Add("since", since);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, TRADE_HISTORY_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 提币BTC/LTC
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 </param>
        /// <param name="chargefee">网络手续费 BTC默认范围 [0.0001,0.01] LTC默认范围 [0.001,0.2],手续费越高,网络确认越快,OKCoin内部提币设置0 </param>
        /// <param name="trade_pwd">交易密码 </param>
        /// <param name="withdraw_address">提币认证地址 </param>
        /// <param name="withdraw_amount">提币数量 BTC>=0.01 LTC>=0.1 </param>
        /// <returns></returns>
        public String withdraw(String symbol, String chargefee, String trade_pwd, String withdraw_address, String withdraw_amount)
        {
            String result = "";

            try
            {
                Dictionary <String, String> paras = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(chargefee))
                {
                    paras.Add("chargefee", chargefee);
                }
                if (!StringUtil.isEmpty(trade_pwd))
                {
                    paras.Add("trade_pwd", trade_pwd);
                }
                if (!StringUtil.isEmpty(withdraw_address))
                {
                    paras.Add("withdraw_address", withdraw_address);
                }
                if (!StringUtil.isEmpty(withdraw_amount))
                {
                    paras.Add("withdraw_amount", withdraw_amount);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);

                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, WITHDRAW_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取历史订单信息,只返回最近七天的信息
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币</param>
        /// <param name="status">委托状态: 0:未成交 1:已完成(最近七天的数据)</param>
        /// <param name="current_page">当前页数</param>
        /// <param name="page_length">每页数据条数,最多不超过200</param>
        /// <returns></returns>
        public String order_history(String symbol, String status,
                                    String current_page, String page_length)
        {
            String result = "";

            try
            {
                // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(status))
                {
                    paras.Add("status", status);
                }
                if (!StringUtil.isEmpty(current_page))
                {
                    paras.Add("current_page", current_page);
                }
                if (!StringUtil.isEmpty(page_length))
                {
                    paras.Add("page_length", page_length);
                }

                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);

                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, ORDER_HISTORY_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(result);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public String userinfo()
        {
            String result = "";

            try
            {
                // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);

                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, USERINFO_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 申请借款
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 usd: 美元 </param>
        /// <param name="days">借款天数, three,seven,fifteen,thirty,sixty,ninety </param>
        /// <param name="amount">借入数量 </param>
        /// <param name="rate">借款利率 [0.0001, 0.01] </param>
        /// <returns></returns>
        public String borrow_money(String symbol, String days, String amount, String rate)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(days))
                {
                    paras.Add("days", days);
                }
                if (!StringUtil.isEmpty(amount))
                {
                    paras.Add("amount", amount);
                }
                if (!StringUtil.isEmpty(rate))
                {
                    paras.Add("rate", rate);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, BORROW_MONEY_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 获取用户提现/充值记录
        /// </summary>
        /// <param name="symbol">btc_usd: 比特币 ltc_usd: 莱特币 usd: 美元</param>
        /// <param name="type">0:充值 1 :提现 </param>
        /// <param name="current_page">当前页数</param>
        /// <param name="page_length">每页数据条数,最多不超过50条</param>
        /// <returns></returns>
        public String account_records(String symbol, String type, String current_page, String page_length)
        {
            String result = "";

            try
            {
                HttpUtilManager             httpUtil = HttpUtilManager.getInstance();
                Dictionary <String, String> paras    = new Dictionary <String, String>();
                paras.Add("api_key", api_key);
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(type))
                {
                    paras.Add("type", type);
                }
                if (!StringUtil.isEmpty(current_page))
                {
                    paras.Add("current_page", current_page);
                }
                if (!StringUtil.isEmpty(page_length))
                {
                    paras.Add("page_length", page_length);
                }
                String sign = MD5Util.buildMysignV1(paras, this.secret_key);
                paras.Add("sign", sign);
                //发送post请求
                result = httpUtil.requestHttpPost(url_prex, ACCOUNT_RECORDS_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }