firstrade-api
A reverse-engineered python API to interact with the Firstrade Trading platform.
This is not an official api! This api's functionality may change at any time.
This api provides a means of buying and selling stocks through Firstrade. It uses the Session class from requests to get authorization cookies. The rest is done with reverse engineered requests to Firstrade's API.
In order to use Fractional shares you must accept the agreement on the website before using it in this API.
Contribution
Please feel free to contribute to this project. If you find any bugs, please open an issue.
Disclaimer
I am not a financial advisor and not affiliated with Firstrade 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.
Setup
Install using pypi:
pip install firstrade
Quickstart
The code in test.py will:
- Login and print account info.
- Get a quote for 'INTC' and print out the information
- Place a dry run market order for 'INTC' on the first account in the
account_numberslist - Print out the order confirmation
- Contains a cancel order example
- Get OHLC data
- Get an option Dates, Quotes, and Greeks
- Place a dry run option order
- List watchlists, create one, add a symbol to it then delete it
Implemented Features
- Login (With all 2FA methods now supported!)
- Get Quotes
- Get OHLC (timestamp, open, high, low, close, volume)
- Get Account Data
- Place Orders and Receive order confirmation
- Get Currently Held Positions
- Fractional Trading support (thanks to @jiak94)
- Check on placed order status. (thanks to @Cfomodz)
- Cancel placed orders
- Options (Orders, Quotes, Greeks)
- Order History
- Manage watchlists
TO DO
- Test options fully
- Give me some Ideas!
Options
I am very new to options trading and have not fully tested this feature.
Please:
- USE THIS FEATURE LIKE IT IS A ALPHA/BETA
- PUT IN A GITHUB ISSUE IF YOU FIND ANY PROBLEMS
If you would like to support me, you can do so here:
Metadata
Release files for firstrade 0.0.39
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firstrade-0.0.39.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firstrade-0.0.39-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.1 kB
Release files / firstrade-0.0.39.tar.gz
| Download URL | firstrade-0.0.39.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d5dced6d48392d601a4dd5623757b98be5f03736491192cd920c55958f74f2e
|
|
BLAKE2b-256 checksum How to use checksums |
b6577f0074b79eca8d2e7f9881b6274c3318166bf8be2bb219c43019b96b30c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / firstrade-0.0.39-py3-none-any.whl
| Download URL | firstrade-0.0.39-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89fe64b82514bcc965daa584d0f4e45cb65106cfea6e3515bcdb7f6005f39257
|
|
BLAKE2b-256 checksum How to use checksums |
adcef8e8964cf5af61cc99784025c4c6aa8b49ee78d5dcc6a60b823ded603810
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|