Indices
in package
uses
UniversalParameters
Indices class for handling index-related API endpoints.
Table of Contents
Constants
- BASE_URL = "v1/indices/"
Properties
Methods
- __construct() : mixed
- Indices constructor.
- candles() : Candles
- Get historical price candles for an index.
- quote() : Quote
- Get a real-time quote for an index.
- quotes() : Quotes
- Get real-time price quotes for multiple indices by doing parallel requests.
- execute() : object
- Execute a single API request with universal parameters.
- execute_in_parallel() : array<string|int, mixed>
- Execute multiple API requests in parallel with universal parameters.
Constants
BASE_URL
public
string
BASE_URL
= "v1/indices/"
The base URL for index endpoints.
Properties
$client
private
Client
$client
The Market Data API client instance.
Methods
__construct()
Indices constructor.
public
__construct(Client $client) : mixed
Parameters
- $client : Client
-
The Market Data API client instance.
candles()
Get historical price candles for an index.
public
candles(string $symbol, string $from[, string|null $to = null ][, string $resolution = 'D' ][, int|null $countback = null ][, Parameters|null $parameters = null ]) : Candles
Parameters
- $symbol : string
-
The index symbol, without any leading or trailing index identifiers. For example, use DJI do not use $DJI, ^DJI, .DJI, DJI.X, etc.
- $from : string
-
The leftmost candle on a chart (inclusive). If you use countback, to is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
- $to : string|null = null
-
The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
- $resolution : string = 'D'
-
The duration of each candle. Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) Hourly Resolutions: (hourly, H, 1H, 2H, ...) Daily Resolutions: (daily, D, 1D, 2D, ...) Weekly Resolutions: (weekly, W, 1W, 2W, ...) Monthly Resolutions: (monthly, M, 1M, 2M, ...) Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...)
- $countback : int|null = null
-
Will fetch a number of candles before (to the left of) to. If you use from, countback is not required.
- $parameters : Parameters|null = null
-
Universal parameters for all methods (such as format).
Tags
Return values
Candlesquote()
Get a real-time quote for an index.
public
quote(string $symbol[, bool $fifty_two_week = false ][, Parameters|null $parameters = null ]) : Quote
Parameters
- $symbol : string
-
The index symbol, without any leading or trailing index identifiers. For example, use DJI do not use $DJI, ^DJI, .DJI, DJI.X, etc.
- $fifty_two_week : bool = false
-
Enable the output of 52-week high and 52-week low data in the quote output.
- $parameters : Parameters|null = null
-
Universal parameters for all methods (such as format).
Tags
Return values
Quotequotes()
Get real-time price quotes for multiple indices by doing parallel requests.
public
quotes(array<string|int, mixed> $symbols[, bool $fifty_two_week = false ][, Parameters|null $parameters = null ]) : Quotes
Parameters
- $symbols : array<string|int, mixed>
-
The ticker symbols to return in the response.
- $fifty_two_week : bool = false
-
Enable the output of 52-week high and 52-week low data in the quote output.
- $parameters : Parameters|null = null
-
Universal parameters for all methods (such as format).
Tags
Return values
Quotesexecute()
Execute a single API request with universal parameters.
protected
execute(string $method, array<string|int, mixed> $arguments, Parameters|null $parameters) : object
Parameters
- $method : string
-
The API method to call.
- $arguments : array<string|int, mixed>
-
The arguments for the API call.
- $parameters : Parameters|null
-
Optional Parameters object for additional settings.
Return values
object —The API response as an object.
execute_in_parallel()
Execute multiple API requests in parallel with universal parameters.
protected
execute_in_parallel(array<string|int, mixed> $calls[, Parameters|null $parameters = null ]) : array<string|int, mixed>
Parameters
- $calls : array<string|int, mixed>
-
An array of method calls, each containing the method name and arguments.
- $parameters : Parameters|null = null
-
Optional Parameters object for additional settings.
Tags
Return values
array<string|int, mixed> —An array of API responses.