fidelity-api


Namefidelity-api JSON
Version 0.0.11 PyPI version JSON
download
home_pagehttps://github.com/kennyboy106/fidelity-api
SummaryAn unofficial API for Fidelity
upload_time2025-02-05 06:45:47
maintainerNone
docs_urlNone
authorKenneth Tang
requires_pythonNone
licenseGPL
keywords fidelity api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a id="readme-top"></a>
# fidelity-api

<!-- ABOUT THE PROJECT -->
## About The Project
This project aims to create an easy to use API for Fidelity.

Utilizing Playwright, a controlled browser is created through the api allowing users to place order, 
gather account positions, nickname accounts, etc.

Supports 2FA!

Made with the help of Jinhui Zhen
## Disclaimer
I am not a financial advisor and not affiliated with Fidelity in any way. 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.

## Donations
If you feel this project has saved you time or provided value to you, you can send me a donation using the badge below!

[![ko-fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white
)](https://ko-fi.com/kenny18067)

<!-- GETTING STARTED -->
## Getting Started

Install using pypi:
```sh
pip install fidelity-api
```

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:
```sh
playwright install
```

If you would like some more information on this, you can find it [here](https://playwright.dev/python/docs/intro).

## Quickstart
The example below will:
- login to fidelity
- gather account holdings
- place an order for the first account number found
```py
from fidelity import fidelity

browser = fidelity.FidelityAutomation(headless=False, save_state=False)

# Login
step_1, step_2 = browser.login(username="USER", password="PASS", save_device=True)
if step_1 and step_2:
    print("Logged in")
elif step_1 and not step_2:
    print("2FA code needed")
    code = input("Enter the code\n")
if browser.login_2FA(code):
    print("Logged in")
else:
    print("Browser not logged in")
    exit(1)

# Get accounts
account_info = browser.getAccountInfo()
accounts = account_info.keys()

# Test the transaction
success, errormsg = browser.transaction("INTC", 1, 'buy', accounts[0], True)
if success:
    print("Successfully tested transaction")
else:
    print(errormsg)

# Print withdrawal balance from each account
acc_dict = browser.get_list_of_accounts(set_flag=True, get_withdrawal_bal=True)
for account in acc_dict:
    print(f"{acc_dict[account]['nickname']}:  {account}: {acc_dict[account]['withdrawal_balance']}")

browser.close_browser()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kennyboy106/fidelity-api",
    "name": "fidelity-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "FIDELITY, API",
    "author": "Kenneth Tang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f5/4f/a2ca32b472c2f87d8f81f846535def19ac4baf9269b68f9db413f67136f4/fidelity_api-0.0.11.tar.gz",
    "platform": null,
    "description": "<a id=\"readme-top\"></a>\n# fidelity-api\n\n<!-- ABOUT THE PROJECT -->\n## About The Project\nThis project aims to create an easy to use API for Fidelity.\n\nUtilizing Playwright, a controlled browser is created through the api allowing users to place order, \ngather account positions, nickname accounts, etc.\n\nSupports 2FA!\n\nMade with the help of Jinhui Zhen\n## Disclaimer\nI am not a financial advisor and not affiliated with Fidelity in any way. Use this tool at your own risk. I am \nnot responsible for any losses or damages you may incur by using this project. This tool is provided as-is \nwith no warranty.\n\n## Donations\nIf you feel this project has saved you time or provided value to you, you can send me a donation using the badge below!\n\n[![ko-fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white\n)](https://ko-fi.com/kenny18067)\n\n<!-- GETTING STARTED -->\n## Getting Started\n\nInstall using pypi:\n```sh\npip install fidelity-api\n```\n\nThis 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:\n```sh\nplaywright install\n```\n\nIf you would like some more information on this, you can find it [here](https://playwright.dev/python/docs/intro).\n\n## Quickstart\nThe example below will:\n- login to fidelity\n- gather account holdings\n- place an order for the first account number found\n```py\nfrom fidelity import fidelity\n\nbrowser = fidelity.FidelityAutomation(headless=False, save_state=False)\n\n# Login\nstep_1, step_2 = browser.login(username=\"USER\", password=\"PASS\", save_device=True)\nif step_1 and step_2:\n    print(\"Logged in\")\nelif step_1 and not step_2:\n    print(\"2FA code needed\")\n    code = input(\"Enter the code\\n\")\nif browser.login_2FA(code):\n    print(\"Logged in\")\nelse:\n    print(\"Browser not logged in\")\n    exit(1)\n\n# Get accounts\naccount_info = browser.getAccountInfo()\naccounts = account_info.keys()\n\n# Test the transaction\nsuccess, errormsg = browser.transaction(\"INTC\", 1, 'buy', accounts[0], True)\nif success:\n    print(\"Successfully tested transaction\")\nelse:\n    print(errormsg)\n\n# Print withdrawal balance from each account\nacc_dict = browser.get_list_of_accounts(set_flag=True, get_withdrawal_bal=True)\nfor account in acc_dict:\n    print(f\"{acc_dict[account]['nickname']}:  {account}: {acc_dict[account]['withdrawal_balance']}\")\n\nbrowser.close_browser()\n```\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "An unofficial API for Fidelity",
    "version": "0.0.11",
    "project_urls": {
        "Homepage": "https://github.com/kennyboy106/fidelity-api"
    },
    "split_keywords": [
        "fidelity",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbf644a2124c995952354401c3e40c8588a84eaab91ba7022080c2d38a03cbdc",
                "md5": "59db6af6399eee579304e053fd2b209c",
                "sha256": "e38be1264af9c4d5fe66a860bcb676ea07694d352c1d30d37dc99ade729e6fd6"
            },
            "downloads": -1,
            "filename": "fidelity_api-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "59db6af6399eee579304e053fd2b209c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 29576,
            "upload_time": "2025-02-05T06:45:45",
            "upload_time_iso_8601": "2025-02-05T06:45:45.709082Z",
            "url": "https://files.pythonhosted.org/packages/cb/f6/44a2124c995952354401c3e40c8588a84eaab91ba7022080c2d38a03cbdc/fidelity_api-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f54fa2ca32b472c2f87d8f81f846535def19ac4baf9269b68f9db413f67136f4",
                "md5": "39f4cf58ec18201d5292c5ae861727a3",
                "sha256": "70897d8c77ed9b358a82a166a668b0fc801bd3080cff0c164889dffe096230a0"
            },
            "downloads": -1,
            "filename": "fidelity_api-0.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "39f4cf58ec18201d5292c5ae861727a3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30312,
            "upload_time": "2025-02-05T06:45:47",
            "upload_time_iso_8601": "2025-02-05T06:45:47.254531Z",
            "url": "https://files.pythonhosted.org/packages/f5/4f/a2ca32b472c2f87d8f81f846535def19ac4baf9269b68f9db413f67136f4/fidelity_api-0.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-05 06:45:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kennyboy106",
    "github_project": "fidelity-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fidelity-api"
}
        
Elapsed time: 0.86349s