Marketwatch
Python library to interface with the Market Watch virtual stock market game https://marketwatchapi.vercel.app
Install / Use
/learn @antoinebou12/MarketwatchREADME
Marketwatch API Python Library
Broken login by captcha
A Python libary to interact with the MarketWatch Stock Market Game Based on code from
- https://github.com/kevindong/MarketWatch_API/
- https://github.com/bwees/pymarketwatch
Feature
- [X] Logging in and out of the site
- [X] Getting the current price of a stock
- [X] Getting information about games on the site
- [X] Buying, selling, shorting, and covering stocks in a game
- [X] Creating, adding to, getting, and deleting watchlists
- [X] Getting, adding to, and deleting items from a portfolio
- [X] Getting and cancelling pending orders
- [X] Checking if the game is down
Installation
pip install marketwatch
pip install git+https://github.com/antoinebou12/marketwatch.git
git clone https://github.com/antoinebou12/marketwatch.git
Usage
Here are some examples of how you can use the MarketWatch class:
Import
First, import the MarketWatch class from the script:
from marketwatch import MarketWatch
Login
Then, create an instance of the MarketWatch class using your MarketWatch username and password:
marketwatch = MarketWatch(email='emai', password='password', proxy="", skip_login=True)
Get Stock Price
To get the current price of a stock:
marketwatch.get_price("AAPL") # working
Interact with Games
https://www.marketwatch.com/games
To get information about games on the site:
marketwatch.get_games() # not working
Get Game
marketwatch.get_game("game-name") # not working captcha
Get Game Settings
marketwatch.get_game_settings("game-name") # not working captcha
Get Leaderboard
marketwatch.get_leaderboard("game-name") # not working captcha
Get Portfolio
marketwatch.get_portfolio("game-name") # not working captcha
Get Positions
marketwatch.get_positions("game-name") # not working captcha
Get Pending Orders
marketwatch.get_pending_orders("game-name") # not working captcha
Buy Stock
marketwatch.buy(game_id, "AAPL", 100) # not working captcha
Sell Stock
marketwatch.sell("game-name", "AAPL", 100) # not working captcha
Create Watchlist
https://www.marketwatch.com/watchlist
To create a watchlist:
marketwatch.create_watchlist('My Watchlist') # not working captcha
Add Stock to Watchlist
To add stocks to a watchlist:
marketwatch.add_to_watchlist(watchlist_id, ['AAPL', 'GOOG']) # not working captcha
Get All Watchlists
To get all watchlists:
watchlists = marketwatch.get_watchlists() # not working captcha
Delete Watchlist
To delete a watchlist:
marketwatch.delete_watchlist(watchlist_id) # not working captcha
Example
import os
username = os.environ.get("MARKETWATCH_USERNAME")
password = os.environ.get("MARKETWATCH_PASSWORD")
marketwatch = MarketWatch(username, password)
print(f"Price: {marketwatch.get_price('AAPL')} \n")
print(f"Games: {marketwatch.get_games()} \n")
games1 = marketwatch.get_games()[0]["name"].lower().replace(" ", "-")
print(f"Game: {marketwatch.get_game(games1)} \n")
print(f"Game Settings: {marketwatch.get_game_settings(games1)} \n")
print(f"Leaderboard: {marketwatch.get_leaderboard(games1)} \n")
print(f"Porfolio: {marketwatch.get_portfolio(games1)} \n")
print(f"Position: {marketwatch.get_positions(games1)}")
print(f"Orders Pending: {marketwatch.get_pending_orders(games1)}")
marketwatch.buy(games1, "AAPL", 100)
print(f"Position diff: {marketwatch.get_positions(games1)}")
Contributing
Contributions are welcome. Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
84.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
342.0kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
