Skip to main content

chaseinvest-api

A reverse-engineered python API to interact with the Chase 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 Chase. It uses playwright to scrape response data and to interact with the website.


Contribution

I am new to coding and new to open-source. I would love any help and suggestions!

Disclaimer

I am not a financial advisor and not affiliated with Chase 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 chaseinvest-api

This package requires playwright. After installing chaseinvest-api, you will need to finish the install of playwright. You can do this in most cases by running the command:

playwright install

If you would like some more information on this, you can find it here.

Quickstart

The code below will:

  • Login and print account info.
  • Get a quote for 'INTC' and print out the information
  • Place a market order for 'INTC' on the first account in the account_numbers list
  • Print out the order confirmation
import sys

from chase import account as acc
from chase import order as och
from chase import session
from chase import symbols as sym

# create Session Headless does not work at the moment it must be set to false.
cs = session.ChaseSession(
    title="Title of your profile here", headless=False, profile_path="your/profile/path"
)

# Login to Chase.com
login_one = cs.login("your_username", "your_password", "last_four_of_your_cell_phone")

# Check if login succeeded without needing 2fa if not then prompt for 2fa code
if login_one is False:
    print("Login succeeded without needing 2fa...")
else:
    code = input("Please input code that was sent to your phone: ")
    login_two = cs.login_two(code)

# Make all account object
all_accounts = acc.AllAccount(cs)

if all_accounts.account_connectors is None:
    sys.exit("Failed to get account connectors exiting script...")

# Get Account Identifiers
print("====================================")
print(f"Account Identifiers: {all_accounts.account_connectors}")

# Get Base Account Details
account_ids = list(all_accounts.account_connectors.keys())

print("====================================")
print("ACCOUNT DETAILS")
print("====================================")
for account in account_ids:
    account = acc.AccountDetails(account, all_accounts)
    print(account.nickname, account.mask, account.account_value)
print("====================================")

# Get Holdings
print("====================================")
print("HOLDINGS")
for account in account_ids:
    print("====================================")
    print(f"Account: {all_accounts.account_connectors[account]}")
    symbols = sym.SymbolHoldings(account, cs)
    success = symbols.get_holdings()
    if success:
        for i, symbol in enumerate(symbols.positions):
            if symbols.positions[i]["instrumentLongName"] == "Cash and Sweep Funds":
                symbol = symbols.positions[i]["instrumentLongName"]
                value = symbols.positions[i]["marketValue"]["baseValueAmount"]
                print(f"Symbol: {symbol} Value: {value}")
            elif symbols.positions[i]["assetCategoryName"] == "EQUITY":
                try:
                    symbol = symbols.positions[i]["positionComponents"][0][
                        "securityIdDetail"
                    ][0]["symbolSecurityIdentifier"]
                    value = symbols.positions[i]["marketValue"]["baseValueAmount"]
                    quantity = symbols.positions[i]["tradedUnitQuantity"]
                    print(f"Symbol: {symbol} Value: {value} Quantity: {quantity}")
                except KeyError:
                    symbol = symbols.positions[i]["securityIdDetail"]["cusipIdentifier"]
                    value = symbols.positions[i]["marketValue"]["baseValueAmount"]
                    quantity = symbols.positions[i]["tradedUnitQuantity"]
                    print(f"Symbol: {symbol} Value: {value} Quantity: {quantity}")
    else:
        print(f"Failed to get holdings for account {account}")
print("====================================")

# Create Order Object
order = och.Order(cs)

# Get Order Statuses
print("====================================")
print("ORDER STATUSES")
for account in account_ids:
    order_statuses = order.get_order_statuses(account)
    print("====================================")
    print(f"Account: {all_accounts.account_connectors[account]}")
    for order_status in order_statuses["orderSummaries"]:
        order_number = order_status["orderIdentifier"]
        order_type = order_status["tradeActionCode"]
        order_status_code = order_status["orderStatusCode"]
        print(
            f"Order Number: {order_number} Side: {order_type} Status: {order_status_code}"
        )
print("====================================")

# Get quote for INTC
symbol_quote = sym.SymbolQuote(account_ids[0], cs, "INTC")
print("====================================")
print("SYMBOL QUOTE")
print(
    f"{symbol_quote.security_description_text} ask price {symbol_quote.ask_price}, @{symbol_quote.as_of_timestamp} and the last trade was {symbol_quote.last_trade_price_amount}.")
print("====================================")

# Place dry run order for INTC
messages = order.place_order(
    account_ids[0],
    1,
    och.PriceType.MARKET,
    "INTC",
    och.Duration.DAY,
    och.OrderSide.BUY,
    dry_run=True,
)
if messages["ORDER CONFIRMATION"] != "":
    print(messages["ORDER CONFIRMATION"])
else:
    print(messages)

This code is also in test.py


Implemented Features

  • Login
  • Login with MFA
  • Get Quotes
  • Get Account Data
  • Place Orders and Receive order confirmation
  • Get Currently Held Positions
  • Get placed order status

TO DO

  • Cancel placed orders
  • Options
  • Give me some Ideas!

If you would like to support me, you can do so here:

GitHub Sponsors

Metadata

Release files for chaseinvest-api 0.4.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chaseinvest-api 0.4.7
File Size Uploaded Provenance Actions
chaseinvest_api-0.4.7.tar.gz 17.6 kB Without provenance Details for chaseinvest_api-0.4.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chaseinvest-api 0.4.7
File Interpreter ABI Platform Actions
chaseinvest_api-0.4.7-py3-none-any.whl Python 3 none any Details for chaseinvest_api-0.4.7-py3-none-any.whl

Total release size: 35.1 kB

Release files / chaseinvest_api-0.4.7.tar.gz

Download URL chaseinvest_api-0.4.7.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3c7503971af94f36ffdbaed355e3faadc471b61f4540ca36b94ef7b39cb3dba5
BLAKE2b-256 checksum
How to use checksums
817bb8f9765c2d18df63d113f96a2c56eaf15a764d6dae09a32f10b9b3bd50a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / chaseinvest_api-0.4.7-py3-none-any.whl

Download URL chaseinvest_api-0.4.7-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
743491330911dd15074f779a61c4658ae41fab09210234256a8e58f98a4c02b4
BLAKE2b-256 checksum
How to use checksums
48e91e7a48328889d5e237391665a169b212dbdefc946c5ae14f9f8f5a469f1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for chaseinvest-api 0.4.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page