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.

Async exchange issue when loading markets

See original GitHub issue
  • OS: Windows 10
  • Programming Language version: Python 3.7
  • CCXT version: 1.18.208
  • Method: load_markets

Code concerned:

class ExchangeCCXTPublic(metaclass=Singleton):
    def __init__(self, exchange_name):
        self.exchange = getattr(ccxta, exchange_name)({"nonce": lambda: ccxt.Exchange.milliseconds()})
        asyncio.run(self.exchange.load_markets())
        self.markets = list()

Stack Trace:

File "D:\envs\stingray_env\stingray\lib.py", line 88, in __init__
    asyncio.run(self.exchange.load_markets())
  File "c:\python\python37\Lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "c:\python\python37\Lib\asyncio\base_events.py", line 568, in run_until_complete
    return future.result()
  File "D:\envs\stingray_env\lib\site-packages\ccxt\async_support\base\exchange.py", line 177, in load_markets
    markets = await self.fetch_markets(params)
  File "D:\envs\stingray_env\lib\site-packages\ccxt\async_support\bxinth.py", line 79, in fetch_markets
    markets = await self.publicGetPairing()
  File "D:\envs\stingray_env\lib\site-packages\ccxt\async_support\bxinth.py", line 283, in request
    response = await self.fetch2(path, api, method, params, headers, body)
  File "D:\envs\stingray_env\lib\site-packages\ccxt\async_support\base\exchange.py", line 116, in fetch2
    return await self.fetch(request['url'], request['method'], request['headers'], request['body'])

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DaKingofcommented, Apr 24, 2019

@kroitor I got it worked out. Sorry for the late reply! It was some code before this, thank you.

1reaction
kpchandcommented, Feb 8, 2019

@kroitor

Update: I used gevent.spawn to download order book for 5 symbols concurrently and it took about 0.8 seconds. So it is clear that the issue doesn’t lie with the way requests are being sent to the exchange. So there is likely an issue with the way I was using asyncio as I still don’t understand it properly or it’s the way I am dealing with ccxt async integration…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Current issues with Microsoft Exchange ActiveSync and third ...
Issue 2.1 - Failures to provision and synchronize with Android OS. Exchange ActiveSync policies can cause provisioning and synchronization to fail when devices ......
Read more >
Exchanges — ccxt 2.4.71 documentation
Symbols are loaded and reloaded from markets. This property is a convenient shorthand for all market keys. currencies : An associative array (a...
Read more >
Welcome to python-binance v1.0.16 — python-binance 0.2.0 ...
This is an unofficial Python wrapper for the Binance exchange REST API v3. ... See examples in the Async section below or view...
Read more >
Does an asynchronously loaded script affect the loading time ...
Yes, it could. Maximum simultaneous connections is one reason that an async load could affect loading speed of other resources.
Read more >
Async Scope Reference | MuleSoft Documentation
Since they operate on a copy of the message on a different thread, async scopes cannot, by definition, support request-response exchange patterns. Instead,...
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