PHPackages                             kevinrider/laravel-etrade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kevinrider/laravel-etrade

ActiveLibrary[API Development](/categories/api)

kevinrider/laravel-etrade
=========================

Laravel E\*TRADE v1 API client package

v1.0.0(6mo ago)75Apache-2.0PHPPHP ^8.3|^8.4|^8.5CI passing

Since Jan 2Pushed 5mo agoCompare

[ Source](https://github.com/kevinrider/laravel-etrade)[ Packagist](https://packagist.org/packages/kevinrider/laravel-etrade)[ RSS](/packages/kevinrider-laravel-etrade/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (8)Versions (4)Used By (0)

[![social-preview](https://repository-images.githubusercontent.com/1093108803/3233424f-7719-4642-87e7-efbe0f919342)](https://repository-images.githubusercontent.com/1093108803/3233424f-7719-4642-87e7-efbe0f919342)

[![Latest Version](https://camo.githubusercontent.com/65583a128eea3f21b6bb53c989ed88197682300e628da70fe1b3e42989d3b3e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6b6576696e72696465722f6c61726176656c2d6574726164652e7376673f7374796c653d666c61742d737175617265)](https://github.com/kevinrider/laravel-etrade/releases)[![Unit tests](https://github.com/kevinrider/laravel-etrade/actions/workflows/tests.yml/badge.svg)](https://github.com/kevinrider/laravel-etrade/actions)[![GitHub issues](https://camo.githubusercontent.com/84f0547ae873beccb5587e077aa57de9d9d7acd6b35a3765c50b2804784dd79f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6b6576696e72696465722f6c61726176656c2d657472616465)](https://github.com/kevinrider/laravel-etrade/issues)[![License](https://camo.githubusercontent.com/8745dfd7627bd650d98b4627e3c4c6d3dfec35a3976070702c5925256450968b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b6576696e72696465722f6c61726176656c2d657472616465)](https://github.com/kevinrider/laravel-etrade/blob/main/LICENSE)

[Laravel](https://laravel.com/) client for the [E\*TRADE v1 API](https://developer.etrade.com/). This is a rewrite of [phpetrade](https://github.com/kevinrider/phpetrade) that uses Laravel conventions, [Guzzle](https://github.com/guzzle/guzzle), [Carbon](https://github.com/briannesbitt/Carbon), and complete data transfer object (DTO) coverage for E\*TRADE API request and response objects.

Disclosure
----------

[](#disclosure)

**This package is not affiliated with, endorsed by, or supported by E\*TRADE or any of its affiliates or owners. Use at your own risk and review the E\*TRADE API terms before use.**

**The developer is not responsible for any losses incurred from the use of this code. Laravel-etrade comes with absolutely no warranty and should not be used in actual trading unless you (the user) can read and understand the source code. Orders placed with this code (in production mode) will submit trades that will be advertised on the open market and will immediately be filled if a counterparty is present, regardless of whether you made a mistake or not. It is your responsibility to understand, test (in the sandbox), and refine your trades and the code where necessary before using in a live market environment.**

**Use the sandbox environment before moving to production, especially if you are going to place orders! When starting in the production environment you should create and test your trades and code. This can include submitting orders when the regular market session is closed and setting the marketSession to REGULAR. You can also submit trades with a limit price that is far below the market bid if going long or well above the ask if you are going short. Do not use priceType=MARKET trades unless you want an immediate fill on the order. MARKET trades are definitely not recommended for options, especially those on low liquidity symbols or on strike prices that are deep OTM.**

Features
--------

[](#features)

- Access your E\*TRADE accounts within a Laravel app!
- Guzzle-powered OAuth 1.0a flow and request signing
- DTOs for request/response payloads
- Order builder for previewing and placing orders
- Encrypted token storage and management via Laravel cache
- Interactive Artisan demo against your E\*TRADE account

Key files
---------

[](#key-files)

- **EtradeApiClient**: [Full E\*TRADE API coverage](https://apisb.etrade.com/docs/api/account/api-account-v1.html)
    - Authorization: request/renew/revoke access tokens
    - Accounts: list, balance, transactions, transaction details, portfolio
    - Alerts: list, details, delete
    - Market: quotes, lookup, option chains, option expirations
    - Orders: list, preview, place, change preview, place change, cancel
- **EtradeOrderBuilder**: Quickly and easily compose complex orders
- **LaravelEtradeDemo**: Interactive CLI command with extensive **EtradeApiClient** and **EtradeOrderBuilder** example usage

[![demo](https://private-user-images.githubusercontent.com/77411092/531747963-6f449caf-e637-477e-93ea-f4695a29b4b4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNDgwNjEsIm5iZiI6MTc4MjE0Nzc2MSwicGF0aCI6Ii83NzQxMTA5Mi81MzE3NDc5NjMtNmY0NDljYWYtZTYzNy00NzdlLTkzZWEtZjQ2OTVhMjliNGI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDE3MDI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ5N2M3ZDY2ZDVmMGY2Yjk1ODk2YTE4YTdlMDM2ZmE0NGZlYmZkYjdjNjE1ZjlmNTY0ZWRlNmQ0MGY4ZTVlZDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.QCed3_xDKu4qJJpFb-EKAOUiwk1xyTgRD6n-3h1tWUA)](https://private-user-images.githubusercontent.com/77411092/531747963-6f449caf-e637-477e-93ea-f4695a29b4b4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNDgwNjEsIm5iZiI6MTc4MjE0Nzc2MSwicGF0aCI6Ii83NzQxMTA5Mi81MzE3NDc5NjMtNmY0NDljYWYtZTYzNy00NzdlLTkzZWEtZjQ2OTVhMjliNGI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDE3MDI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ5N2M3ZDY2ZDVmMGY2Yjk1ODk2YTE4YTdlMDM2ZmE0NGZlYmZkYjdjNjE1ZjlmNTY0ZWRlNmQ0MGY4ZTVlZDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.QCed3_xDKu4qJJpFb-EKAOUiwk1xyTgRD6n-3h1tWUA)Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 10+
- Guzzle 7.10+
- E\*TRADE API keys
- Configured Laravel cache driver

Installation
------------

[](#installation)

Install via Composer:

```
composer require kevinrider/laravel-etrade
```

Publish the config file:

```
php artisan vendor:publish --provider="KevinRider\LaravelEtrade\LaravelEtradeServiceProvider"
```

You should consider locking to a specific laravel-etrade version in `composer.json`. For example, in the `composer.json` require section:

```
{
  "require": {
          "kevinrider/laravel-etrade": "v1.0.0"
  }
}

```

will prevent updates and lock to version 1.0.0. If newer versions are released you can test and then release to your Laravel app as needed.

Configuration
-------------

[](#configuration)

The package is configured in `config/laravel-etrade.php`. Most likely the only variable you will change is setting `production` to `true` when you are ready to use your live E\*TRADE account.

- `app_key` and `app_secret`: E\*TRADE application credentials
- `oauth_request_token_key`: cache key for the OAuth request token
- `oauth_access_token_key`: cache key for the OAuth access token
- `inactive_buffer_in_seconds`: auto-renew token buffer
- `production`: `true` for live, `false` for sandbox

The default `app_key` and `app_secret` config pulls from env. This means you can either set them in your `.env` file:

```
ETRADE_APP_KEY=your_key
ETRADE_APP_SECRET=your_secret
```

**OR**

Copy the following into your `.bashrc` (assuming you're using bash), updating as needed for your specific config:

```
export ETRADE_APP_KEY=your_key
export ETRADE_APP_SECRET=your_secret
```

Don't forget to apply the bash profile changes:

```
source ~/.bashrc # (or similar depending on your shell)
```

When approved by E\*TRADE for API access, you will be issued two sets of keys, one for production and one for the sandbox. You must copy your sandbox key and secret into `ETRADE_APP_KEY` and `ETRADE_APP_SECRET` when using the sandbox and vice versa when switching to production.

Authorization flow
------------------

[](#authorization-flow)

The flow uses "out of band" (OOB) verification:

1. Call `getAuthorizationUrl()` to retrieve the login URL.
2. Log in to E\*TRADE, approve the app, and copy the verifier code.
3. Paste the verifier code into `requestAccessTokenAndStore()`.
4. The access token is stored in cache and used automatically.

Usage
-----

[](#usage)

### EtradeApiClient

[](#etradeapiclient)

Resolve the client through the Laravel container:

```
use KevinRider\LaravelEtrade\EtradeApiClient;
use KevinRider\LaravelEtrade\Dtos\Request\GetQuotesRequestDTO;

$client = app(EtradeApiClient::class);

$authUrl = $client->getAuthorizationUrl();
// Direct the user to $authUrl->authorizationUrl and collect the verifier
$client->requestAccessTokenAndStore($verifierCode);

$quotes = $client->getQuotes(new GetQuotesRequestDTO([
    'symbols' => ['AAPL', 'MSFT'],
]));
```

### EtradeOrderBuilder

[](#etradeorderbuilder)

Use the builder to generate preview/place order request DTOs:

```
use KevinRider\LaravelEtrade\EtradeOrderBuilder;

$builder = EtradeOrderBuilder::forAccount($accountIdKey)
    ->orderType('EQ')
    ->withSymbol('AAPL')
    ->gfd()
    ->limit(185.00)
    ->addEquity('BUY', 1);

$previewRequest = $builder->buildPreviewRequest();
```

### Exceptions

[](#exceptions)

- `EtradeAuthException`: thrown when tokens are missing or expired in cache.
- `EtradeApiException`: thrown on non-2XX responses, includes status and headers.
- `Illuminate\Validation\ValidationException`: thrown on incomplete/invalid request params.
- `InvalidArgumentException`: thrown on incomplete/invalid orders.

Examples and demo
-----------------

[](#examples-and-demo)

`LaravelEtradeDemo` serves as a demonstration of all E\*TRADE API endpoints and as `EtradeApiClient` and `EtradeOrderBuilder` example code in a variety of scenarios and trade types.

Run the interactive demo via artisan:

```
php artisan laravel-etrade:demo
```

It walks through OAuth, read-only endpoints, and order flows with warnings before any destructive actions or placing any orders.

**Be careful!** `LaravelEtradeDemo` will place live orders if production mode is used!

Testing
-------

[](#testing)

If you installed with dev dependencies, the following will run all tests:

```
composer test
```

Further reading
---------------

[](#further-reading)

- [phpetrade](https://github.com/kevinrider/phpetrade): Additional notes and FAQ that may be useful.
- [E\*TRADE Developer](https://developer.etrade.com/): E\*TRADE API documentation

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance71

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

183d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77411092?v=4)[Kevin Rider](/maintainers/kevinrider)[@kevinrider](https://github.com/kevinrider)

---

Top Contributors

[![kevinrider](https://avatars.githubusercontent.com/u/77411092?v=4)](https://github.com/kevinrider "kevinrider (244 commits)")

---

Tags

algorithmic-tradingalgotradingapi-clientetradeetrade-apilaravellaravel-packagemarketoptionsoptions-tradingphpstockstock-tradingtrading

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kevinrider-laravel-etrade/health.svg)

```
[![Health](https://phpackages.com/badges/kevinrider-laravel-etrade/health.svg)](https://phpackages.com/packages/kevinrider-laravel-etrade)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
