PHP code example of kevinrider / laravel-etrade

1. Go to this page and download the library: Download kevinrider/laravel-etrade library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kevinrider / laravel-etrade example snippets


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'],
]));

use KevinRider\LaravelEtrade\EtradeOrderBuilder;

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

$previewRequest = $builder->buildPreviewRequest();
bash
php artisan vendor:publish --provider="KevinRider\LaravelEtrade\LaravelEtradeServiceProvider"
bash
php artisan laravel-etrade:demo