MarketData SDK

Quotes extends ResponseBase
in package

Represents a collection of stock quotes.

Table of Contents

Properties

$_saved_filename  : string|null
$quotes  : array<string|int, Quote>
Array of Quote objects.
$csv  : string
$html  : string

Methods

__construct()  : mixed
Quotes constructor.
__toString()  : string
Returns a string representation of the quotes collection.
getCsv()  : string
Get the CSV content of the response.
getHtml()  : string
Get the HTML content of the response.
isCsv()  : bool
Check if the response is in CSV format.
isHtml()  : bool
Check if the response is in HTML format.
isJson()  : bool
Check if the response is in JSON format.
saveToFile()  : string
Save CSV/HTML content to a file.
extractQuoteAtIndex()  : object
Extract quote data at a specific index from the multi-symbol response.

Properties

$_saved_filename

public string|null $_saved_filename = null

The filename where the response was saved (if filename parameter was used).

$quotes

Array of Quote objects.

public array<string|int, Quote> $quotes

$csv

protected string $csv

The CSV content of the response.

$html

protected string $html

The HTML content of the response.

Methods

__construct()

Quotes constructor.

public __construct(object $response) : mixed

Parses a multi-symbol quote response where each field contains an array of values, one per symbol. Creates individual Quote objects for each symbol.

Parameters
$response : object

The raw API response object containing arrays for each field.

__toString()

Returns a string representation of the quotes collection.

public __toString() : string
Return values
string

Human-readable quotes summary.

getCsv()

Get the CSV content of the response.

public getCsv() : string
Tags
throws
InvalidArgumentException

If the response is not in CSV format.

Return values
string

The CSV content.

getHtml()

Get the HTML content of the response.

public getHtml() : string
Tags
throws
InvalidArgumentException

If the response is not in HTML format.

Return values
string

The HTML content.

isCsv()

Check if the response is in CSV format.

public isCsv() : bool
Return values
bool

True if the response is in CSV format, false otherwise.

isHtml()

Check if the response is in HTML format.

public isHtml() : bool
Return values
bool

True if the response is in HTML format, false otherwise.

isJson()

Check if the response is in JSON format.

public isJson() : bool
Return values
bool

True if the response is in JSON format, false otherwise.

saveToFile()

Save CSV/HTML content to a file.

public saveToFile(string $filename) : string
Parameters
$filename : string

The file path to save to.

Tags
throws
InvalidArgumentException

If filename is invalid (wrong extension, etc.).

throws
RuntimeException

If file writing fails.

Return values
string

The absolute path of the saved file.

extractQuoteAtIndex()

Extract quote data at a specific index from the multi-symbol response.

private extractQuoteAtIndex(object $response, int $index, bool $isHumanReadable) : object

Creates a response object that looks like a single-symbol response by extracting values at the given index from each array field.

Parameters
$response : object

The full multi-symbol response.

$index : int

The index of the symbol to extract.

$isHumanReadable : bool

Whether the response uses human-readable keys.

Return values
object

A response object formatted for a single symbol.


        
On this page

Search results