fidelity-api 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fidelity-api
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An unofficial API for Fidelity
|
|
5
|
+
Home-page: https://github.com/kennyboy106/fidelity-api
|
|
6
|
+
Author: Kenneth Tang
|
|
7
|
+
License: GPL
|
|
8
|
+
Keywords: FIDELITY,API
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: playwright
|
|
12
|
+
Requires-Dist: playwright-stealth
|
|
13
|
+
Requires-Dist: pyotp
|
|
14
|
+
|
|
15
|
+
<a id="readme-top"></a>
|
|
16
|
+
# fidelity-api
|
|
17
|
+
|
|
18
|
+
<!-- ABOUT THE PROJECT -->
|
|
19
|
+
## About The Project
|
|
20
|
+
This project aims to create an easy to use API for Fidelity.
|
|
21
|
+
|
|
22
|
+
Utilizing Playwright, a controlled browser is created through the api allowing users to place order,
|
|
23
|
+
gather account positions, nickname accounts, etc.
|
|
24
|
+
|
|
25
|
+
Supports 2FA!
|
|
26
|
+
|
|
27
|
+
## Disclaimer
|
|
28
|
+
I am not a financial advisor and not affiliated with Chase in any way. Use this tool at your own risk. I am
|
|
29
|
+
not responsible for any losses or damages you may incur by using this project. This tool is provided as-is
|
|
30
|
+
with no warranty.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<!-- GETTING STARTED -->
|
|
34
|
+
## Getting Started
|
|
35
|
+
|
|
36
|
+
Install using pypi:
|
|
37
|
+
```sh
|
|
38
|
+
pip install fidelity-api
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This package requires playwright. After installing fidelity-api, you will need to finish the install of playwright. You can do this in most cases by running the command:
|
|
42
|
+
```sh
|
|
43
|
+
playwright install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you would like some more information on this, you can find it [here](https://playwright.dev/python/docs/intro).
|
|
47
|
+
|
|
48
|
+
## Quickstart
|
|
49
|
+
The example below will:
|
|
50
|
+
- login to fidelity
|
|
51
|
+
- gather account holdings
|
|
52
|
+
- place an order for the first account number found
|
|
53
|
+
```py
|
|
54
|
+
from fidelity import fidelity
|
|
55
|
+
|
|
56
|
+
browser = fidelity.FidelityAutomation(headless=False, save_state=False)
|
|
57
|
+
|
|
58
|
+
# Login
|
|
59
|
+
step_1, step_2 = browser.login(username="USER", password="PASS", save_device=True)
|
|
60
|
+
if step_1 and step_2:
|
|
61
|
+
print("Logged in")
|
|
62
|
+
elif step_1 and not step_2:
|
|
63
|
+
print("2FA code needed")
|
|
64
|
+
code = input("Enter the code\n")
|
|
65
|
+
if browser.login_2FA(code):
|
|
66
|
+
print("Logged in")
|
|
67
|
+
else:
|
|
68
|
+
print("Browser not logged in")
|
|
69
|
+
exit(1)
|
|
70
|
+
|
|
71
|
+
# Get accounts
|
|
72
|
+
account_info = browser.getAccountInfo()
|
|
73
|
+
accounts = account_info.keys()
|
|
74
|
+
|
|
75
|
+
# Test the transaction
|
|
76
|
+
success, errormsg = browser.transaction("INTC", 1, 'buy', accounts[0], True)
|
|
77
|
+
if success:
|
|
78
|
+
print("Successfully tested transaction")
|
|
79
|
+
else:
|
|
80
|
+
print(errormsg)
|
|
81
|
+
|
|
82
|
+
# Print withdrawal balance from each account
|
|
83
|
+
acc_dict = browser.get_list_of_accounts(set_flag=True, get_withdrawal_bal=True)
|
|
84
|
+
for account in acc_dict:
|
|
85
|
+
print(f"{acc_dict[account]['nickname']}: {account}: {acc_dict[account]['withdrawal_balance']}")
|
|
86
|
+
|
|
87
|
+
browser.close_browser()
|
|
88
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
fidelity/__init__.py,sha256=x8p5_1so4VXcPXMd7xVU24d5VHzBOh8KMKQ2La_-gOE,48
|
|
2
|
+
fidelity/fidelity.py,sha256=v1JbXFWgNoJe_uRIfalhtKtvmaNJuqzd2tyFsxsjESk,58964
|
|
3
|
+
fidelity_api-0.0.1.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
4
|
+
fidelity_api-0.0.1.dist-info/METADATA,sha256=nWUiek1JT4u9TRW6bHuSSj_uEY-TgW93rZLO8GGFmN8,2558
|
|
5
|
+
fidelity_api-0.0.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
6
|
+
fidelity_api-0.0.1.dist-info/top_level.txt,sha256=z_uwICzFzECha9H3Mp1q8XLdqAsvvBt9bov9w5NsN6o,9
|
|
7
|
+
fidelity_api-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fidelity
|