1、确认提现
This commit is contained in:
@ -1000,3 +1000,49 @@ func (e FutRestApi) GetOrderByOrderSnLoop(symbol, ordersn string, apiUserInfo Db
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
// 获取合约U资产
|
||||
func GetFuturesUProperty(apiUserInfo DbModels.LineApiUser, data *dto.LineUserPropertyResp) error {
|
||||
endpoint := "/fapi/v3/balance"
|
||||
params := map[string]string{
|
||||
"recvWindow": "5000",
|
||||
}
|
||||
|
||||
balanceResp := make([]binancedto.BinanceFutureBalance, 0)
|
||||
client := GetClient(&apiUserInfo)
|
||||
body, code, err := client.SendFuturesAuth(endpoint, "GET", params)
|
||||
|
||||
if err != nil || code != 200 {
|
||||
log.Error("查询合约资产 参数:", params)
|
||||
log.Error("查询合约资产 code:", code)
|
||||
log.Error("查询合约资产 err:", err)
|
||||
dataMap := make(map[string]interface{})
|
||||
if err.Error() != "" {
|
||||
if err := sonic.Unmarshal([]byte(err.Error()), &dataMap); err != nil {
|
||||
return fmt.Errorf("api_id:%d 查询资产失败:%+v", apiUserInfo.Id, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
code, ok := dataMap["code"]
|
||||
if ok {
|
||||
return fmt.Errorf("api_id:%d 查询资产失败:%s", apiUserInfo.Id, ErrorMaps[code.(float64)])
|
||||
}
|
||||
if strings.Contains(err.Error(), "Unknown order sent.") {
|
||||
return fmt.Errorf("api_id:%d 查询资产失败:%+v", apiUserInfo.Id, ErrorMaps[-2011])
|
||||
}
|
||||
return fmt.Errorf("api_id:%d 查询资产失败:%+v", apiUserInfo.Id, err.Error())
|
||||
}
|
||||
|
||||
sonic.Unmarshal(body, &balanceResp)
|
||||
|
||||
for _, v := range balanceResp {
|
||||
if v.Asset == "USDT" {
|
||||
free := utility.StrToDecimal(v.AvailableBalance)
|
||||
|
||||
data.FuturesFreeAmount = free
|
||||
data.FuturesTotalAmount = utility.StrToDecimal(v.Balance)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user