You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
503 lines
18 KiB
503 lines
18 KiB
package processor
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
"strings"
|
|
"wss-pool/config"
|
|
"wss-pool/dictionary"
|
|
"wss-pool/internal"
|
|
"wss-pool/internal/data/business"
|
|
red "wss-pool/internal/redis"
|
|
"wss-pool/logging/applogger"
|
|
"wss-pool/pkg/model"
|
|
"wss-pool/pkg/model/stock"
|
|
)
|
|
|
|
/*
|
|
合约-获取行情深度数据 https://api.hbdm.com/linear-swap-ex/market/depth?contract_code=BTC-USDT&type=step0
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、type 深度类型
|
|
*/
|
|
func ContractDepth(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
typeS := internal.ReplaceStr(c.Query("type"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(typeS) > 0 {
|
|
param = param + "&" + fmt.Sprintf("type=%v", typeS)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/depth?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
if strings.Contains(bodyStr, "invalid-parameter") {
|
|
chStep6 := fmt.Sprintf("market-%s-depth-step6", contract_code)
|
|
bodyStr, _ = red.Get_Cache_Data(chStep6)
|
|
}
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取市场最优挂单 https://api.hbdm.com/linear-swap-ex/market/bbo?contract_code=BTC-USDT&business_type=swap
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、business_type 业务类型,不填默认永续 例如:futures:交割、swap:永续、all:全部
|
|
*/
|
|
func ContractBbo(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
business_type := internal.ReplaceStr(c.Query("business_type"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(business_type) > 0 {
|
|
param = param + "&" + fmt.Sprintf("business_type=%v", contract_code)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/bbo?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-K线数据获取 https://api.hbdm.com/linear-swap-ex/market/history/kline?contract_code=BTC-USDT&period=1min&size=10&from=1587052800&to=1591286400
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、period K线类型 1min, 5min, 15min, 30min, 60min,4hour,1day,1week,1mon
|
|
3、size 获取数量,默认150 [1,2000]
|
|
4、from 开始时间戳 10位 单位S
|
|
5、to 结束时间戳 10位 单位S
|
|
*/
|
|
func ContractHistoryKline(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
from := internal.IntegerInit(internal.ReplaceStr(c.Query("from")))
|
|
to := internal.IntegerInit(internal.ReplaceStr(c.Query("to")))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
if from > 0 {
|
|
param = param + "&" + fmt.Sprintf("from=%v", from)
|
|
}
|
|
if to > 0 {
|
|
param = param + "&" + fmt.Sprintf("to=%v", to)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/history/kline?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取标记价格的K线数据 https://api.hbdm.com/index/market/history/linear_swap_mark_price_kline?contract_code=BTC-USDT&period=1min&size=10
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、period K线类型 1min, 5min, 15min, 30min, 60min,4hour,1day, 1week,1mon
|
|
3、size K线获取数量 [1,2000]
|
|
*/
|
|
func ContractHistoryPriceKline(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/index/market/history/linear_swap_mark_price_kline?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-行情数据信息 https://api.hbdm.com/linear-swap-ex/market/detail/merged?contract_code=BTC-USDT
|
|
1、contract_code 合约代码 或 合约标识
|
|
*/
|
|
func ContractMerged(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/detail/merged?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
if strings.Contains(bodyStr, "invalid-parameter") {
|
|
title := fmt.Sprintf("market-%s-detail-merged", contract_code)
|
|
bodyStr, _ = red.Get_Cache_Data(title)
|
|
}
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
// 合约-行情数据列表展示 https://api.hbdm.com/linear-swap-ex/market/detail/merged?contract_code=BTC-USDT
|
|
func ContractMergedList(c *gin.Context) {
|
|
var mergedList []model.GetContractTickCompleteList
|
|
|
|
// 获取永续合约列表
|
|
for _, value := range dictionary.Symbol {
|
|
param := fmt.Sprintf("%v-USDT", strings.ToUpper(value))
|
|
applogger.Debug("合约类型:%v", param)
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/detail/merged?contract_code=%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
var merged model.GetContractTickList
|
|
if err := json.Unmarshal([]byte(bodyStr), &merged); err != nil {
|
|
applogger.Error("Unmarshal err:%v", err)
|
|
continue
|
|
}
|
|
|
|
mergedCon := model.GetContractTickCompleteList{
|
|
Tick: merged.Tick,
|
|
Ch: merged.Ch,
|
|
Status: merged.Status,
|
|
Ts: merged.Ts,
|
|
Icon: "",
|
|
FullName: "",
|
|
}
|
|
|
|
mergedList = append(mergedList, mergedCon)
|
|
}
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, mergedList, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-批量获取聚合行情(V2) https://api.hbdm.com/v2/linear-swap-ex/market/detail/batch_merged?contract_code=BTC-USDT&business_type=swap
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、business_type 业务类型,不填默认永续
|
|
*/
|
|
func ContractBatchMerged(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
business_type := internal.ReplaceStr(c.Query("business_type"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(business_type) > 0 {
|
|
param = param + "&" + fmt.Sprintf("business_type=%v", business_type)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/v2/linear-swap-ex/market/detail/batch_merged?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取市场最近成交记录 https://api.hbdm.com/linear-swap-ex/market/trade?contract_code=BTC-USDT&business_type=swap
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、business_type 业务类型,不填默认永续
|
|
*/
|
|
func ContractTrade(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
business_type := internal.ReplaceStr(c.Query("business_type"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(business_type) > 0 {
|
|
param = param + "&" + fmt.Sprintf("business_type=%v", business_type)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/trade?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-批量获取最近的交易记录 https://api.hbdm.com/linear-swap-ex/market/history/trade?contract_code=BTC-USDT&size=10
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、size 获取交易记录的数量,默认1 例如:[1, 2000]
|
|
*/
|
|
func ContractHistoryTrade(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
//phpRes := websocketservice.PHPMarketTrade(ContractStatus, size, contract_code)
|
|
//num := size - len(phpRes.List)
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
url := fmt.Sprintf("https://%v/linear-swap-ex/market/history/trade?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
bodyStr, _ := internal.HttpGet(url)
|
|
huobiRes := business.MarketTrade{}
|
|
json.Unmarshal([]byte(bodyStr), &huobiRes)
|
|
phpRes := stock.PHPMarketTradeList{}
|
|
for _, v := range huobiRes.Data {
|
|
item := stock.MarketTrade{
|
|
ID: v.Data[0].ID,
|
|
OrderNumber: fmt.Sprintf("%f", v.Data[0].Amount),
|
|
DealPrice: fmt.Sprintf("%f", v.Data[0].Price),
|
|
OrderTime: v.Data[0].Ts,
|
|
TradeType: TradeMap[v.Data[0].Direction],
|
|
IsHuobi: true,
|
|
TradeTurnover: v.Data[0].TradeTurnover,
|
|
}
|
|
phpRes.List = append(phpRes.List, item)
|
|
}
|
|
if len(phpRes.List) <= 0 {
|
|
title := fmt.Sprintf("market-%s-trade-detail", contract_code)
|
|
item, _ := red.Get_Cache_Data(title)
|
|
json.Unmarshal([]byte(item), &phpRes.List)
|
|
}
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, phpRes.List, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-平台历史持仓量查询 https://api.hbdm.com/linear-swap-api/v1/swap_his_open_interest?contract_code=BTC-USDT&pair=BTC-USDT&contract_type=swap&period=12hour&size=10&amount_type=1
|
|
1、contract_code 合约代码 备注:永续:"BTC-USDT"... ,交割:"BTC-USDT-210625"...
|
|
2、pair 交易对 备注:BTC-USDT
|
|
3、contract_type 合约类型 备注:swap(永续)、this_week(当周)、next_week(次周)、quarter(当季)、next_quarter(次季)
|
|
4、period 时间周期类型 备注:1小时:"60min",4小时:"4hour",12小时:"12hour",1天:"1day"
|
|
5、size 获取数量,默认为:48 备注:[1,200]
|
|
6、amount_type 计价单位 备注:1:张,2:币
|
|
*/
|
|
func ContractsWapHisOpenInterest(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
pair := internal.ReplaceStr(c.Query("pair"))
|
|
contract_type := internal.ReplaceStr(c.Query("contract_type"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
amount_type := internal.IntegerInit(internal.ReplaceStr(c.Query("amount_type")))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(pair) > 0 {
|
|
param = param + "&" + fmt.Sprintf("pair=%v", pair)
|
|
}
|
|
if len(contract_type) > 0 {
|
|
param = param + "&" + fmt.Sprintf("contract_type=%v", contract_type)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
if amount_type > 0 {
|
|
param = param + "&" + fmt.Sprintf("amount_type=%v", amount_type)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/linear-swap-api/v1/swap_his_open_interest?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取合约的溢价指数K线 https://api.hbdm.com/index/market/history/linear_swap_premium_index_kline?contract_code=BTC-USDT&period=1min&size=10
|
|
1、contract_code 合约代码 "BTC-USDT","ETH-USDT"...
|
|
2、period K线类型 1min, 5min, 15min, 30min, 60min,4hour,1day, 1week,1mon
|
|
3、size K线获取数量 [1,2000]
|
|
*/
|
|
func ContractHistoryLinearSwapPremiumIndexKline(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/index/market/history/linear_swap_premium_index_kline?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取实时预测资金费率的K线数据 https://api.hbdm.com/index/market/history/linear_swap_estimated_rate_kline?contract_code=BTC-USDT&period=1min&size=10
|
|
1、contract_code 合约代码 "BTC-USDT","ETH-USDT"...
|
|
2、period K线类型 1min, 5min, 15min, 30min, 60min,4hour,1day, 1week,1mon
|
|
3、size K线获取数量 [1,2000]
|
|
*/
|
|
func ContractHistoryLinearSwapEstimatedRateKline(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/index/market/history/linear_swap_estimated_rate_kline?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|
|
/*
|
|
合约-获取基差数据 https://api.hbdm.com/index/market/history/linear_swap_basis?contract_code=BTC-USDT&period=1min&size=10
|
|
1、contract_code 合约代码 或 合约标识
|
|
2、period 周期
|
|
3、basis_price_type 基差价格类型,表示在周期内计算基差使用的价格类型, 不填,默认使用开盘价
|
|
4、size 基差获取数量,默认 150
|
|
*/
|
|
func ContractHistoryLinearSwapBasis(c *gin.Context) {
|
|
contract_code := internal.ReplaceStr(c.Query("contract_code"))
|
|
period := internal.ReplaceStr(c.Query("period"))
|
|
size := internal.IntegerInit(internal.ReplaceStr(c.Query("size")))
|
|
basis_price_type := internal.ReplaceStr(c.Query("basis_price_type"))
|
|
|
|
var param string
|
|
if len(contract_code) > 0 {
|
|
param = fmt.Sprintf("contract_code=%v", contract_code)
|
|
}
|
|
if len(period) > 0 {
|
|
param = param + "&" + fmt.Sprintf("period=%v", period)
|
|
}
|
|
if size > 0 {
|
|
param = param + "&" + fmt.Sprintf("size=%v", size)
|
|
}
|
|
if len(basis_price_type) > 0 {
|
|
param = param + "&" + fmt.Sprintf("basis_price_type=%v", basis_price_type)
|
|
}
|
|
|
|
url := fmt.Sprintf("https://%v/index/market/history/linear_swap_basis?%v", config.Config.HbApi.HbContractApiHost, param)
|
|
applogger.Debug("查询数据信息:%v", url)
|
|
|
|
bodyStr, err := internal.HttpGet(url)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, err, internal.QueryError))
|
|
return
|
|
}
|
|
|
|
//applogger.Debug("第三方数据接收:%v", bodyStr)
|
|
|
|
c.JSON(http.StatusOK, internal.GinResult(http.StatusOK, bodyStr, internal.QuerySuccess))
|
|
}
|
|
|