question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

huobipro "The symbol is invalid" BadSymbol error for create_order() with LINK/BTC despite symbol existing.

See original GitHub issue
  • OS: macOS Catalina 10.15.7
  • Programming Language version: Python 3.8.5
  • CCXT version: 1.38.80

For some reason I’m getting a BadSymbol with LINK/BTC on huobipro on create_order() calls despite the symbol existing. The below code is working fine for other symbols (e.g. just tested on ATOM/USDT successfully). Please let me know if I can be of further help.

import ccxt

exchange = ccxt.huobipro({
    'apiKey': 'XXXXX',
    'secret': 'XXXXX',
    'enableRateLimit': True,
})

exchange.verbose = True

symbol = 'LINK/BTC'
type = 'limit'
side = 'buy'
amount = 1.0
price = 0.00065

params = {}

order = exchange.create_order(symbol, type, side, amount, price, params)
Request: POST https://api.huobi.pro/v1/order/orders/place?AccessKeyId=XXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-12-04T17%3A52%3A14&Signature= {'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36', 'Accept-Encoding': 'gzip, deflate'} {"account-id":4165283,"symbol":"linkbtc","type":"buy-limit","amount":"1","price":"0.00065"}

Response: POST https://api.huobi.pro/v1/order/orders/place?AccessKeyId=XXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-12-04T17%3A52%3A14&Signature= 200 {'Date': 'Fri, 04 Dec 2020 17:52:13 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d601d2d5dda3112625e354bbc233d29511607104333; expires=Sun, 03-Jan-21 17:52:13 GMT; path=/; domain=.huobi.pro; HttpOnly; SameSite=Lax; Secure', 'Vary': 'Accept-Encoding', 'X-HB-RateLimit-Requests-Remain': '99', 'X-HB-RateLimit-Requests-Expire': '1607104335772', 'X-Application-Context': 'mulan-broker-pro:default,prd:8080', 'Request-Id': '8168ab4c8fff24bdb7619528c1d3af53', 'Content-Encoding': 'gzip', 'X-Request-ID': 'b4ce11a87c269c0f875226ce07f66d8c', 'CF-Cache-Status': 'DYNAMIC', 'cf-request-id': '06d07b1f2d0000d6e50c3c6000000001', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'CF-RAY': '5fc761451945d6e5-FRA'} {"status":"error","err-code":"base-symbol-error","err-msg":"The symbol is invalid","data":null}
Traceback (most recent call last):
  File "/Users/eliwilliams/Desktop/huobi_test.py", line 19, in <module>
    order = exchange.create_order(symbol, type, side, amount, price, params)
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/huobipro.py", line 1089, in create_order
    response = getattr(self, method)(self.extend(request, params))
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/base/exchange.py", line 465, in inner
    return entry(_self, **inner_kwargs)
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/base/exchange.py", line 490, in request
    return self.fetch2(path, api, method, params, headers, body)
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/base/exchange.py", line 486, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/base/exchange.py", line 624, in fetch
    self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/huobipro.py", line 1392, in handle_errors
    self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)
  File "/Users/eliwilliams/Library/Python/3.8/lib/python/site-packages/ccxt/base/exchange.py", line 504, in throw_exactly_matched_exception
    raise exact[string](message)
ccxt.base.errors.BadSymbol: huobipro {"status":"error","err-code":"base-symbol-error","err-msg":"The symbol is invalid","data":null}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
elitwilliamscommented, Dec 4, 2020

@kroitor sure thing - I’ll report back!

1reaction
elitwilliamscommented, Dec 4, 2020

@elitwilliams your call looks totally legit to me, have you tried reaching out to their tech support with the above report?

I have not - I’ll do so now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong "symbol" Binance Api - Stack Overflow
I am trying to make a simple Trading bot to trade on Binance. When the bot trys to place an order it doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found