LessonThis is a lesson restated in new words. Any figure in it is an example from the source, not this desk's record.

The lecture builds a Python screen that asks a language model what to do with a US stock, then is designed to send that decision to Interactive Brokers. The model does not "know" the trade. It returns text. A function-calling setup turns pieces of that text into arguments for a real order. The talk is explicit that the same inputs will not produce the same outputs next time, and that using it is educational. It is not advice, and it is not a tested edge.

Why it matters

A chat reply that says "buy" is still a sentence. The brokerage needs a side, a size, and a price. The lecture's point is the bridge: tell the model a function exists, require it to fill the arguments, and run the function in your process. A toy version asks what 2 plus 2 is. Without a tool, the model predicts the tokens for 4. With an add function it must call, the script actually adds. That is the mechanism later pointed at an order.

The model has no sense of risk. The examples are a customer list sent to everyone, or a 300 Nvidia target using all the leverage. Either outcome, a gain or a blown account, leaves the warning in place.

The idea in plain words

Trader Workstation is the execution venue. One class sends requests and receives callbacks. The paper session uses port 7497, with socket clients on and read-only off so orders can be sent. A separate smoke test checks the model API. The lecture hard-coded a key for the demonstration, said that is not how production should store it, and said the key would be revoked. Do not copy that shortcut.

The screen has a connect menu, a red or green status bar, a box to add a ticker, a table of positions, the thesis, the target, and a log. Buttons are create thesis, re-evaluate, and re-evaluate all. Rows with zero size are hidden, except a ticker you add by hand so a new name can get a thesis before you own it. JPM is the example they typed.

Create thesis is four stages. Pull news for the symbol from the broker, not from a scraped headline site. The first draft of the script went to Yahoo. They rejected that. Send the headlines and the spot to the model. Ask for a thesis, a price target, a side, and a rationale, as arguments of a function rather than a paragraph you then parse. Save the reply as JSON with a timestamp. The design then sends a market order, illustrated as 100 shares. Re-evaluate passes the old JSON back in, so the model is supposed to stick, cut, or add, instead of inventing a fresh view with no memory. There is no clean backtest of that loop. The lecture compares one decision to a poker hand.

One run did return a thesis. The target in that reply was 250, with language about resilience and momentum. The order path then failed on an identifier error. The closing minute of the talk describes the intended pipeline, including an order, as what the system is. It does not show a filled Nvidia trade from the repaired run. Nvidia "not found" earlier was a zero-quantity row being hidden.

How to use it

Keep secrets out of the script, take news from the broker, and check the function's arguments before any order is sent. A 100-share market order was an illustration, not a sizing rule. Pass the prior thesis back in on a re-evaluation, or the new headline is the only memory. The lecture's guess that a few blind users do well and many blow up is a conjecture, not a result from this build.

What usually goes wrong

Without the tool call, "buy" is a sentence, the same kind of object as a predicted 2 plus 2. The first script fetched headlines from the open web until forced onto the broker feed. A target of 250 showed up with no check against the account. The 300-and-full-leverage story is the failure mode to picture before orders are enabled.

Questions people ask

Did the bot buy Nvidia?

Not in the run that is actually narrated as a result. It produced a thesis with a target of 250, then hit an order-routing error. The design's last stage is a market order, sketched as 100 shares.

Why involve a function at all?

Because the model returns text. An add function with two numeric arguments is what made 2 plus 2 an operation in the demo. An order function is the same idea with side, size, and price.

Can you backtest the theses?

The lecture says no, not in any clean way. Each reply can differ, and judging one hand with a historical test is the wrong tool. Treat it as a decision filter with unstable outputs.