1
00:00:00,280 --> 00:00:05,320
So first we take a look at some code and then we go and run our trading floor.
因此，我们首先看一些代码，然后运行我们的交易大厅。

2
00:00:05,480 --> 00:00:10,240
So I wanted to point out that there are a few settings in the EMV file that you can control.
所以我想指出，EMV 文件中有一些您可以控制的设置。

3
00:00:10,400 --> 00:00:13,640
You need to put these in there to make sure that things work properly.
您需要将它们放在那里以确保一切正常工作。

4
00:00:13,840 --> 00:00:17,240
Run every N minutes just literally like that.
每 N 分钟运行一次，就像字面上的意思一样。

5
00:00:17,280 --> 00:00:22,320
Equals 60 will make sure that it that it runs every 60 minutes.
等于 60 将确保它每 60 分钟运行一次。

6
00:00:22,360 --> 00:00:25,600
Actually if you if you don't include it in your M file it will default to 60.
实际上，如果您不将其包含在 M 文件中，它将默认为 60。

7
00:00:25,640 --> 00:00:32,920
Anyway, run even when market is closed, is how you can make sure that it doesn't start trading all
无论如何，即使在市场休市时也运行，这样您就可以确保它不会开始全部交易

8
00:00:32,920 --> 00:00:35,160
night overnight every every hour.
晚上每隔一小时过夜一次。

9
00:00:35,560 --> 00:00:36,720
And now I currently have this.
现在我已经有了这个。

10
00:00:36,720 --> 00:00:38,320
True because it is Sunday right now.
确实如此，因为现在是星期日。

11
00:00:38,320 --> 00:00:42,160
And I want to I want it to be trading and use many models.
我希望它能够进行交易并使用多种模型。

12
00:00:42,320 --> 00:00:45,080
If it's false, it just uses Gpt4 mini.
如果为 false，则仅使用 Gpt4 mini。

13
00:00:45,120 --> 00:00:49,680
If it's true, it uses the models that we just saw in the user interface.
如果这是真的，它会使用我们刚刚在用户界面中看到的模型。

14
00:00:49,720 --> 00:00:51,920
And so obviously I have it as true.
显然我认为这是真的。

15
00:00:52,480 --> 00:00:53,120
All right.
好的。

16
00:00:53,160 --> 00:00:56,760
And now I need to show you the class that brings it all together.
现在我需要向您展示将所有这些结合在一起的类。

17
00:00:56,760 --> 00:01:02,670
That is wonderfully simple and is a fitting conclusion to the other material that we've covered.
这非常简单，并且是我们所讨论的其他材料的恰当结论。

18
00:01:02,990 --> 00:01:07,510
So we collect the variables that I just mentioned from the env file.
所以我们从 env 文件中收集我刚才提到的变量。

19
00:01:07,510 --> 00:01:11,070
These are the names of our agents.
这些是我们代理商的名字。

20
00:01:11,390 --> 00:01:14,470
And then we simply look how short this is.
然后我们简单地看看它有多短。

21
00:01:14,670 --> 00:01:17,150
We create our traders.
我们创造我们的交易者。

22
00:01:17,390 --> 00:01:22,590
Uh, so we create a collection of traders for each of these different traders.
呃，所以我们为每个不同的交易者创建了一个交易者集合。

23
00:01:22,950 --> 00:01:27,710
And then here is the run every n minutes function.
这是每 n 分钟运行一次的函数。

24
00:01:27,710 --> 00:01:29,470
This is the one that that does everything.
这是一个能做所有事情的人。

25
00:01:29,470 --> 00:01:30,630
It all happens here.
这一切都发生在这里。

26
00:01:30,790 --> 00:01:33,910
We start by adding this trace.
我们首先添加此跟踪。

27
00:01:33,910 --> 00:01:42,230
This is where we register that we want OpenAI agents SDK to record any traces using that log tracer
这是我们注册希望 OpenAI 代理 SDK 使用该日志跟踪器记录任何跟踪的地方

28
00:01:42,230 --> 00:01:44,910
that I created that I showed you a moment ago.
我刚才向你展示了我创建的。

29
00:01:45,270 --> 00:01:47,710
We then create our traders as done here.
然后我们像这里一样创建我们的交易者。

30
00:01:48,030 --> 00:01:51,470
And then there's a nice little whiletrue, uh, thing here.
然后这里有一个美好的小事实，呃，事情。

31
00:01:51,470 --> 00:01:52,870
So this will keep going forever.
所以这将永远持续下去。

32
00:01:53,190 --> 00:01:59,930
Um, it will then call async gather, which you remember means that all these async methods will happen
嗯，然后它会调用异步收集，你记得这意味着所有这些异步方法都会发生

33
00:01:59,930 --> 00:02:00,970
at the same time.
同时。

34
00:02:01,290 --> 00:02:09,050
Trader run for each of our traders so all four traders will be kicked off at the same time, and async
交易者为我们的每个交易者运行，因此所有四个交易者将同时启动，并且异步

35
00:02:09,050 --> 00:02:12,970
IO will make sure that they all run as if as if it's multithreaded.
IO 将确保它们都像多线程一样运行。

36
00:02:12,970 --> 00:02:18,770
But of course, what's going on is that anytime one of them is is locked on, IO is waiting for something
但当然，发生的情况是，只要其中一个被锁定，IO 就会在等待某些东西

37
00:02:18,770 --> 00:02:22,850
to come back, another one will run that will allow them all to run.
回来后，另一台将运行，这将允许他们全部运行。

38
00:02:23,170 --> 00:02:30,530
Uh, and uh, at the end of that, it will then sleep for the number of minutes that we specify.
呃，呃，最后，它会休眠我们指定的分钟数。

39
00:02:30,970 --> 00:02:34,690
And finally there's this if name is main.
最后还有这个，如果名称是主要的。

40
00:02:34,690 --> 00:02:37,810
And that's where we kick off this whole thing.
这就是我们开始整件事的地方。

41
00:02:38,250 --> 00:02:42,130
So all that remains now is for me to actually kick this off.
所以现在剩下的就是我真正开始这件事了。

42
00:02:42,290 --> 00:02:43,210
Let's do it.
我们开始做吧。

43
00:02:43,210 --> 00:02:46,210
And so the time has come now to launch our trading floor.
现在是时候启动我们的交易大厅了。

44
00:02:46,250 --> 00:02:51,970
See these agents in action and see in particular this while true loop running.
查看这些代理的运行情况，特别是在真正的循环运行时查看这一点。

45
00:02:52,250 --> 00:02:54,890
So I'm going to bring up a terminal.
所以我要打开一个终端。

46
00:02:54,890 --> 00:02:56,520
This is our running user interface.
这是我们正在运行的用户界面。

47
00:02:56,520 --> 00:02:59,240
I'm going to open a new terminal window to run.
我将打开一个新的终端窗口来运行。

48
00:02:59,240 --> 00:03:05,320
At the same time, I'm going to change to the sixth directory and I'm going to do you've run Trading
同时，我要切换到第六个目录，我要做你已经运行的Trading

49
00:03:05,360 --> 00:03:07,240
Floor dot Pi.
地板点 Pi。

50
00:03:07,280 --> 00:03:14,800
And this is now kicking off our agent process and running our various agents.
现在正在启动我们的代理流程并运行我们的各种代理。

51
00:03:14,800 --> 00:03:18,000
So it's running for different traders and their researchers.
所以它是为不同的交易者和他们的研究人员运行的。

52
00:03:18,000 --> 00:03:25,680
And right away you can see I hope that the information in these panels has started flying by.
您马上就会看到，我希望这些面板中的信息已经开始飞速流逝。

53
00:03:25,880 --> 00:03:31,960
And this of course is our user interface tracking the traces that we have intercepted and written ourselves
这当然是我们的用户界面，跟踪我们自己截获并编写的痕迹

54
00:03:31,960 --> 00:03:34,040
so that we can be managing the logs.
以便我们可以管理日志。

55
00:03:34,040 --> 00:03:38,600
It's being stored to a database and and showing here visibly on the user interface.
它被存储到数据库中并在用户界面上可见地显示。

56
00:03:38,600 --> 00:03:43,200
And it is terrific fun to watch this and see autonomy in action.
观看这一过程并看到自治的实际应用是非常有趣的。

57
00:03:43,240 --> 00:03:47,400
You'll see the different colors representing things like calling different MCP servers actually using
您将看到不同的颜色代表实际使用的调用不同 MCP 服务器之类的内容

58
00:03:47,440 --> 00:03:48,240
tools.
工具。

59
00:03:48,240 --> 00:03:54,580
The red when you see it is when it's actually calling our accounts business logic, our own home grown
当你看到它时的红色是当它实际上调用我们的帐户业务逻辑时，我们自己开发的

60
00:03:54,580 --> 00:04:00,380
MCP server and that noise, if I don't know if it comes through on this mic, but it just made a notification
MCP 服务器和噪音，如果我不知道它是否通过此麦克风发出，但它只是发出了通知

61
00:04:00,380 --> 00:04:06,380
noise that one of our four traders of Warren or George or Ray or Cathy just made a trading decision
我们四位交易员沃伦、乔治、雷或凯茜中的一位刚刚做出了交易决定的噪音

62
00:04:06,380 --> 00:04:11,780
and I got alerted about it, and they will now be off and running.
我收到了有关此事的警报，他们现在将开始运行。

63
00:04:11,820 --> 00:04:13,540
It typically takes them a few minutes.
他们通常需要几分钟的时间。

64
00:04:13,900 --> 00:04:20,180
Uh, thanks to the joys of async coding, they can run in parallel like this as they do their thinking.
呃，多亏了异步编码的乐趣，他们可以在思考时像这样并行运行。

65
00:04:20,420 --> 00:04:25,780
They will go through managing their portfolio, and down below you can see things like their current
他们将管理他们的投资组合，在下面你可以看到他们当前的信息

66
00:04:25,780 --> 00:04:27,740
holdings and their recent transactions.
持股及其最近的交易。

67
00:04:27,740 --> 00:04:30,180
So you can keep keep stock on what they're doing.
这样您就可以随时了解他们正在做什么。

68
00:04:30,340 --> 00:04:34,220
Uh, and uh, yeah, as I say, it's uh, it's it's terrific.
呃，呃，是的，正如我所说，呃，这太棒了。

69
00:04:34,260 --> 00:04:35,820
Terrific fun to see this.
看到这个真是太有趣了。

70
00:04:35,820 --> 00:04:36,220
Here we go.
开始了。

71
00:04:36,220 --> 00:04:36,980
We can just see here.
我们只能在这里看看。

72
00:04:37,020 --> 00:04:43,980
Sold five AMD shares, retrieving account details and then sold three Qualcomm and bought four Nvidia
出售 5 股 AMD 股票，检索帐户详细信息，然后出售 3 股高通股票并购买 4 股 Nvidia 股票

73
00:04:44,020 --> 00:04:45,540
shares as Warren.
股票为沃伦.

74
00:04:45,820 --> 00:04:47,420
Uh, they do tend to love Nvidia.
呃，他们确实喜欢英伟达。

75
00:04:47,620 --> 00:04:53,930
Uh, so um, which must be something to do with the researcher and some other share activity going on,
呃，嗯，这一定与研究人员和正在进行的其他分享活动有关，

76
00:04:54,130 --> 00:04:57,930
and an update there to our to the values of the portfolios.
以及我们对投资组合价值的更新。

77
00:04:57,970 --> 00:05:03,770
Oh, and another text message I just got, which is and another one which is trading going on AMD trade
哦，还有我刚刚收到的另一条短信，这是另一条正在 AMD trade 上进行交易的短信

78
00:05:03,770 --> 00:05:04,530
apparently.
显然。

79
00:05:04,690 --> 00:05:08,770
Uh, and yeah, as I say, this is super addictive.
呃，是的，正如我所说，这非常容易上瘾。

80
00:05:09,050 --> 00:05:10,890
I absolutely love watching this.
我非常喜欢看这个。

81
00:05:11,170 --> 00:05:18,250
Obviously the learning point here is to really get this very visual, very real, tangible sense of
显然，这里的学习点是真正获得这种非常直观、非常真实、有形的感觉。

82
00:05:18,250 --> 00:05:26,090
what it's like to have multiple agents working, uh, calling other agents and using a bunch of different
让多个代理工作是什么感觉，呃，呼叫其他代理并使用一堆不同的

83
00:05:26,090 --> 00:05:29,050
MCP servers to achieve a commercial objective.
MCP服务器实现了商业目标。

84
00:05:29,250 --> 00:05:35,410
Uh, and being able to use this as a way of inspecting what's going on and understanding the LM activity
呃，能够用它来检查正在发生的事情并了解 LM 活动

85
00:05:35,410 --> 00:05:40,410
that's happening behind the scenes to allow for this trading activity.
这是在幕后发生的，以允许这种交易活动。

86
00:05:40,570 --> 00:05:46,610
So hopefully when you run this yourself and get this sense, uh, you'll find it, uh, highly, highly
所以希望当你自己运行这个并得到这种感觉时，呃，你会发现它，呃，高度，高度

87
00:05:46,610 --> 00:05:50,690
educational and insightful as well as being quite a lot of fun.
具有教育意义和洞察力，而且非常有趣。
