marketwatch: A client around a virtual trading game
marketwatch is an archived Python client for MarketWatch’s virtual trading game. It wraps login, game queries and simulated order operations. These are game interactions, not connections to a brokerage account.
Repository languagesPython 77.68%4
Shares calculated from GitHub Linguist bytes.
| Language | % | Bytes |
|---|---|---|
| Python | 103,813 | |
| Jupyter Notebook | 17,674 | |
| Jinja | 10,228 | |
| Dockerfile | 1,934 |
Overview
Why it exists
Robust Python client library scraping and wrapping the MarketWatch virtual stock market game API.
Best fit
Automated trading bot development and portfolio backtesting.
Getting started
These commands come from the repository documentation. They were not run during this review.
pip install marketwatchpip install git+https://github.com/antoinebou12/marketwatch.gitgit clone https://github.com/antoinebou12/marketwatch.gitRepository references
Excerpts from the repository’s guides, in their original language. Links open the inspected source revision.
Configuration and usage
Usage
README.md
Usage
docs/getting-started.md
Development and contributions
Contributing
README.md
Contributing
CONTRIBUTING.md
Source documentation
3 documents read from 3 candidates.
Features and components 2
- Session and game scope
- MarketWatchGame subclasses MarketWatch and stores a game identifier. Methods such as buy and sell delegate to the base client with that identifier. Ledger and portfolio operations are scoped by the game.
- Remote dependency
- The client depends on the website’s authentication and response structure. A Python method still existing does not mean its remote counterpart remains accessible. Authentication failure can block otherwise unchanged game methods.
Architecture
The components and their connections remain available as text. The diagram adds an interactive view.
- Python caller
- MarketWatchGame wrapper
- Base HTTP client
- Virtual game service
Links verified in the repository.
Mermaid Interactive diagram (loads on open)
System overview of the components and connections verified in the repository.

flowchart LR
n0["Python caller"]
n1["MarketWatchGame wrapper"]
n2["Base HTTP client"]
n3["Virtual game service"]
n0 --> n1
n1 --> n2
n2 --> n3
n3 --> n2
Text version of the diagram
- Python caller → MarketWatchGame wrapper
- MarketWatchGame wrapper → Base HTTP client
- Base HTTP client → Virtual game service
- Virtual game service → Base HTTP client
Follow one path through the code
Follow buy from the game wrapper into the base client. The wrapper adds the game ID; session handling and the actual HTTP request happen below it.
Types and file structure
13 declared types, with 12 in the base-relationship overview.
Type diagram
classDiagram
direction TB
class t342c57589891["MarketWatch"] {
__init__()
create_session()
generate_csrf_token()
get_client_id()
}
class te2660179edef["MarketWatchGame"] {
__init__()
create_game()
buy()
sell()
}
class tc6adc7beb6df["MarketWatchException"] {
__init__()
}
class tc9e9c1f2c012["MarketWatchGameException"] {
__init__()
}
class td4c12f6259f0["Term"] {
}
class tb06037cc6ec7["PriceType"] {
}
class t3d7a45c40645["OrderType"] {
}
class t7d8a40bf3f38["GameSettings"] {
__init__()
__str__()
}
class tc2b2eb26d380["Order"] {
__init__()
__str__()
__repr__()
}
class t45b8a20e40d7["Position"] {
__init__()
__str__()
__repr__()
}
class t0783a857f7ca["Player"] {
__init__()
__str__()
__repr__()
}
class t6ddf82fcb3c7["Game"] {
__init__()
__str__()
__repr__()
}
class b4a739b8cc727["MarketWatch"] {
<<unresolved_base>>
}
b4a739b8cc727 <|-- te2660179edef
class b218d46208022["Exception"] {
<<unresolved_base>>
}
b218d46208022 <|-- tc6adc7beb6df
b218d46208022 <|-- tc9e9c1f2c012
class bcdccbbebe0a2["Enum"] {
<<unresolved_base>>
}
bcdccbbebe0a2 <|-- td4c12f6259f0
bcdccbbebe0a2 <|-- tb06037cc6ec7
bcdccbbebe0a2 <|-- t3d7a45c40645
Unresolved bases remain labelled; full signatures are not reconstructed.
Type index
MarketWatch(class) ·marketwatch/__init__.py:37Methods in the overview:
__init__, create_session, generate_csrf_token, get_client_id.MarketWatchGame(class) ·marketwatch/game.py:23Methods in the overview:
__init__, create_game, buy, sell.Declared bases:
MarketWatch.MarketWatchException(class) ·marketwatch/exceptions.py:11Methods in the overview:
__init__.Declared bases:
Exception.MarketWatchGameException(class) ·marketwatch/exceptions.py:23Methods in the overview:
__init__.Declared bases:
Exception.Term(class) ·marketwatch/schemas.py:11Declared bases:
Enum.PriceType(class) ·marketwatch/schemas.py:22Declared bases:
Enum.OrderType(class) ·marketwatch/schemas.py:34Declared bases:
Enum.GameSettings(class) ·marketwatch/schemas.py:47Methods in the overview:
__init__, __str__.Order(class) ·marketwatch/schemas.py:68Methods in the overview:
__init__, __str__, __repr__.Position(class) ·marketwatch/schemas.py:99Methods in the overview:
__init__, __str__, __repr__.Player(class) ·marketwatch/schemas.py:125Methods in the overview:
__init__, __str__, __repr__.Game(class) ·marketwatch/schemas.py:143Methods in the overview:
__init__, __str__, __repr__.
Reference
20 / 20 eligible files read (65 in the tree); 0 oversized, 0 failed reads and 0 syntax diagnostics.
What the scan covers
Known dependency/build folders, credential files and binaries are excluded. The scan covers READMEs, recognized manifests and parser-supported source files.
Linguist statistics cover the whole repository and may include other languages.
File map
flowchart TD
root["marketwatch"]
f0["README.md"]
root --> f0
f1["marketwatch/__init__.py"]
root --> f1
f2["marketwatch/game.py"]
root --> f2
f3["pyproject.toml"]
root --> f3
f4["requirements.txt"]
root --> f4
f5["setup.py"]
root --> f5
f6["api/__init__.py"]
root --> f6
f7["api/app.py"]
root --> f7
f8["api/docker-compose.yml"]
root --> f8
f9["api/requirements.txt"]
root --> f9
f10["marketwatch/exceptions.py"]
root --> f10
f11["marketwatch/schemas.py"]
root --> f11
f12["marketwatch/watchlist.py"]
root --> f12
f13["test/__init__.py"]
root --> f13
f14["test/test_exceptions.py"]
root --> f14
f15["test/test_game.py"]
root --> f15
Files to read 3
References
- GitHubSource repository
- READMERepository documentation
- Python library for MarketWatch virtual tradingBlog article