So first we take a look at some code and then we go and run our trading floor. 因此，我们首先看一些代码，然后运行我们的交易大厅。
So I wanted to point out that there are a few settings in the EMV file that you can control. 所以我想指出，EMV 文件中有一些您可以控制的设置。
You need to put these in there to make sure that things work properly. 您需要将它们放在那里以确保一切正常工作。
Run every N minutes just literally like that. 每 N 分钟运行一次，就像字面上的意思一样。
Equals 60 will make sure that it that it runs every 60 minutes. 等于 60 将确保它每 60 分钟运行一次。
Actually if you if you don't include it in your M file it will default to 60. 实际上，如果您不将其包含在 M 文件中，它将默认为 60。
Anyway, run even when market is closed, is how you can make sure that it doesn't start trading all 无论如何，即使在市场休市时也运行，这样您就可以确保它不会开始全部交易
night overnight every every hour. 晚上每隔一小时过夜一次。
And now I currently have this. 现在我已经有了这个。
True because it is Sunday right now. 确实如此，因为现在是星期日。
And I want to I want it to be trading and use many models. 我希望它能够进行交易并使用多种模型。
If it's false, it just uses Gpt4 mini. 如果为 false，则仅使用 Gpt4 mini。
If it's true, it uses the models that we just saw in the user interface. 如果这是真的，它会使用我们刚刚在用户界面中看到的模型。
And so obviously I have it as true. 显然我认为这是真的。
All right. 好的。
And now I need to show you the class that brings it all together. 现在我需要向您展示将所有这些结合在一起的类。
That is wonderfully simple and is a fitting conclusion to the other material that we've covered. 这非常简单，并且是我们所讨论的其他材料的恰当结论。
So we collect the variables that I just mentioned from the env file. 所以我们从 env 文件中收集我刚才提到的变量。
These are the names of our agents. 这些是我们代理商的名字。
And then we simply look how short this is. 然后我们简单地看看它有多短。
We create our traders. 我们创造我们的交易者。
Uh, so we create a collection of traders for each of these different traders. 呃，所以我们为每个不同的交易者创建了一个交易者集合。
And then here is the run every n minutes function. 这是每 n 分钟运行一次的函数。
This is the one that that does everything. 这是一个能做所有事情的人。
It all happens here. 这一切都发生在这里。
We start by adding this trace. 我们首先添加此跟踪。
This is where we register that we want OpenAI agents SDK to record any traces using that log tracer 这是我们注册希望 OpenAI 代理 SDK 使用该日志跟踪器记录任何跟踪的地方
that I created that I showed you a moment ago. 我刚才向你展示了我创建的。
We then create our traders as done here. 然后我们像这里一样创建我们的交易者。
And then there's a nice little whiletrue, uh, thing here. 然后这里有一个美好的小事实，呃，事情。
So this will keep going forever. 所以这将永远持续下去。
Um, it will then call async gather, which you remember means that all these async methods will happen 嗯，然后它会调用异步收集，你记得这意味着所有这些异步方法都会发生
at the same time. 同时。
Trader run for each of our traders so all four traders will be kicked off at the same time, and async 交易者为我们的每个交易者运行，因此所有四个交易者将同时启动，并且异步
IO will make sure that they all run as if as if it's multithreaded. IO 将确保它们都像多线程一样运行。
But of course, what's going on is that anytime one of them is is locked on, IO is waiting for something 但当然，发生的情况是，只要其中一个被锁定，IO 就会在等待某些东西
to come back, another one will run that will allow them all to run. 回来后，另一台将运行，这将允许他们全部运行。
Uh, and uh, at the end of that, it will then sleep for the number of minutes that we specify. 呃，呃，最后，它会休眠我们指定的分钟数。
And finally there's this if name is main. 最后还有这个，如果名称是主要的。
And that's where we kick off this whole thing. 这就是我们开始整件事的地方。
So all that remains now is for me to actually kick this off. 所以现在剩下的就是我真正开始这件事了。
Let's do it. 我们开始做吧。
And so the time has come now to launch our trading floor. 现在是时候启动我们的交易大厅了。
See these agents in action and see in particular this while true loop running. 查看这些代理的运行情况，特别是在真正的循环运行时查看这一点。
So I'm going to bring up a terminal. 所以我要打开一个终端。
This is our running user interface. 这是我们正在运行的用户界面。
I'm going to open a new terminal window to run. 我将打开一个新的终端窗口来运行。
At the same time, I'm going to change to the sixth directory and I'm going to do you've run Trading 同时，我要切换到第六个目录，我要做你已经运行的Trading
Floor dot Pi. 地板点 Pi。
And this is now kicking off our agent process and running our various agents. 现在正在启动我们的代理流程并运行我们的各种代理。
So it's running for different traders and their researchers. 所以它是为不同的交易者和他们的研究人员运行的。
And right away you can see I hope that the information in these panels has started flying by. 您马上就会看到，我希望这些面板中的信息已经开始飞速流逝。
And this of course is our user interface tracking the traces that we have intercepted and written ourselves 这当然是我们的用户界面，跟踪我们自己截获并编写的痕迹
so that we can be managing the logs. 以便我们可以管理日志。
It's being stored to a database and and showing here visibly on the user interface. 它被存储到数据库中并在用户界面上可见地显示。
And it is terrific fun to watch this and see autonomy in action. 观看这一过程并看到自治的实际应用是非常有趣的。
You'll see the different colors representing things like calling different MCP servers actually using 您将看到不同的颜色代表实际使用的调用不同 MCP 服务器之类的内容
tools. 工具。
The red when you see it is when it's actually calling our accounts business logic, our own home grown 当你看到它时的红色是当它实际上调用我们的帐户业务逻辑时，我们自己开发的
MCP server and that noise, if I don't know if it comes through on this mic, but it just made a notification MCP 服务器和噪音，如果我不知道它是否通过此麦克风发出，但它只是发出了通知
noise that one of our four traders of Warren or George or Ray or Cathy just made a trading decision 我们四位交易员沃伦、乔治、雷或凯茜中的一位刚刚做出了交易决定的噪音
and I got alerted about it, and they will now be off and running. 我收到了有关此事的警报，他们现在将开始运行。
It typically takes them a few minutes. 他们通常需要几分钟的时间。
Uh, thanks to the joys of async coding, they can run in parallel like this as they do their thinking. 呃，多亏了异步编码的乐趣，他们可以在思考时像这样并行运行。
They will go through managing their portfolio, and down below you can see things like their current 他们将管理他们的投资组合，在下面你可以看到他们当前的信息
holdings and their recent transactions. 持股及其最近的交易。
So you can keep keep stock on what they're doing. 这样您就可以随时了解他们正在做什么。
Uh, and uh, yeah, as I say, it's uh, it's it's terrific. 呃，呃，是的，正如我所说，呃，这太棒了。
Terrific fun to see this. 看到这个真是太有趣了。
Here we go. 开始了。
We can just see here. 我们只能在这里看看。
Sold five AMD shares, retrieving account details and then sold three Qualcomm and bought four Nvidia 出售 5 股 AMD 股票，检索帐户详细信息，然后出售 3 股高通股票并购买 4 股 Nvidia 股票
shares as Warren. 股票为沃伦.
Uh, they do tend to love Nvidia. 呃，他们确实喜欢英伟达。
Uh, so um, which must be something to do with the researcher and some other share activity going on, 呃，嗯，这一定与研究人员和正在进行的其他分享活动有关，
and an update there to our to the values of the portfolios. 以及我们对投资组合价值的更新。
Oh, and another text message I just got, which is and another one which is trading going on AMD trade 哦，还有我刚刚收到的另一条短信，这是另一条正在 AMD trade 上进行交易的短信
apparently. 显然。
Uh, and yeah, as I say, this is super addictive. 呃，是的，正如我所说，这非常容易上瘾。
I absolutely love watching this. 我非常喜欢看这个。
Obviously the learning point here is to really get this very visual, very real, tangible sense of 显然，这里的学习点是真正获得这种非常直观、非常真实、有形的感觉。
what it's like to have multiple agents working, uh, calling other agents and using a bunch of different 让多个代理工作是什么感觉，呃，呼叫其他代理并使用一堆不同的
MCP servers to achieve a commercial objective. MCP服务器实现了商业目标。
Uh, and being able to use this as a way of inspecting what's going on and understanding the LM activity 呃，能够用它来检查正在发生的事情并了解 LM 活动
that's happening behind the scenes to allow for this trading activity. 这是在幕后发生的，以允许这种交易活动。
So hopefully when you run this yourself and get this sense, uh, you'll find it, uh, highly, highly 所以希望当你自己运行这个并得到这种感觉时，呃，你会发现它，呃，高度，高度
educational and insightful as well as being quite a lot of fun. 具有教育意义和洞察力，而且非常有趣。