Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }