liveBook · Manning

Python

As explained in Investing for Programmers

Python is a general-purpose programming language with a large ecosystem for data analysis and scientific computing.

Python serves as the implementation layer for AI-augmented financial research: it sends prompts to public LLM APIs, stores returned answers in variables, and supports further processing. The same workflow can run through Jupyter Notebooks or use locally downloaded open-source models. section 8.3.2

Practical Python workflows include:

  • Calling OpenAI, Gemini, Anthropic, or Mistral models through provider-specific Python clients. section 8.3.2
  • Controlling model behavior with system prompts, temperature, maximum output tokens, and model selection. section 8.3.2
  • Loading Hugging Face models and tokenizers for local prompt execution. section 8.3.2
  • Extending prompt workflows toward structured repositories, Notion exports, n8n, and Python-coded LangChain agents. section 9.0
Listing 8.8 Submit a prompt via the OpenAI API
from openai import OpenAI

client = OpenAI(
  api_key=api_key
)

completion = client.chat.completions.create(
  model="gpt-4o",
  messages=[
    {"role": "system", "content": system_content},
    {"role": "user", "content": question}
  ]
)

A compact OpenAI example shows how Python creates a client, submits system and user messages, selects a model, and retrieves a completion. section 8.3.2

How Investing for Programmers covers it

How deep it goes
Demonstrates provider calls, prompt parameters, model selection, and local execution without detailing Python language fundamentals.
Examples
Uses OpenAI, Gemini, Anthropic, Mistral, and Hugging Face prompt-submission examples.
What you can do after
Build Python scripts that submit prompts, configure generation, process responses, or invoke locally downloaded models.
How it connects
Connects Python with LLMs, APIs, Jupyter Notebooks, Hugging Face Transformers, n8n, and LangChain.

Also explained in

Compare how 26 books explain Python →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.