Setting up a Python Development Workstation (Windows)

101
en
setup
bash
python
windows
matplotlib
In this article we set up our Windows workstation and install all the relevant tools to be efficient in coding in Python.
Auteur

Vincent D.

Date de publication

22 février 2024

In Construction

Thanks for popping by; please note that this article is still in construction.

Introduction

Welcome, fellow data enthusiasts and future quants! Today, we embark on an exciting journey to set up a coding environment that bridges the gap between mathematical theory and the practical world of finance. Whether you’re a student stepping into the field or a practitioner eager to enhance your skills, this guide is your first step towards mastering quantitative finance with Python. Let’s demystify the process and make it enjoyable together.

1 General Setup

1.1 Setting Up Chocolatey

Open an administrator PowerShell and execute:

Set-ExecutionPolicy Bypass -Scope Process -Force; 
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; 
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

1.2 Setting Up Powershell, Visual Studio Code, and Miniconda

Why this trio? Powershell for a superior shell experience, Visual Studio Code (VS Code) for its versatility as a code editor, and Miniconda for managing our Python environments efficiently.

# Install Zsh, VS Code, and Miniconda

choco install vscode miniconda3 -y

To setup the conda integration for Powershell, once a powershell windows is opened, you can type conda init, this will enable an easier monitoring of the virtual environment.

2. Visual Studio Code Setup: Installing Key Visual Studio Extensions

VS Code shines with its extensions. Here are a few that will make your life easier:

  • Python: Gives you a host of Python-specific features like linting, debugging, code formatting, and more.

  • Prettier: A code formatter that supports many languages, including Python. Keeps your code clean and professional.

  • Code Spell Checker: Like a proof-reader, it catches common spelling mistakes in your code.

You can install these extensions by searching for them in the VS Code Extensions view (Ctrl + Shift + X) and clicking on “Install”.

3: Create a Conda Virtual Environment

Why a virtual environment? It allows us to create isolated spaces for our projects, ensuring that our dependencies are managed neatly, without conflicts.

# Create the virtual environment
conda create --name portfolio-geek python=3.12 jupyterlab -y

# Activate the environment
conda activate portfolio-geek

pip install matplotlib

Step 4: Building a Simple Matplotlib Chart in Visual Studio

We need to start somewhere! Let’s create a Notebook file (extension .ipynb) within Visual Studio and let’s type the following code.

Code
# Ensure you're in the 'portfolio-geek' environment

import matplotlib.pyplot as plt
import numpy as np

# Sample data
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Plotting
plt.plot(x, y)
plt.title("Simple Sine Wave Plot")
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.show()

Et Voila! The first chart in our journey to Python coding.

Recap and Conclusion

Congratulations! You’ve set up a robust coding environment for your journey into quantitative finance and data analysis. Today, we’ve installed essential tools with Chocolatey, created an isolated workspace with Conda, and dipped our toes into the world of data visualization with Matplotlib.

Why is this important? This setup not only equips you with the technical skills needed in the field but also instills confidence to explore complex financial models and datasets.

As we progress, remember that the journey is as rewarding as the destination. Keep experimenting, and don’t hesitate to dive deeper into each tool and library we discussed.

Further Reading and Resources

This structure offers a blend of instructional content and hands-on coding, making it accessible for beginners while providing enough depth for more experienced learners. The tone is kept light and encouraging, aiming to demystify the complexities of setting up a quantitative finance coding environment.