Пример #1
0
        /// <summary>
        /// 用户逐仓持仓查询
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <param name="contractType">合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度</param>
        /// <returns></returns>
        public String future_position_4fix(String symbol, String contractType)
        {
            String result = "";

            try
            {
                // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(contractType))
                {
                    paras.Add("contract_type", contractType);
                }
                paras.Add("api_key", api_key);
                String sign = MD5Util.buildMysignV1(paras, secret_key);
                paras.Add("sign", sign);
                // 发送post请求
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, FUTURE_POSITION_4FIX_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 期货账户信息
        /// </summary>
        /// <returns></returns>
        public String future_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, FUTURE_USERINFO_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
0
        /// <summary>
        /// 获取当前可用合约总持仓量
        /// </summary>
        /// <param name="symbol">btc_usd:比特币, ltc_usd:莱特币 (必填字段)</param>
        /// <param name="contract_type">合约类型。this_week:当周;next_week:下周;quarter:季度</param>
        /// <returns></returns>
        public String future_hold_amount(String symbol, String contract_type)
        {
            String result = "";

            try
            {
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                String          param    = "";
                if (!StringUtil.isEmpty(symbol))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "symbol=" + symbol;
                }
                if (!StringUtil.isEmpty(contract_type))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "contract_type=" + contract_type;
                }
                result = httpUtil.requestHttpGet(url_prex, FUTURE_HOLD_AMOUNT_URL, param);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
0
        /// <summary>
        /// 获取期货合约的K线数据
        /// </summary>
        /// <param name="symbol">btc_usd:比特币, ltc_usd:莱特币 </param>
        /// <param name="type">
        /// 1min : 1分钟
        ///3min : 3分钟
        ///5min : 5分钟
        ///15min : 15分钟
        /// 30min : 30分钟
        ///1day : 1日
        ///3day : 3日
        ///1week : 1周
        ///1hour : 1小时
        ///2hour : 2小时
        ///4hour : 4小时
        ///6hour : 6小时
        ///12hour : 12小时
        /// </param>
        /// <param name="contract_type">合约类型。this_week:当周;next_week:下周;quarter:季度</param>
        /// <param name="size">指定获取数据的条数</param>
        /// <param name="since">时间戳(eg:1417536000000)。 返回该时间戳以后的数据</param>
        /// <returns></returns>
        public String future_kline(String symbol, String type, String contract_type, String size, 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(type))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "type=" + type;
                }
                if (!StringUtil.isEmpty(contract_type))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "contract_type=" + contract_type;
                }
                if (!StringUtil.isEmpty(size))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "size=" + size;
                }
                if (!StringUtil.isEmpty(since))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "since=" + since;
                }
                result = httpUtil.requestHttpGet(url_prex, FUTURE_KLINE_URL, param);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #13
0
        /// <summary>
        /// 获取用户订单信息
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <param name="contractType">合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度</param>
        /// <param name="orderId">订单ID(-1查询全部未成交订单,否则查询相应单号的订单)</param>
        /// <param name="status">查询状态:1:未完成(最近七天的数据)  2:已完成(最近七天的数据)</param>
        /// <param name="currentPage">当前页数</param>
        /// <param name="pageLength">每页获取条数,最多不超过50</param>
        /// <returns></returns>
        public String future_order_info(String symbol, String contractType,
                                        String orderId, String status, String currentPage, String pageLength)
        {
            String result = "";

            try
            {
                // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                if (!StringUtil.isEmpty(contractType))
                {
                    paras.Add("contract_type", contractType);
                }
                if (!StringUtil.isEmpty(currentPage))
                {
                    paras.Add("current_page", currentPage);
                }
                if (!StringUtil.isEmpty(orderId))
                {
                    paras.Add("order_id", orderId);
                }
                if (!StringUtil.isEmpty(api_key))
                {
                    paras.Add("api_key", api_key);
                }
                if (!StringUtil.isEmpty(pageLength))
                {
                    paras.Add("page_length", pageLength);
                }
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(status))
                {
                    paras.Add("status", status);
                }
                String sign = MD5Util.buildMysignV1(paras, secret_key);
                paras.Add("sign", sign);
                // 发送post请求

                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, FUTURE_ORDER_INFO_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #14
0
        /// <summary>
        /// 期货下单
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <param name="contractType">合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度</param>
        /// <param name="price">价格</param>
        /// <param name="amount">委托数量</param>
        /// <param name="type">1:开多   2:开空   3:平多   4:平空</param>
        /// <param name="matchPrice">是否为对手价 0:不是    1:是   ,当取值为1时,price无效</param>
        /// <returns></returns>
        public String future_trade(String symbol, String contractType,
                                   String price, String amount, String type, String matchPrice)
        {
            String result = "";

            try
            {  // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(contractType))
                {
                    paras.Add("contract_type", contractType);
                }
                if (!StringUtil.isEmpty(api_key))
                {
                    paras.Add("api_key", api_key);
                }
                if (!StringUtil.isEmpty(price))
                {
                    paras.Add("price", price);
                }
                if (!StringUtil.isEmpty(amount))
                {
                    paras.Add("amount", amount);
                }
                if (!StringUtil.isEmpty(type))
                {
                    paras.Add("type", type);
                }
                if (!StringUtil.isEmpty(matchPrice))
                {
                    paras.Add("match_price", matchPrice);
                }
                String sign = MD5Util.buildMysignV1(paras, secret_key);
                paras.Add("sign", sign);
                // 发送post请求

                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, FUTURE_TRADE_URL, paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #15
0
        /// <summary>
        /// 汇率查询
        /// </summary>
        /// <returns></returns>
        public String exchange_rate()
        {
            String result = "";

            try
            {
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpGet(url_prex, FUTURE_EXCHANGE_RATE_URL, null);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(result);
        }
Пример #16
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);
        }
Пример #17
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);
        }
Пример #18
0
        /// <summary>
        ///  获取期货交易历史
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <param name="date">合约交割时间,格式yyyy-MM-dd</param>
        /// <param name="since">交易Id起始位置</param>
        /// <returns></returns>
        public String future_trades_history(String symbol, String date, String since)
        {
            String result = "";

            try
            {
                // 构造参数签名
                Dictionary <String, String> paras = new Dictionary <String, String>();
                if (!StringUtil.isEmpty(symbol))
                {
                    paras.Add("symbol", symbol);
                }
                if (!StringUtil.isEmpty(date))
                {
                    paras.Add("date", date);
                }
                if (!StringUtil.isEmpty(since))
                {
                    paras.Add("since", since);
                }
                if (!StringUtil.isEmpty(api_key))
                {
                    paras.Add("api_key", api_key);
                }
                String sign = MD5Util.buildMysignV1(paras, secret_key);
                paras.Add("sign", sign);
                // 发送post请求

                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                result = httpUtil.requestHttpPost(url_prex, FUTURE_TRADES_HISTORY_URL,
                                                  paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Пример #19
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);
        }
Пример #20
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);
        }
Пример #21
0
        /// <summary>
        /// 获取交割预估价
        /// </summary>
        /// <param name="symbol">btc_usd:比特币    ltc_usd :莱特币</param>
        /// <returns></returns>
        public String future_estimated_price(String symbol)
        {
            String result = "";

            try
            {
                HttpUtilManager httpUtil = HttpUtilManager.getInstance();
                String          param    = "";
                if (!StringUtil.isEmpty(symbol))
                {
                    if (!param.Equals(""))
                    {
                        param += "&";
                    }
                    param += "symbol=" + symbol;
                }
                result = httpUtil.requestHttpGet(url_prex, FUTURE_ESTIMATED_PRICE_URL, param);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }