Skip to content

Commit 0070774

Browse files
committed
update readme
1 parent 2c107b7 commit 0070774

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

.github/workflows/pypi_publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
paths:
66
- "setup.py"
7+
- "README.md"
78

89
jobs:
910
build:

README.md

+70-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# public-invest-api
1+
# Unofficial Public.com Invest API
2+
3+
This is an unofficial API for Public.com. It is a simple Python wrapper around the Public.com requests API. It is not affiliated with Public.com in any way. Use at your own risk.
4+
5+
This is still a very work in progress, so it will have bugs and missing features. Feel free to contribute!
6+
7+
## Installation
8+
9+
```bash
10+
pip install public-invest-api
11+
```
12+
13+
## Usage: Logging In
14+
15+
```python
16+
from public_invest_api import Public
17+
18+
public = Public()
19+
public.login(
20+
username='your_email',
21+
password='your_password'
22+
wait_for_2fa=True # When logging in for the first time, you need to wait for the SMS code
23+
)
24+
```
25+
26+
If you'd like to handle the 2FA code yourself, set `wait_for_2fa=False` and it will throw an Exception relating to 2FA. Catch this, then when you get the 2FA code, call it again with the code:
27+
28+
```python
29+
public.login(
30+
username='your_email',
31+
password='your_password',
32+
wait_for_2fa=False,
33+
code='your_2fa_code' # Should be six digit integer
34+
)
35+
```
36+
37+
## Usage: Get Holdings
38+
39+
```python
40+
positions = public.get_positions()
41+
for position in positions:
42+
print(position)
43+
```
44+
45+
## Place Order
46+
47+
```python
48+
order = public.place_order(
49+
symbol='AAPL',
50+
quantity=1,
51+
side='BUY', # or 'SELL'
52+
order_type='MARKET', # or 'LIMIT' or 'STOP'
53+
time_in_force='DAY' # or 'GTC' or 'IOC' or 'FOK'
54+
is_dry_run=False # If True, it will not actually place the order
55+
tip=0 # The amount to tip Public.com
56+
)
57+
print(order)
58+
```
59+
60+
## Contributing
61+
Found or fixed a bug? Have a feature request? Feel free to open an issue or pull request!
62+
63+
Enjoying the project? Feel free to Sponsor me on GitHub or Ko-fi!
64+
65+
[![Sponsor](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#white)](https://github.com/sponsors/NelsonDane)
66+
[![ko-fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white
67+
)](https://ko-fi.com/X8X6LFCI0)
68+
69+
## DISCLAIMER
70+
DISCLAIMER: I am not a financial advisor and not affiliated with Public.com. Use this tool at your own risk. I am not responsible for any losses or damages you may incur by using this project. This tool is provided as-is with no warranty.

0 commit comments

Comments
 (0)