Quote
extends ResponseBase
in package
Class Quote
Represents a stock quote and handles the response parsing for stock quote data.
Table of Contents
Properties
- $ask : float
- The ask price of the stock.
- $ask_size : int
- The number of shares offered at the ask price.
- $bid : float
- The bid price.
- $bid_size : int
- The number of shares that may be sold at the bid price.
- $change : float|null
- The difference in price in dollars (or the security's currency if different from dollars) compared to the closing price of the previous day.
- $change_percent : float|null
- The difference in price in percent, expressed as a decimal, compared to the closing price of the previous day.
- $fifty_two_week_high : float|null
- The 52-week high for the stock. This parameter is omitted unless the optional 52week request parameter is set to true.
- $fifty_two_week_low : float|null
- The 52-week low for the stock. This parameter is omitted unless the optional 52week request parameter is set to true.
- $last : float
- The last price the stock traded at.
- $mid : float
- The midpoint price between the ask and the bid.
- $status : string
- The status of the response. Will always be "ok" when there is data for the symbol requested.
- $symbol : string
- The symbol of the stock.
- $updated : Carbon
- The date/time of the current stock quote.
- $volume : int
- The number of shares traded during the current session.
- $csv : string
- $html : string
Methods
- __construct() : mixed
- Constructs a new Quote object and parses the response data.
- 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.
Properties
$ask
The ask price of the stock.
public
float
$ask
$ask_size
The number of shares offered at the ask price.
public
int
$ask_size
$bid
The bid price.
public
float
$bid
$bid_size
The number of shares that may be sold at the bid price.
public
int
$bid_size
$change
The difference in price in dollars (or the security's currency if different from dollars) compared to the closing price of the previous day.
public
float|null
$change
$change_percent
The difference in price in percent, expressed as a decimal, compared to the closing price of the previous day.
public
float|null
$change_percent
For example, a 30% change will be represented as 0.30.
$fifty_two_week_high
The 52-week high for the stock. This parameter is omitted unless the optional 52week request parameter is set to true.
public
float|null
$fifty_two_week_high
= null
$fifty_two_week_low
The 52-week low for the stock. This parameter is omitted unless the optional 52week request parameter is set to true.
public
float|null
$fifty_two_week_low
= null
$last
The last price the stock traded at.
public
float
$last
$mid
The midpoint price between the ask and the bid.
public
float
$mid
$status
The status of the response. Will always be "ok" when there is data for the symbol requested.
public
string
$status
$symbol
The symbol of the stock.
public
string
$symbol
$updated
The date/time of the current stock quote.
public
Carbon
$updated
$volume
The number of shares traded during the current session.
public
int
$volume
$csv
protected
string
$csv
The CSV content of the response.
$html
protected
string
$html
The HTML content of the response.
Methods
__construct()
Constructs a new Quote object and parses the response data.
public
__construct(object $response) : mixed
Parameters
- $response : object
-
The raw response object to be parsed.
getCsv()
Get the CSV content of the response.
public
getCsv() : string
Return values
string —The CSV content.
getHtml()
Get the HTML content of the response.
public
getHtml() : string
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.