MarketData SDK

Client extends ClientBase
in package

Client class for the Market Data API.

This class provides access to various endpoints of the Market Data API, including indices, stocks, options, markets, mutual funds, and utilities.

Table of Contents

Constants

API_HOST  = "api.marketdata.app"
The host for the Market Data API.
API_URL  = "https://api.marketdata.app/"
The base URL for the Market Data API.

Properties

$indices  : Indices
The index endpoints provided by the Market Data API offer access to both real-time and historical data related to financial indices. These endpoints are designed to cater to a wide range of financial data needs.
$markets  : Markets
The Markets endpoints provide reference and status data about the markets covered by Market Data.
$mutual_funds  : MutualFunds
The mutual funds endpoints offer access to historical pricing data for mutual funds.
$options  : Options
The Market Data API provides a comprehensive suite of options endpoints, designed to cater to various needs around options data. These endpoints are designed to be flexible and robust, supporting both real-time and historical data queries. They accommodate a wide range of optional parameters for detailed data retrieval, making the Market Data API a versatile tool for options traders and financial analysts.
$stocks  : Stocks
Stock endpoints include numerous fundamental, technical, and pricing data.
$utilities  : Utilities
These endpoints are designed to assist with API-related service issues, including checking the online status and uptime.
$guzzle  : Client
$token  : string

Methods

__construct()  : mixed
Constructor for the Client class.
execute()  : object
Execute a single API request.
execute_in_parallel()  : array<string|int, mixed>
Execute multiple API calls in parallel.
setGuzzle()  : void
Set a custom Guzzle client.
async()  : PromiseInterface
Perform an asynchronous API request.
headers()  : array<string|int, mixed>
Generate headers for API requests.

Constants

API_HOST

The host for the Market Data API.

public mixed API_HOST = "api.marketdata.app"

API_URL

The base URL for the Market Data API.

public mixed API_URL = "https://api.marketdata.app/"

Properties

$indices

The index endpoints provided by the Market Data API offer access to both real-time and historical data related to financial indices. These endpoints are designed to cater to a wide range of financial data needs.

public Indices $indices

$markets

The Markets endpoints provide reference and status data about the markets covered by Market Data.

public Markets $markets

$mutual_funds

The mutual funds endpoints offer access to historical pricing data for mutual funds.

public MutualFunds $mutual_funds

$options

The Market Data API provides a comprehensive suite of options endpoints, designed to cater to various needs around options data. These endpoints are designed to be flexible and robust, supporting both real-time and historical data queries. They accommodate a wide range of optional parameters for detailed data retrieval, making the Market Data API a versatile tool for options traders and financial analysts.

public Options $options

$stocks

Stock endpoints include numerous fundamental, technical, and pricing data.

public Stocks $stocks

$utilities

These endpoints are designed to assist with API-related service issues, including checking the online status and uptime.

public Utilities $utilities

$guzzle

protected Client $guzzle

The Guzzle HTTP client instance.

$token

protected string $token

The API token for authentication.

Methods

__construct()

Constructor for the Client class.

public __construct(string $token) : mixed

Initializes all endpoint classes with the provided API token.

Parameters
$token : string

The API token for authentication.

execute()

Execute a single API request.

public execute(string $method[, array<string|int, mixed> $arguments = [] ]) : object
Parameters
$method : string

The API method to call.

$arguments : array<string|int, mixed> = []

The arguments for the API call.

Tags
throws
GuzzleException
throws
ApiException
Return values
object

The API response as an object.

execute_in_parallel()

Execute multiple API calls in parallel.

public execute_in_parallel(array<string|int, mixed> $calls) : array<string|int, mixed>
Parameters
$calls : array<string|int, mixed>

An array of method calls, each containing the method name and arguments.

Tags
throws
Throwable
Return values
array<string|int, mixed>

An array of decoded JSON responses.

setGuzzle()

Set a custom Guzzle client.

public setGuzzle(Client $guzzleClient) : void
Parameters
$guzzleClient : Client

The Guzzle client to use.

async()

Perform an asynchronous API request.

protected async(string $method[, array<string|int, mixed> $arguments = [] ]) : PromiseInterface
Parameters
$method : string

The API method to call.

$arguments : array<string|int, mixed> = []

The arguments for the API call.

Return values
PromiseInterface

headers()

Generate headers for API requests.

protected headers([string $format = 'json' ]) : array<string|int, mixed>
Parameters
$format : string = 'json'

The desired response format (json, csv, or html).

Return values
array<string|int, mixed>

An array of headers.


        
On this page

Search results