fidelity-api 0.0.5__tar.gz → 0.0.7__tar.gz
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.
- {fidelity-api-0.0.5/fidelity_api.egg-info → fidelity-api-0.0.7}/PKG-INFO +2 -1
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/README.md +1 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity/fidelity.py +26 -10
- {fidelity-api-0.0.5 → fidelity-api-0.0.7/fidelity_api.egg-info}/PKG-INFO +2 -1
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/setup.py +1 -1
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/LICENSE +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity/__init__.py +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity_api.egg-info/SOURCES.txt +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity_api.egg-info/dependency_links.txt +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity_api.egg-info/requires.txt +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/fidelity_api.egg-info/top_level.txt +0 -0
- {fidelity-api-0.0.5 → fidelity-api-0.0.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fidelity-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: An unofficial API for Fidelity
|
|
5
5
|
Home-page: https://github.com/kennyboy106/fidelity-api
|
|
6
6
|
Author: Kenneth Tang
|
|
@@ -21,6 +21,7 @@ gather account positions, nickname accounts, etc.
|
|
|
21
21
|
|
|
22
22
|
Supports 2FA!
|
|
23
23
|
|
|
24
|
+
Made with the help of Jinhui Zhen
|
|
24
25
|
## Disclaimer
|
|
25
26
|
I am not a financial advisor and not affiliated with Fidelity in any way. Use this tool at your own risk. I am
|
|
26
27
|
not responsible for any losses or damages you may incur by using this project. This tool is provided as-is
|
|
@@ -10,6 +10,7 @@ gather account positions, nickname accounts, etc.
|
|
|
10
10
|
|
|
11
11
|
Supports 2FA!
|
|
12
12
|
|
|
13
|
+
Made with the help of Jinhui Zhen
|
|
13
14
|
## Disclaimer
|
|
14
15
|
I am not a financial advisor and not affiliated with Fidelity in any way. Use this tool at your own risk. I am
|
|
15
16
|
not responsible for any losses or damages you may incur by using this project. This tool is provided as-is
|
|
@@ -223,6 +223,8 @@ class FidelityAutomation:
|
|
|
223
223
|
-------
|
|
224
224
|
all_stock_dict (dict)
|
|
225
225
|
A dict of stocks that the account has.
|
|
226
|
+
The dict is keyed by stocks and only has the quantity.
|
|
227
|
+
`all_stock_dict[stock] = quantity (int)`
|
|
226
228
|
"""
|
|
227
229
|
if account_number in self.account_dict:
|
|
228
230
|
all_stock_dict = {}
|
|
@@ -253,7 +255,8 @@ class FidelityAutomation:
|
|
|
253
255
|
```
|
|
254
256
|
{
|
|
255
257
|
'balance': float: Total account balance
|
|
256
|
-
'
|
|
258
|
+
'nickname': str: The account nickname or default name
|
|
259
|
+
"withdrawal_balance": Use get_list_of_accounts() to populate
|
|
257
260
|
'stocks': list: A list of dictionaries for each stock found. The dict has:
|
|
258
261
|
{
|
|
259
262
|
'ticker': str: The ticker of the stock held
|
|
@@ -264,7 +267,7 @@ class FidelityAutomation:
|
|
|
264
267
|
}
|
|
265
268
|
```
|
|
266
269
|
None
|
|
267
|
-
If an error
|
|
270
|
+
If an error occurred
|
|
268
271
|
"""
|
|
269
272
|
try:
|
|
270
273
|
# Go to positions page
|
|
@@ -280,7 +283,7 @@ class FidelityAutomation:
|
|
|
280
283
|
# See if new UI is present
|
|
281
284
|
new_ui = True
|
|
282
285
|
try:
|
|
283
|
-
self.page.get_by_role("button", name="Available Actions").click(timeout=
|
|
286
|
+
self.page.get_by_role("button", name="Available Actions").click(timeout=8000)
|
|
284
287
|
with self.page.expect_download() as download_info:
|
|
285
288
|
self.page.get_by_role("menuitem", name="Download").click()
|
|
286
289
|
download = download_info.value
|
|
@@ -290,9 +293,10 @@ class FidelityAutomation:
|
|
|
290
293
|
try:
|
|
291
294
|
# Use the old UI
|
|
292
295
|
with self.page.expect_download() as download_info:
|
|
293
|
-
self.page.get_by_label("Download Positions").click()
|
|
296
|
+
self.page.get_by_label("Download Positions").click(timeout=8000)
|
|
294
297
|
download = download_info.value
|
|
295
298
|
except PlaywrightTimeoutError:
|
|
299
|
+
print("Could not get positions csv")
|
|
296
300
|
return None
|
|
297
301
|
# Get absolute path to file
|
|
298
302
|
cur = os.getcwd()
|
|
@@ -761,10 +765,13 @@ class FidelityAutomation:
|
|
|
761
765
|
|
|
762
766
|
def transaction(self, stock: str, quantity: float, action: str, account: str, dry: bool = True) -> bool:
|
|
763
767
|
"""
|
|
764
|
-
Process an order (transaction) using the dedicated trading page.
|
|
768
|
+
Process an order (transaction) using the dedicated trading page. Support extended hour trading.
|
|
765
769
|
|
|
766
770
|
`NOTE`: If you use this function repeatedly but change the stock between ANY call,
|
|
767
|
-
RELOAD the page before calling this
|
|
771
|
+
RELOAD the page before calling this. You can do this like so:
|
|
772
|
+
```
|
|
773
|
+
FidelityAutomation.page.reload()
|
|
774
|
+
```
|
|
768
775
|
|
|
769
776
|
For buying:
|
|
770
777
|
If the price of the security is below $1, it will choose limit order and go off of the last price + a little
|
|
@@ -991,8 +998,12 @@ class FidelityAutomation:
|
|
|
991
998
|
self.wait_for_loading_sign()
|
|
992
999
|
|
|
993
1000
|
# If application is already started, then there will only be 1 "Next" button
|
|
994
|
-
|
|
995
|
-
|
|
1001
|
+
# Rarely there will be no "Next" button
|
|
1002
|
+
try:
|
|
1003
|
+
self.page.get_by_role("button", name="Next").click(timeout=15000)
|
|
1004
|
+
self.wait_for_loading_sign()
|
|
1005
|
+
except:
|
|
1006
|
+
pass
|
|
996
1007
|
|
|
997
1008
|
# Open account
|
|
998
1009
|
self.page.get_by_role("button", name="Open account").click()
|
|
@@ -1012,7 +1023,6 @@ class FidelityAutomation:
|
|
|
1012
1023
|
# If new account is found, collect and return
|
|
1013
1024
|
if new_dict_acc not in old_dict:
|
|
1014
1025
|
self.new_account_number = new_dict_acc
|
|
1015
|
-
print(self.new_account_number)
|
|
1016
1026
|
return True
|
|
1017
1027
|
|
|
1018
1028
|
# No new account number was found, return false
|
|
@@ -1288,6 +1298,11 @@ class FidelityAutomation:
|
|
|
1288
1298
|
The account number for the account to be nicknamed. Ex: `Z12345678`
|
|
1289
1299
|
nickname (str)
|
|
1290
1300
|
The nickname to use
|
|
1301
|
+
|
|
1302
|
+
Returns
|
|
1303
|
+
-------
|
|
1304
|
+
Success (bool)
|
|
1305
|
+
True if successful, false otherwise
|
|
1291
1306
|
"""
|
|
1292
1307
|
try:
|
|
1293
1308
|
# Get to summary page
|
|
@@ -1320,8 +1335,9 @@ class FidelityAutomation:
|
|
|
1320
1335
|
return False
|
|
1321
1336
|
|
|
1322
1337
|
# Click it
|
|
1338
|
+
self.page.wait_for_timeout(500)
|
|
1323
1339
|
selected_entry.click()
|
|
1324
|
-
self.page.wait_for_timeout(
|
|
1340
|
+
self.page.wait_for_timeout(500)
|
|
1325
1341
|
|
|
1326
1342
|
# Click the rename button
|
|
1327
1343
|
self.page.get_by_role("button", name="Rename").click()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fidelity-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: An unofficial API for Fidelity
|
|
5
5
|
Home-page: https://github.com/kennyboy106/fidelity-api
|
|
6
6
|
Author: Kenneth Tang
|
|
@@ -21,6 +21,7 @@ gather account positions, nickname accounts, etc.
|
|
|
21
21
|
|
|
22
22
|
Supports 2FA!
|
|
23
23
|
|
|
24
|
+
Made with the help of Jinhui Zhen
|
|
24
25
|
## Disclaimer
|
|
25
26
|
I am not a financial advisor and not affiliated with Fidelity in any way. Use this tool at your own risk. I am
|
|
26
27
|
not responsible for any losses or damages you may incur by using this project. This tool is provided as-is
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|