Skip to main content

An unofficial API for Firstrade

Project description

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

Quikstart

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_numbers list
  • Print out the order confirmation
  • Contains a cancel order example
  • Get an option Dates, Quotes, and Greeks
  • Place a dry run option order

Implemented Features

  • Login (With all 2FA methods now supported!)
  • Get Quotes
  • 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

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:

GitHub Sponsors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firstrade-0.0.33.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

firstrade-0.0.33-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file firstrade-0.0.33.tar.gz.

File metadata

  • Download URL: firstrade-0.0.33.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for firstrade-0.0.33.tar.gz
Algorithm Hash digest
SHA256 affeaccfa5517d37ff0e75327240150e34906cb90c7fcb1ff9a082880319581c
MD5 542113a345bad6525e1590e8722c49ef
BLAKE2b-256 a7dfb24608c388fd734f08bcbad60e751019b7038e5b4585701916592038dbac

See more details on using hashes here.

File details

Details for the file firstrade-0.0.33-py3-none-any.whl.

File metadata

  • Download URL: firstrade-0.0.33-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for firstrade-0.0.33-py3-none-any.whl
Algorithm Hash digest
SHA256 b856c309b19bd6a11cd4b88bccd5ed9249e3f36a1cdfe863622896db91455949
MD5 c5ef72512976deab1f4720f5d99b31f7
BLAKE2b-256 d57681852c92637593b89fa6df4294d94d8903ff27bebc2bf1d333559da0f14f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page