Markets
in package
uses
UniversalParameters
Markets class for handling market-related API endpoints.
Table of Contents
Constants
- BASE_URL = "v1/markets/"
Properties
Methods
- __construct() : mixed
- Markets constructor.
- status() : Statuses
- Get the market status for a specific country and date range.
- 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/markets/"
The base URL for market endpoints.
Properties
$client
private
Client
$client
The Market Data API client instance.
Methods
__construct()
Markets constructor.
public
__construct(Client $client) : mixed
Parameters
- $client : Client
-
The Market Data API client instance.
status()
Get the market status for a specific country and date range.
public
status([string $country = "US" ][, string|null $date = null ][, string|null $from = null ][, string|null $to = null ][, int|null $countback = null ][, Parameters|null $parameters = null ]) : Statuses
Get the past, present, or future status for a stock market. The endpoint will respond with "open" for trading days or "closed" for weekends or market holidays.
Parameters
- $country : string = "US"
-
The country. Use the two-digit ISO 3166 country code. If no country is specified, US will be assumed. Only countries that Market Data supports for stock price data are available (currently only the United States).
- $date : string|null = null
-
Consult whether the market was open or closed on the specified date. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
- $from : string|null = null
-
The earliest date (inclusive). If you use countback, from is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
- $to : string|null = null
-
The last date (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
- $countback : int|null = null
-
Countback will fetch a number of dates before to If you use from, countback is not required.
- $parameters : Parameters|null = null
-
Universal parameters for all methods (such as format).
Tags
Return values
Statusesexecute()
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.