PHP code example of marketdataapp / sdk-php

1. Go to this page and download the library: Download marketdataapp/sdk-php 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/ */

    

marketdataapp / sdk-php example snippets


$client = new MarketDataApp\Client('your_api_token');

// Indices
$quote = $client->indices->quote('VIX');
$quotes = $client->indices->quotes(['VIX', 'DJI']);
$candles = $client->indices->candles(
    symbol: "VIX",
    from: '2022-09-01',
    to: '2022-09-05',
    resolution: 'D'
);

// Stocks
$candles = $client->stocks->candles('AAPL');
$bulk_candles = $client->stocks->bulkCandles(['AAPL, MSFT']);
$quote = $client->stocks->quote('AAPL');
$quotes = $client->stocks->quotes(['AAPL', 'MSFT']);
$bulk_quotes = $client->stocks->bulk_quotes(['AAPL', 'MSFT']);
$earnings = $client->stocks->earnings(symbol: 'AAPL', from: '2023-01-01');
$news = $client->stocks->news(symbol: 'AAPL', from: '2023-01-01');

// Markets
$status = $client->markets->status(date: '2023-01-01');

// Mutual Funds
$candles = $client->mutual_funds->candles(
    symbol: 'VFINX',
    from: '2022-09-01',
    to: '2022-09-05',
    resolution: 'D'
);

// Options
$expirations = $client->options->expirations('AAPL');
$lookup = $client->options->lookup('AAPL 7/28/23 $200 Call');
$strikes = $client->options->strikes(
    symbol: 'AAPL',
    expiration: '2023-01-20',
    date: '2023-01-03',
);
$option_chain = $client->options->option_chain(
    symbol: 'AAPL',
    expiration: '2025-01-17',
    side: Side::CALL,
);
$quotes = $client->options->quotes('AAPL250117C00150000');

// Utilities
$status = $client->utilities->api_status();
$headers = $client->utilities->headers();
bash
composer