MarketData SDK

Parameters
in package
implements Stringable

Represents universal parameters for API requests.

Supported REST API universal parameters:

  • format: Response format (json, csv, html)
  • human: Human-readable values
  • mode: Data feed mode (live, cached, delayed)
  • maxage: Cache freshness threshold (with mode=cached)
  • dateformat: Date format for CSV/HTML
  • columns: Column selection for CSV/HTML
  • headers: Include headers in CSV/HTML

Intentionally unsupported (by design):

  • token: SDK uses Authorization header only
  • limit/offset: SDK uses concurrent parallel requests instead

Table of Contents

Interfaces

Stringable

Properties

$add_headers  : bool|null
$columns  : array<string|int, mixed>|null
$date_format  : DateFormat|null
$filename  : string|null
$format  : Format
$maxage  : int|null
Maximum acceptable age for cached data in seconds.
$mode  : Mode|null
$use_human_readable  : bool|null

Methods

__construct()  : mixed
Parameters constructor.
__toString()  : string
Returns a string representation of the parameters.

Properties

$add_headers

public bool|null $add_headers = null

$columns

public array<string|int, mixed>|null $columns = null

$maxage

Maximum acceptable age for cached data in seconds.

public int|null $maxage = null

Converted from int, DateInterval, or CarbonInterval input.

$use_human_readable

public bool|null $use_human_readable = null

Methods

__construct()

Parameters constructor.

public __construct([Format $format = Format::JSON ][, bool|null $use_human_readable = null ][, Mode|null $mode = null ][, int|DateInterval|CarbonInterval|null $maxage = null ][, DateFormat|null $date_format = null ][, array<string|int, mixed>|null $columns = null ][, bool|null $add_headers = null ][, string|null $filename = null ]) : mixed
Parameters
$format : Format = Format::JSON

The format of the response. Defaults to JSON.

$use_human_readable : bool|null = null

Whether to use human-readable format for values. Defaults to null.

$mode : Mode|null = null

The data feed mode to use. Defaults to null.

$maxage : int|DateInterval|CarbonInterval|null = null

Maximum acceptable age for cached data when using mode=CACHED. Accepts seconds as int, DateInterval, or CarbonInterval. Sets a threshold for data freshness - if no cached data exists within the specified age window, the API returns a 204 empty response with no credit charge. Examples: maxage: 300 (5 min), maxage: new DateInterval('PT5M'), maxage: CarbonInterval::minutes(5). If most recent cache is 180 seconds old and maxage=300, returns 203 with data (1 credit). If maxage=60, returns 204 empty response (0 credits). Useful for implementing fallback logic: first try cached with maxage threshold, then request live data on 204. Can only be used when mode=CACHED. Defaults to null.

$date_format : DateFormat|null = null

The date format for CSV and HTML responses. Can only be used when format=CSV or format=HTML. Defaults to null.

$columns : array<string|int, mixed>|null = null

The columns to include in CSV and HTML responses. Can only be used when format=CSV or format=HTML. Defaults to null.

$add_headers : bool|null = null

Whether to add headers to CSV and HTML responses. Can only be used when format=CSV or format=HTML. Defaults to null.

$filename : string|null = null

File path for CSV and HTML output. Can only be used when format=CSV or format=HTML. Must end with .csv for CSV format or .html for HTML format. Directory must exist. File must not exist. Defaults to null.

Tags
throws
InvalidArgumentException

If date_format is set but format is not CSV or HTML.

throws
InvalidArgumentException

If columns is set but format is not CSV or HTML.

throws
InvalidArgumentException

If add_headers is set but format is not CSV or HTML.

throws
InvalidArgumentException

If filename is set but format is not CSV or HTML.

throws
InvalidArgumentException

If columns contains non-string elements.

throws
InvalidArgumentException

If filename has invalid extension, directory doesn't exist, or file already exists.

throws
InvalidArgumentException

If maxage is set but mode is not CACHED.

__toString()

Returns a string representation of the parameters.

public __toString() : string
Return values
string

Human-readable parameters summary.


        
On this page

Search results