Skip to content

Commit 5ff9027

Browse files
authored
Update README.md (#55)
1 parent 24c2676 commit 5ff9027

File tree

2 files changed

+117
-43
lines changed

2 files changed

+117
-43
lines changed

README.md

Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,92 +18,123 @@ Based on code from
1818
- https://github.com/kevindong/MarketWatch_API/
1919
- https://github.com/bwees/pymarketwatch
2020

21+
## Feature
22+
- Logging in and out of the site
23+
- Getting the current price of a stock
24+
- Getting information about games on the site
25+
- Buying, selling, shorting, and covering stocks in a game
26+
- Creating, adding to, getting, and deleting watchlists
27+
- Getting, adding to, and deleting items from a portfolio
28+
- Getting and cancelling pending orders
29+
- Checking if the game is down
30+
2131
## Installation
2232

23-
```
33+
```shell
2434
pip install marketwatch
2535
```
2636

27-
```
37+
```shell
2838
pip install git+https://github.com/antoinebou12/marketwatch.git
2939
```
3040

31-
```
41+
```shell
3242
git clone https://github.com/antoinebou12/marketwatch.git
3343
```
3444

3545
## Usage
46+
Here are some examples of how you can use the MarketWatch class:
3647

3748
### Import
38-
39-
```
49+
First, import the MarketWatch class from the script:
50+
```python
4051
from marketwatch import MarketWatch
4152
```
4253

4354
### Login
44-
45-
```
55+
Then, create an instance of the MarketWatch class using your MarketWatch username and password:
56+
```python
4657
marketwatch = MarketWatch(username, password)
4758
```
4859

49-
### Get Price
50-
51-
```
60+
### Get Stock Price
61+
To get the current price of a stock:
62+
```python
5263
marketwatch.get_price("AAPL")
5364
```
5465

55-
### Get Games
66+
### Interact with Games
67+
https://www.marketwatch.com/games
5668

57-
```
69+
To get information about games on the site:
70+
```python
5871
marketwatch.get_games()
5972
```
6073

6174
### Get Game
62-
63-
```
75+
```python
6476
marketwatch.get_game("game-name")
6577
```
6678

6779
### Get Game Settings
68-
69-
```
80+
```python
7081
marketwatch.get_game_settings("game-name")
7182
```
7283

7384
### Get Leaderboard
74-
75-
```
85+
```python
7686
marketwatch.get_leaderboard("game-name")
7787
```
7888

7989
### Get Portfolio
80-
81-
```
90+
```python
8291
marketwatch.get_portfolio("game-name")
8392
```
8493

8594
### Get Positions
86-
87-
```
95+
```python
8896
marketwatch.get_positions("game-name")
8997
```
9098

91-
### Get Pending Orders
92-
93-
```
99+
### Get Pending Orders
100+
```python
94101
marketwatch.get_pending_orders("game-name")
95102
```
96103

97-
### Buy
104+
### Buy Stock
105+
```python
106+
marketwatch.buy(game_id, "AAPL", 100)
107+
```
98108

109+
### Sell Stock
110+
```python
111+
marketwatch.sell("game-name", "AAPL", 100)
99112
```
100-
marketwatch.buy("game-name", "AAPL", 100)
113+
114+
### Create Watchlist
115+
https://www.marketwatch.com/watchlist
116+
117+
To create a watchlist:
118+
```python
119+
marketwatch.create_watchlist('My Watchlist')
101120
```
102121

103-
### Sell
122+
### Add Stock to Watchlist
123+
To add stocks to a watchlist:
124+
```python
125+
marketwatch.add_to_watchlist(watchlist_id, ['AAPL', 'GOOG'])
126+
```
104127

128+
### Get All Watchlists
129+
To get all watchlists:
130+
```python
131+
watchlists = marketwatch.get_watchlists()
105132
```
106-
marketwatch.sell("game-name", "AAPL", 100)
133+
134+
### Delete Watchlist
135+
To delete a watchlist:
136+
```python
137+
marketwatch.delete_watchlist(watchlist_id)
107138
```
108139

109140
### Example
@@ -133,3 +164,9 @@ if __name__ == "__main__":
133164
134165
print(f"Position diff: {marketwatch.get_positions(games1)}")
135166
```
167+
168+
## Contributing
169+
Contributions are welcome. Please open an issue or submit a pull request.
170+
171+
## License
172+
This project is licensed under the MIT License.

docs/api.md

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,121 @@
11
### Import
22
To start using the marketwatch library, import the MarketWatch class:
3-
```
3+
```python
44
from marketwatch import MarketWatch
55
```
66

77
### Login
88
Create a MarketWatch instance and log in with your username and password:
9-
```
9+
```python
1010
marketwatch = MarketWatch(username, password)
1111
```
1212

1313
### Get Price
1414
Fetch the current price of a stock by passing its ticker symbol:
15-
```
15+
```python
1616
marketwatch.get_price("AAPL")
1717
```
1818

1919
### Get Games
2020
Retrieve the list of games you are participating in:
21-
```
21+
```python
2222
marketwatch.get_games()
2323
```
2424

2525
### Get Game
2626
Fetch detailed information about a specific game by providing the game's name:
27-
```
27+
```python
2828
marketwatch.get_game("game-name")
2929
```
3030

3131
### Get Game Settings
3232
Access the settings of a specific game:
33-
```
33+
```python
3434
marketwatch.get_game_settings("game-name")
3535
```
3636

3737
### Get Leaderboard
3838
Retrieve the leaderboard data for a specific game:
39-
```
39+
```python
4040
marketwatch.get_leaderboard("game-name")
4141
```
4242

4343
### Get Portfolio
4444
Fetch your portfolio information in a specific game:
45-
```
45+
```python
4646
marketwatch.get_portfolio("game-name")
4747
```
4848

4949
### Get Portfolio Performance
5050
Retrieve the performance of your portfolio in a specific game:
51-
```
51+
```python
5252
marketwatch.get_portfolio_performance("game-name")
5353
```
5454

5555
### Get Transactions
5656
Access the transaction history for your portfolio in a specific game:
57-
```
57+
```python
5858
marketwatch.get_transactions("game-name")
5959
```
6060

6161
### Get Positions
6262
Fetch the current positions of your portfolio in a specific game:
63-
```
63+
```python
6464
marketwatch.get_positions("game-name")
6565
```
6666

6767
### Get Pending Orders
6868
Retrieve the list of pending orders for your portfolio in a specific game:
69-
```
69+
```python
7070
marketwatch.get_pending_orders("game-name")
7171
```
7272

7373
### Buy
7474
Place a buy order for a specific stock by providing the game's name, the stock's ticker symbol, and the number of shares:
75-
```
75+
```python
7676
marketwatch.buy("game-name", "AAPL", 100)
7777
```
7878

7979
### Sell
8080
Place a sell order for a specific stock by providing the game's name, the stock's ticker symbol, and the number of shares:
81-
```
81+
```python
8282
marketwatch.sell("game-name", "AAPL", 100)
8383
```
84+
85+
### Create Watchlist
86+
Create a new watchlist by providing a name and optionally a list of tickers:
87+
```python
88+
marketwatch.create_watchlist("My Watchlist", ["AAPL", "GOOG", "TSLA"])
89+
```
90+
91+
### Add to Watchlist
92+
Add tickers to an existing watchlist by providing the watchlist ID and a list of tickers:
93+
```python
94+
marketwatch.add_to_watchlist("watchlist_id", ["MSFT", "AMZN"])
95+
```
96+
97+
### Get Watchlists
98+
Retrieve all your watchlists:
99+
```python
100+
marketwatch.get_watchlists()
101+
```
102+
103+
### Get Watchlist
104+
Fetch a specific watchlist by providing its ID:
105+
```python
106+
marketwatch.get_watchlist("watchlist_id")
107+
```
108+
109+
### Delete Watchlist
110+
Delete a specific watchlist by providing its ID:
111+
```python
112+
marketwatch.delete_watchlist("watchlist_id")
113+
```
114+
115+
### Delete Watchlist Item
116+
Remove a ticker from a watchlist by providing the watchlist ID and the ticker:
117+
```python
118+
marketwatch.delete_watchlist_item("watchlist_id", "AAPL")
119+
```
120+
84121
For more examples and detailed explanations of each function, visit the official GitHub repository of the marketwatch library.

0 commit comments

Comments
 (0)