HuobiRDCenter / huobi_Golang

Go SDK for Huobi Spot API
https://www.htx.com/zh-cn/opend/newApiPages/
Apache License 2.0
174 stars 85 forks source link

placeOrder 示例错误代码:Invalid order source spot api #33

Open aiweisir opened 3 years ago

aiweisir commented 3 years ago

placeOrder 示例错误代码:Invalid order source spot api

代码: func placeOrder() { client := new(client.OrderClient).Init(config.AccessKey, config.SecretKey, config.Host) request := order.PlaceOrderRequest{ AccountId: config.AccountId, Type: "sell-market", Symbol: "btcusdt", Amount: "10", Source: "spot-api", }

fmt.Print("request:\n", request, '\n')

resp, err := client.PlaceOrder(&request)
if err != nil {
    applogger.Error(err.Error())
} else {
    switch resp.Status {
    case "ok":
        applogger.Info("Place order successfully, order id: %s", resp.Data)
    case "error":
        applogger.Error("Place order error 哭啊: %s", resp.ErrorMessage)
    }
}

}

aiweisir commented 3 years ago

接口为:api.huobi.de.com 下单 参数 Source 不管写什么都返回错误代码: {"status":"error","err-code":"order-source-invalid","err-msg":"invalid order source ***","data":null}
***-->spot-api 、api等等

eynzhang commented 3 years ago

@wx85278161 按您的下单参数设置了,并没有重现出问题。您的account-id用的是现货账户的account-id吗?

aiweisir commented 3 years ago

@wx85278161 按您的下单参数设置了,并没有重现出问题。您的account-id用的是现货账户的account-id吗?

是现货账号的, 现在的错误提示是余额不够,但使用接口查到有余额的: {POST https://api.huobi.de.com/v1/order/orders/place?AccessKeyId=XXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2021-02-24T06%3A39%3A19&Signature=XXXX

返回==》:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough, left: 0","data":null}

postResp:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough

使用账号查Balancec: &{GET https://api.huobi.de.com/v1/account/accounts/19253692/balance?AccessKeyId=XXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2021-02-24T06%3A50%3A10&Signature=XXXX 返回:=》Account balance: {Currency:usdt Type:trade Balance:76.335877}Account balance: {Currency:usdt Type:frozen Balance:0}

示例代码:\huobirdcenter\huobi_golang@v0.0.0-20201231082458-10d97afd26d8\cmd\accountclientexample\accountclientexample.go

aiweisir commented 3 years ago

谢谢  已经在github回复了 

---原始邮件--- 发件人: "Eyn"<notifications@github.com> 发送时间: 2021年2月24日(周三) 中午12:20 收件人: "HuobiRDCenter/huobi_Golang"<huobi_Golang@noreply.github.com>; 抄送: "wx85278161"<85278161@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [HuobiRDCenter/huobi_Golang] placeOrder 示例错误代码:Invalid order source spot api (#33)

@wx85278161 按您的下单参数设置了,并没有重现出问题。您的account-id用的是现货账户的account-id吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eynzhang commented 3 years ago

@wx85278161 按您的下单参数设置了,并没有重现出问题。您的account-id用的是现货账户的account-id吗?

是现货账号的, 现在的错误提示是余额不够,但使用接口查到有余额的: {POST https://api.huobi.de.com/v1/order/orders/place?AccessKeyId=XXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2021-02-24T06%3A39%3A19&Signature=XXXX

返回==》:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough, left: 0","data":null}

postResp:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough

使用账号查Balancec: &{GET https://api.huobi.de.com/v1/account/accounts/19253692/balance?AccessKeyId=XXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2021-02-24T06%3A50%3A10&Signature=XXXX 返回:=》Account balance: {Currency:usdt Type:trade Balance:76.335877}Account balance: {Currency:usdt Type:frozen Balance:0}

示例代码:\huobirdcenter\huobi_golang@v0.0.0-20201231082458-10d97afd26d8\cmd\accountclientexample\accountclientexample.go

根据日志,你的账户里有76.335877USDT,但是你下单时想卖10BTC,所以余额不够。

你想进行什么样的交易呢?

aiweisir commented 3 years ago

交易0.0001的的成本不到10usd,参数设为0.0001 或者0.0002也是返回 余额不够 amount | string | true | NA | 订单交易量(市价买单为订单交易额)

aiweisir commented 3 years ago

交易量设为0.0001 也提示余额不够

---原始邮件--- 发件人: "Eyn"<notifications@github.com> 发送时间: 2021年2月24日(周三) 下午3:44 收件人: "HuobiRDCenter/huobi_Golang"<huobi_Golang@noreply.github.com>; 抄送: "wx85278161"<85278161@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [HuobiRDCenter/huobi_Golang] placeOrder 示例错误代码:Invalid order source spot api (#33)

@wx85278161 按您的下单参数设置了,并没有重现出问题。您的account-id用的是现货账户的account-id吗?

是现货账号的, 现在的错误提示是余额不够,但使用接口查到有余额的: {POST https://api.huobi.de.com/v1/order/orders/place?AccessKeyId=XXXX&amp;SignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;Timestamp=2021-02-24T06%3A39%3A19&amp;Signature=XXXX

返回==》:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough, left: 0","data":null}

postResp:{"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough

使用账号查Balancec: &{GET https://api.huobi.de.com/v1/account/accounts/19253692/balance?AccessKeyId=XXXXX&amp;SignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;Timestamp=2021-02-24T06%3A50%3A10&amp;Signature=XXXX 返回:=》Account balance: {Currency:usdt Type:trade Balance:76.335877}Account balance: {Currency:usdt Type:frozen Balance:0}

示例代码:\huobirdcenter\huobi_golang@v0.0.0-20201231082458-10d97afd26d8\cmd\accountclientexample\accountclientexample.go

根据日志,你的账户里有76.335877USDT,但是你下单时想卖10BTC,所以余额不够。

你想进行什么样的交易呢?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eynzhang commented 3 years ago

@wx85278161 你的完整的交易参数是什么?按照你最开始写的参数,你是卖BTC。你现在没有BTC,所以余额不够。

rn0l485 commented 2 years ago

@eynzhang 您好,遇到一樣的問題,這是我內部的log: "feedback.Data,account-frozen-balance-insufficient-error,trade account balance is not enough, left: 809,ethusdt_buy-market_50.00000000" 後面的50是欲掛單金額,但是還是不給交易