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.

kucoinfutures fetch_open_orders

See original GitHub issue

Hi, I am encountering the following error when using order functions for kucoinfutures

  • OS: Linux
  • Programming Language version: Python 3.10
  • CCXT version: 1.1.29
import asyncio
import ccxtpro
from pprint import pprint
import sys
# sys.stdout = open('error', 'w')
print(ccxtpro.__version__)
symbol = 'BTC/USDT:USDT'
exchange: ccxtpro.Exchange = getattr(ccxtpro, 'kucoinfutures')({
    'enableRateLimit': True,
    'apiKey': '',
    'secret': '',
    'password': '',
    'options': {
        'defaultType': 'future', #future / swap
    }
})
# exchange.set_sandbox_mode(True)
# exchange.verbose=True
async def main():
    try:
        response = await exchange.fetch_closed_orders(symbol)
        pprint(response)
    finally:
        await exchange.close()

asyncio.run(main())
Traceback (most recent call last):
  File "/root/wc/ccxt_fetcher/experiment/kucoinfutures_fetch_open_orders.py", line 33, in <module>
    asyncio.run(main())
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/root/wc/ccxt_fetcher/experiment/kucoinfutures_fetch_open_orders.py", line 29, in main
    response = await exchange.fetch_closed_orders()
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/async_support/kucoinfutures.py", line 1120, in fetch_closed_orders
    return await self.fetch_orders_by_status('done', symbol, since, limit, params)
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/async_support/kucoinfutures.py", line 1103, in fetch_orders_by_status
    response = await getattr(self, method)(self.extend(request, params))
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/async_support/base/exchange.py", line 105, in fetch2
    return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/async_support/base/exchange.py", line 170, in fetch
    self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/async_support/kucoin.py", line 2446, in handle_errors
    self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
  File "/root/miniconda3/envs/ccxtfetcher/lib/python3.10/site-packages/ccxt/base/exchange.py", line 560, in throw_exactly_matched_exception
    raise exact[string](message)
ccxt.base.errors.InvalidOrder: kucoinfutures error.field.endAt.invalidValue
kucoinfutures requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add `await exchange.close()` to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f0f7ba0bd30>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f0f7b851600>, 6528835.413531557)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f0f7ba0bdc0>

verbose

verb.txt

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
leastchaoscommented, Jun 2, 2022

my mistake, i forgot to whitelist the ip.

0reactions
leastchaoscommented, May 21, 2022

Hi account_infos is just a helper method for me to get my credentials, need to replaced those parts with a valid API key or based on comments i placed at the side.

i updated the code to remove it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

General – KuCoin Futures API Documentation
Thank you for using KuCoin Futures API documentation. This documentation provides ... Open orders will remain open until they are either filled or...
Read more >
How to retrieve active positions using CCXT library on Kucoin ...
I can get all open orders (take profit ...
Read more >
KuCoin Futures: fetch_order_status returns 'canceled' status ...
When I fetch the same order using fetch_order_status , it returns with a status of 'canceled' but I can see the take-profit order...
Read more >
Exchanges — ccxt 2.4.71 documentation
Besides making basic market and limit orders, some exchanges offer margin trading (leverage), various derivatives (like futures contracts and options) and ...
Read more >
KuCoin API - An Introductory Guide - AlgoTrading101 Blog
KuCoin supports 3 types of orders and those are spot, margin, stop and bulk orders. Let us go briefly over the stop and...
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