marketwatch


Namemarketwatch JSON
Version 0.2.4.2 PyPI version JSON
download
home_pagehttp://github.com/antoineboucher/marketwatch
SummaryMarketWatch's API
upload_time2024-08-20 21:51:28
maintainerNone
docs_urlNone
authorAntoine Boucher
requires_python<4.0,>=3.8
licenseApache-2.0
keywords marketwatch api stock finance market game
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Marketwatch API Python Library

# Broken login by captcha

![PyPI](https://img.shields.io/pypi/v/marketwatch)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/marketwatch)
![PyPI - License](https://img.shields.io/pypi/l/marketwatch)
![PyPI - Downloads](https://img.shields.io/pypi/dm/marketwatch)
![GitHub last commit](https://img.shields.io/github/last-commit/antoinebou12/marketwatch)
[![Python Test and Build](https://github.com/antoinebou12/marketwatch/actions/workflows/python-test.yml/badge.svg)](https://github.com/antoinebou12/marketwatch/actions/workflows/python-test.yml)
![Coverage](https://raw.githubusercontent.com/antoinebou12/marketwatch/main/.github/badge/coverage.svg)

[MarketWatch](https://www.marketwatch.com)

[Documentation](https://antoinebou12.github.io/marketwatch/)

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

```shell
pip install marketwatch
```

```shell
pip install git+https://github.com/antoinebou12/marketwatch.git
```

```shell
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:
```python
from marketwatch import MarketWatch
```

### Login
Then, create an instance of the MarketWatch class using your MarketWatch username and password:
```python
marketwatch = MarketWatch(username, password)
```

### Get Stock Price
To get the current price of a stock:
```python
marketwatch.get_price("AAPL")
```

### Interact with Games
https://www.marketwatch.com/games

To get information about games on the site:
```python
marketwatch.get_games()
```

### Get Game
```python
marketwatch.get_game("game-name")
```

### Get Game Settings
```python
marketwatch.get_game_settings("game-name")
```

### Get Leaderboard
```python
marketwatch.get_leaderboard("game-name")
```

### Get Portfolio
```python
marketwatch.get_portfolio("game-name")
```

### Get Positions
```python
marketwatch.get_positions("game-name")
```

### Get Pending Orders 
```python
marketwatch.get_pending_orders("game-name")
```

### Buy Stock
```python
marketwatch.buy(game_id, "AAPL", 100)
```

### Sell Stock
```python
marketwatch.sell("game-name", "AAPL", 100)
```

### Create Watchlist
https://www.marketwatch.com/watchlist

To create a watchlist:
```python
marketwatch.create_watchlist('My Watchlist')
```

### Add Stock to Watchlist
To add stocks to a watchlist:
```python
marketwatch.add_to_watchlist(watchlist_id, ['AAPL', 'GOOG'])
```

### Get All Watchlists
To get all watchlists:
```python
watchlists = marketwatch.get_watchlists()
```

### Delete Watchlist
To delete a watchlist:
```python
marketwatch.delete_watchlist(watchlist_id)
```

### Example

```python
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.


            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/antoineboucher/marketwatch",
    "name": "marketwatch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "marketwatch, api, stock, finance, market, game",
    "author": "Antoine Boucher",
    "author_email": "antoine.boucher012@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/68/73/af1a3cb029614f79dafa8ab1de6511cf7afa6bdc42376f33aa9a74d1c354/marketwatch-0.2.4.2.tar.gz",
    "platform": null,
    "description": "# Marketwatch API Python Library\n\n# Broken login by captcha\n\n![PyPI](https://img.shields.io/pypi/v/marketwatch)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/marketwatch)\n![PyPI - License](https://img.shields.io/pypi/l/marketwatch)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/marketwatch)\n![GitHub last commit](https://img.shields.io/github/last-commit/antoinebou12/marketwatch)\n[![Python Test and Build](https://github.com/antoinebou12/marketwatch/actions/workflows/python-test.yml/badge.svg)](https://github.com/antoinebou12/marketwatch/actions/workflows/python-test.yml)\n![Coverage](https://raw.githubusercontent.com/antoinebou12/marketwatch/main/.github/badge/coverage.svg)\n\n[MarketWatch](https://www.marketwatch.com)\n\n[Documentation](https://antoinebou12.github.io/marketwatch/)\n\nA Python libary to interact with the MarketWatch Stock Market Game\nBased on code from\n\n- https://github.com/kevindong/MarketWatch_API/\n- https://github.com/bwees/pymarketwatch\n\n## Feature\n- [X]  Logging in and out of the site\n- [X]  Getting the current price of a stock\n- [X]  Getting information about games on the site\n- [X]  Buying, selling, shorting, and covering stocks in a game\n- [X]  Creating, adding to, getting, and deleting watchlists\n- [X]  Getting, adding to, and deleting items from a portfolio\n- [X]  Getting and cancelling pending orders\n- [X]  Checking if the game is down\n\n## Installation\n\n```shell\npip install marketwatch\n```\n\n```shell\npip install git+https://github.com/antoinebou12/marketwatch.git\n```\n\n```shell\ngit clone https://github.com/antoinebou12/marketwatch.git\n```\n\n## Usage\nHere are some examples of how you can use the MarketWatch class:\n\n### Import\nFirst, import the MarketWatch class from the script:\n```python\nfrom marketwatch import MarketWatch\n```\n\n### Login\nThen, create an instance of the MarketWatch class using your MarketWatch username and password:\n```python\nmarketwatch = MarketWatch(username, password)\n```\n\n### Get Stock Price\nTo get the current price of a stock:\n```python\nmarketwatch.get_price(\"AAPL\")\n```\n\n### Interact with Games\nhttps://www.marketwatch.com/games\n\nTo get information about games on the site:\n```python\nmarketwatch.get_games()\n```\n\n### Get Game\n```python\nmarketwatch.get_game(\"game-name\")\n```\n\n### Get Game Settings\n```python\nmarketwatch.get_game_settings(\"game-name\")\n```\n\n### Get Leaderboard\n```python\nmarketwatch.get_leaderboard(\"game-name\")\n```\n\n### Get Portfolio\n```python\nmarketwatch.get_portfolio(\"game-name\")\n```\n\n### Get Positions\n```python\nmarketwatch.get_positions(\"game-name\")\n```\n\n### Get Pending Orders \n```python\nmarketwatch.get_pending_orders(\"game-name\")\n```\n\n### Buy Stock\n```python\nmarketwatch.buy(game_id, \"AAPL\", 100)\n```\n\n### Sell Stock\n```python\nmarketwatch.sell(\"game-name\", \"AAPL\", 100)\n```\n\n### Create Watchlist\nhttps://www.marketwatch.com/watchlist\n\nTo create a watchlist:\n```python\nmarketwatch.create_watchlist('My Watchlist')\n```\n\n### Add Stock to Watchlist\nTo add stocks to a watchlist:\n```python\nmarketwatch.add_to_watchlist(watchlist_id, ['AAPL', 'GOOG'])\n```\n\n### Get All Watchlists\nTo get all watchlists:\n```python\nwatchlists = marketwatch.get_watchlists()\n```\n\n### Delete Watchlist\nTo delete a watchlist:\n```python\nmarketwatch.delete_watchlist(watchlist_id)\n```\n\n### Example\n\n```python\nimport os\nusername = os.environ.get(\"MARKETWATCH_USERNAME\")\npassword = os.environ.get(\"MARKETWATCH_PASSWORD\")\n\nmarketwatch = MarketWatch(username, password)\n\nprint(f\"Price: {marketwatch.get_price('AAPL')} \\n\")\nprint(f\"Games: {marketwatch.get_games()} \\n\")\n\ngames1 = marketwatch.get_games()[0][\"name\"].lower().replace(\" \", \"-\")\n\nprint(f\"Game: {marketwatch.get_game(games1)} \\n\")\nprint(f\"Game Settings: {marketwatch.get_game_settings(games1)} \\n\")\n\nprint(f\"Leaderboard: {marketwatch.get_leaderboard(games1)} \\n\")\nprint(f\"Porfolio: {marketwatch.get_portfolio(games1)} \\n\")\n\nprint(f\"Position: {marketwatch.get_positions(games1)}\")\nprint(f\"Orders Pending: {marketwatch.get_pending_orders(games1)}\")\nmarketwatch.buy(games1, \"AAPL\", 100)\n\nprint(f\"Position diff: {marketwatch.get_positions(games1)}\")\n```\n\n## Contributing\nContributions are welcome. Please open an issue or submit a pull request.\n\n## License\nThis project is licensed under the MIT License.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "MarketWatch's API",
    "version": "0.2.4.2",
    "project_urls": {
        "Documentation": "https://antoinebou12.github.io/marketwatch/api/",
        "Homepage": "http://github.com/antoineboucher/marketwatch",
        "Repository": "http://github.com/antoineboucher/marketwatch"
    },
    "split_keywords": [
        "marketwatch",
        " api",
        " stock",
        " finance",
        " market",
        " game"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c38e8fd0e10128f8eee50c7ad6adbeed788c40874abf00d2e0eaaa958adfe602",
                "md5": "ef97c6ef9988d79c7b3bf93f38918ccd",
                "sha256": "8a0f1e5375ef7677170dcc79ab0792c9e7f4df981504f80427757e2ca6cce26a"
            },
            "downloads": -1,
            "filename": "marketwatch-0.2.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef97c6ef9988d79c7b3bf93f38918ccd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 22171,
            "upload_time": "2024-08-20T21:51:27",
            "upload_time_iso_8601": "2024-08-20T21:51:27.490463Z",
            "url": "https://files.pythonhosted.org/packages/c3/8e/8fd0e10128f8eee50c7ad6adbeed788c40874abf00d2e0eaaa958adfe602/marketwatch-0.2.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6873af1a3cb029614f79dafa8ab1de6511cf7afa6bdc42376f33aa9a74d1c354",
                "md5": "9a04dc1e31b15c8c403e6b65138effea",
                "sha256": "72fbc839ef0da9f5bf52abe9f41b31ef566ab8255d58bc9b940ff479b2e2c423"
            },
            "downloads": -1,
            "filename": "marketwatch-0.2.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9a04dc1e31b15c8c403e6b65138effea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 21322,
            "upload_time": "2024-08-20T21:51:28",
            "upload_time_iso_8601": "2024-08-20T21:51:28.479269Z",
            "url": "https://files.pythonhosted.org/packages/68/73/af1a3cb029614f79dafa8ab1de6511cf7afa6bdc42376f33aa9a74d1c354/marketwatch-0.2.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-20 21:51:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "antoineboucher",
    "github_project": "marketwatch",
    "github_not_found": true,
    "lcname": "marketwatch"
}
        
Elapsed time: 0.47458s