-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aiohttp latency deteriorating when called from xloil #46
Comments
I'll try to replicate my side. Just to confirm are you seeing the latency issue when running just 1 RTD function in a sheet containing nothing else? If you want to run highly responsive things in Excel you should be aware that RTD functions are throttled although you can change this interval it will put pressure on the GUI/main thread |
Thank you a lot for helping me with this issue.
yes.
I changed the interval While further investigating this issue I found. For the above script.
I run a full microsoft defender scan and I turned off all firewalls and virus protection before running all my test |
Just so you don't spend any more time on this: the 200ms is baked into xlOil - it interrupts the asyncio thread every 200ms to stop it hogging the python GIL. I'll make this configurable, so assume it will get resolved soon! Thank you for investigating! |
Thank you a lot. please give me a quick fix as soon as you have it. |
I've just released v0.17.9. The parameters you are looking for are: |
Excellent. |
I made a few tests I would like to share with you. Goal.Compare Methodology.
General consideration.Network Lat and server congestion can change for Xloil and Py within the same run, even if they follow shortly. Code.For XLL you can change My Conclusion.TABLE 1, GRAPH 1. thr time < Lat
TABLE 2 GRAPH 2. thr time > Lat.
TABLE 3 TABLE 4
|
Wow, this is very detailed analysis! I'm thinking that a fundamental limitation is the contention in xlOil: Excel's main thread is required to do most things, the asyncio loop which services aiohttp does run in the background, but it needs to be suspended so that Excel can run the python parts of the RTD mechanism. A way to avoid this contention would be to run an RTD server in a separate process (see the example here), then query this with Do you want the RTD server to return just single values or more complex python objects? If the latter, then it's possible to call |
Hi @cunnane , Update.
increasing the My final goal is to use XLL as a front end to build a graphical user interface (GUI).
is causing an increase of latency, I would like to figure out when it happens so that I can better understand how Excel's main thread is interacting with PY asyncio loop. We can call it Thr Lat Effect as analyzed for a subpart of my code.
If I had the Python debug my live would probably be easier :-) Honestly I am quite happy with the results I obtained so far. PY works as expected and the only Lat I am measuring at the moment, Http Lat, is back to normal values. Using Thr of 1 ML and If Http low Lat should be the case ( reducing network part of the Lat) I would probably suffer more the Thr Lat Effect total delay effect. |
The relevant part of xlOil is
The If you were to run an external COM server in python it would remove the need to interrupt the Does python debugging not work for you? |
Thank you, Py concurrency is a difficult issue. I have seen engineers ( I am a simple trader with a bit of coding knowledge) much more skilled then me making mistakes. I gave a look at server |
Agree the concurrency in xlOil took a lot of time to develop cleanly! (Or at least as clean as it currently is!) I had a look a what would be required to allow xlOil to create an external COM server for you but it turned out to be a bit more tricky than I'd hoped to start an out-of-process server. I will give this a try and let you know if I make some progress. |
Thank you |
aiohttp
Version: 3.8.1The following python code request first pokemon name and measure latency.
When called from python Average latency is usually 55 mls
when called from XLL using
xloil
latency deteriorates and becomes around 200 mlsI am not really interested in pokemons :-) but I noticed the problem sending orders to crypto exchanges using
CCXT
.CCXT
underlying networking lib isaiohttp
.Unfortunately I still have some problem as in issue 42 therefore I cannot use Xloil to write to excel. I just discovered github does not support xlsx and I do not know how I can send you the excel file
So far I managed to use xloil to to build a very nice and useful back end. I can now monitor my algos and I did it just using
async
function.I am looking forward to explore further the potential offered by your library.
Latency is essential for my trading logic so I really need help on this.
Thank you
The text was updated successfully, but these errors were encountered: