Discussing the article: "Market Simulation (Part 14): Sockets (VIII)"

 

Check out the new article: Market Simulation (Part 14): Sockets (VIII).

Many programmers might assume we should abandon using Excel and move directly to Python, using some packages that allow Python to generate an Excel file for later analysis of results. However, as mentioned in the previous article, although this solution is the simplest for many programmers, it will not be accepted by some users. And in this particular case, the user is always right. As programmers, we must find a way to make everything work.

In the previous article, "Market Modeling (Part 13): Sockets (VII)", we showed how to create a simple Python server that continues executing code even when there is no activity on the socket being monitored by the server. What's interesting about this implementation is that there is no need to use any thread.

However, nothing prevents us from combining what we saw in the last article with what we saw earlier, as the latter showed how to make a similar server, but using a thread when a client connects. The fact that both methods work is because both are focused on monitoring the socket in the same way, regardless of the number of connected clients. However, neither the model using a thread nor the model using the select function is suitable for our implementation.

Neither of the above. Not because they are faulty or don’t work, not at all. In fact, the reason is that in the process of writing code, they interfere with Excel. This interference forces Excel and the Python script to compete for CPU usage, making Excel very impractical.

Many programmers might assume we should abandon using Excel and move directly to Python, using some packages that allow Python to generate an Excel file for later analysis of results. . And in this case, the user is always right. As programmers, we must find a way to make everything work. If you fail to achieve what you are aiming for, it is because you do not yet possess the necessary level of knowledge. Strive to continue learning and delve deeper into the principles on which your knowledge is based.

Basics alone will not make you an advanced programmer; you will remain merely an average-level programmer. Knowledge advances not because everyone shows average results, but because some people stand out. In today's article, I want to show you how to solve the problem between Excel and Python. So sit back, and we will now look at how to make Excel and Python work together without competing for CPU usage.


Author: Daniel Jose