How to Add Codex to Visual Studio Code

Codex running beside code in Visual Studio Code

You now have a working Python lab. Visual Studio Code can edit Python files, Python can run them, and your first market-analysis packages are installed.

Now we will add one more tool: Codex.

Codex is different from the Python packages you installed in the previous article. It is an AI coding agent that can work beside you inside Visual Studio Code.

What you will finish: the Codex sidebar will open inside VS Code and you will be signed in with your ChatGPT account.

1. What Is Codex?

Codex is OpenAI's coding agent. It can help explain code, review changes, debug problems, edit files, and handle larger coding tasks.

In Visual Studio Code, Codex can use context from files you already have open or code you have selected. That means you often do not need to copy an entire file into a separate chat window just to ask a question about it.

But Codex is not Python itself, and it is not a Python package.

Visual Studio Code
= the editor where you work

Python
= the program that runs Python code

Python extension
= helps VS Code understand Python

Codex extension
= adds an AI coding agent beside your code

2. Why Are We Adding Codex Now?

You have already run Python code yourself before adding AI. That order is intentional.

In Alphesta, AI should help you understand and test ideas. It should not replace the basic skill of reading code, changing a value, running it, and checking the result.

For the next few lessons, our preferred use of Codex is:

Your code
   ↓
You read it first
   ↓
Codex explains or reviews it
   ↓
You decide what to change
   ↓
You run the code
   ↓
You check the result

Later, Codex can do much more. For now, we will keep its role deliberately small.

3. What Can Codex Do in VS Code?

The Codex IDE extension can work with the context already open in your editor. It can help you:

  • explain unfamiliar code,
  • answer questions about an open file,
  • review a proposed change,
  • help debug an error,
  • edit files when you explicitly ask it to, and
  • delegate larger tasks when needed.

The important distinction is that some Codex actions can change files. A beginner should not treat every AI-generated change as automatically correct.

In this article, we will not ask Codex to edit anything.

4. Open Extensions in Visual Studio Code

Open your alphesta-lab folder in Visual Studio Code.

Select the Extensions icon on the left side, or press:

Ctrl + Shift + X

In the search box, type:

Codex

5. Install the Official Codex Extension

Look for:

Codex – OpenAI's coding agent

Check that it is the official OpenAI extension, then select Install.

This is a Visual Studio Code extension. You do not install it with pip.

Python package
→ installed with pip

VS Code extension
→ installed from the VS Code Extensions view

6. Open the Codex Sidebar

After installation, look for the Codex icon in Visual Studio Code and open it.

If you do not see the icon, press:

Ctrl + Shift + P

Then search for:

Codex: Open Codex Sidebar

Select the command.

7. Sign In with Your ChatGPT Account

Follow the sign-in instructions shown by Codex and sign in with your ChatGPT account. OpenAI's current Codex documentation uses the ChatGPT account to connect the Codex experience across supported clients.

Usage limits can depend on your ChatGPT plan and current OpenAI product policy. If the sign-in screen or plan information looks different from this article, follow the current instructions shown by OpenAI.

8. Stop Before Asking It to Edit

Once the Codex sidebar is open and you are signed in, stop here.

Do not ask Codex to rewrite hello_alphesta.py or check_packages.py yet.

The purpose of this article is only to connect the AI tool to your coding environment.

Check Your Result

You have completed this article if:

  • The official Codex extension is installed in VS Code.
  • The Codex sidebar opens.
  • You are signed in with your ChatGPT account.
  • Your alphesta-lab files are still unchanged.

What You Just Added

alphesta-lab
   ↓
Visual Studio Code
   ├── Python extension
   ├── Python interpreter
   └── Codex extension
          ↓
       AI assistant beside your code

You now have an AI coding tool available inside the same environment where you write and run Python. That does not mean you need to start using it heavily right away.

9. Your Environment Is Ready — Now Build Your Own Skill

This is the real goal of this article.

Your Alphesta lab is now ready:

VS Code
+ Python
+ Python extension
+ market-analysis packages
+ Codex

From this point, you can continue learning Python and technical analysis without stopping later to rebuild your environment.

Codex is already there when you eventually need it. For now, however, the more important skill is learning to read a short function, understand what each line does, change a parameter yourself, run the code, and explain the result in your own words.

First:
Understand
→ Write
→ Run
→ Change
→ Observe
→ Explain

Later:
Use Codex to work faster

10. What Can Codex Help You Do Later?

Once you can understand the basic structure of your own code, Codex becomes much more useful.

OpenAI describes Codex as an AI coding agent that can help write, review, and ship code. In an IDE, it can also use context from files you have open or code you have selected.

In future Alphesta work, Codex can help with tasks such as:

  • Explain code — help you understand an unfamiliar function or error message.
  • Review code — check whether your implementation matches the rule you intended.
  • Debug — help trace why a script fails or produces an unexpected result.
  • Refactor — reorganize working code into clearer functions after you understand what it does.
  • Build repetitive code — reduce manual work when several similar experiments are needed.
  • Scale experiments — help automate parameter sweeps, repeated backtests, logging, and analysis.
  • Review larger changes — inspect proposed edits before you accept them.

The important word is later.

If AI writes a large block of code before you can judge whether it is correct, you may get a working-looking result without understanding why it works, when it fails, or whether the trading rule was implemented correctly.

11. A Simple Rule for Using Codex Later

When you eventually begin using Codex more actively, keep this sequence:

1. State the rule yourself.
2. Understand the small building blocks.
3. Ask Codex to help.
4. Review the proposed code.
5. Run it yourself.
6. Check the result.
7. Decide whether to keep the change.

Codex can make experiments faster. It should not decide what you understand.

Where Do We Go Next?

Phase 0 is now essentially complete. You have a working environment that can grow with you.

The next step is not more AI. The next step is to start working with real market data: retrieve a small dataset, inspect its columns, and learn what the numbers actually mean.

Codex can wait in the sidebar until your own skills catch up with the tool.


Official References

Image source: OpenAI Codex IDE documentation. The featured image is a crop of the official IDE screenshot for editorial instruction.


← Previous: How to Install Python Packages for Market Analysis

↑ Back to Start Here

Phase 0 complete. Your Python research environment is ready. Next, begin working with real market data.