Python library for MarketWatch virtual trading

I wanted to automate chores in MarketWatch’s virtual stock game (paper trading, not a real broker). marketwatch on PyPI is the small client I shipped — watchlists, game state, portfolio, orders, leaderboard. Version française.

Why build this

Course and side projects already used BatchBacktesting on historical data — see experimentation with indicators. MarketWatch’s game is a different beast: session cookies, game rules, and leaderboards that change with the semester. A thin Python wrapper beat curl scripts in a notebook.

I also wanted a documented surface for teammates: “here is how you list games” beats sharing a gist that rots when the HTML form changes. The package is intentionally small — no ORM, no strategy engine — just HTTP shaped like the site.

Design choices

ChoiceReason
Class-based clientOne login, many calls in a script
Explicit methods per endpointEasier to grep when MarketWatch changes a path
Docs on GitHub PagesPyPI description alone is too short for auth edge cases
No bundled strategiesKeeps the library neutral; strategies belong in your repo

What it can do

AreaMethods (see docs for signatures)
WatchlistsCreate, list, update symbols
GamesList games, read settings
PortfolioPositions, pending orders
TradingBuy / sell inside game rules
SocialLeaderboard for a game

Useful for small bots and screening inside the game — not HFT, not brokerage.

Quick start

pip install marketwatch
from marketwatch import MarketWatch

mw = MarketWatch("your_username", "your_password")
mw.get_games()
mw.get_price("AAPL")

Login edge cases (2FA absent, session expiry) are documented on the site — read before cron-scheduling anything.

MarketWatch Python client — package branding

Limits and responsibility

  • Unofficial API — HTML/JSON endpoints can change; pin versions and expect breakage.
  • Terms of use — automation may conflict with MarketWatch rules; use for learning, not abuse.
  • Not financial advice — paper gains do not validate a strategy; pair with honest backtests on separate data.

For research-style batch runs on many tickers, see multiple indicators backtesting and Monte Carlo risk bands.

Questions or bugs: GitHub issues.