Skip to content

Commit

Permalink
Finish stocks integration test; use PHP 8 class constructor property …
Browse files Browse the repository at this point in the history
…promotion
  • Loading branch information
KerryJones committed Jul 17, 2024
1 parent 866c804 commit ed6cd49
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 425 deletions.
30 changes: 12 additions & 18 deletions src/Endpoints/Responses/Indices/Candle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@
class Candle
{

// Open price.
public string $open;
public function __construct(
// Open price.
public string $open,

// High price.
public float $high;
// High price.
public float $high,

// Low price.
public float $low;
// Low price.
public float $low,

// Close price.
public float $close;
// Close price.
public float $close,

// Candle time (Unix timestamp, UTC). Daily, weekly, monthly, yearly candles are returned without times.
public Carbon $timestamp;

public function __construct(float $open, float $high, float $low, float $close, Carbon $timestamp)
{
$this->open = $open;
$this->high = $high;
$this->low = $low;
$this->close = $close;
$this->timestamp = $timestamp;
// Candle time (Unix timestamp, UTC). Daily, weekly, monthly, yearly candles are returned without times.
public Carbon $timestamp,
) {
}
}
16 changes: 10 additions & 6 deletions src/Endpoints/Responses/Markets/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

class Status
{
public Carbon $date;
public string $status;
public function __construct(Carbon $date, string $status)
{
$this->date = $date;
$this->status = $status;

public function __construct(
// The date.
public Carbon $date,

// The market status. This will always be open or closed or null. Half days or partial trading days are reported
// as open. Requests for days further in the past or further in the future than our data will be returned as
// null.
public string|null $status,
) {
}
}
30 changes: 12 additions & 18 deletions src/Endpoints/Responses/MutualFunds/Candle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@
class Candle
{

// Open price.
public float $open;
public function __construct(
// Open price.
public float $open,

// High price.
public float $high;
// High price.
public float $high,

// Low price.
public float $low;
// Low price.
public float $low,

// Close price.
public float $close;
// Close price.
public float $close,

// Candle time (Unix timestamp, UTC). Daily, weekly, monthly, yearly candles are returned without times.
public Carbon $timestamp;

public function __construct(float $open, float $high, float $low, float $close, Carbon $timestamp)
{
$this->open = $open;
$this->high = $high;
$this->low = $low;
$this->close = $close;
$this->timestamp = $timestamp;
// Candle time (Unix timestamp, UTC). Daily, weekly, monthly, yearly candles are returned without times.
public Carbon $timestamp,
) {
}
}
159 changes: 53 additions & 106 deletions src/Endpoints/Responses/Options/OptionChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,137 +8,84 @@
class OptionChain
{

// The option symbol according to OCC symbology.
public string $option_symbol;

// The ticker symbol of the underlying security.
public string $underlying;
public function __construct(
// The option symbol according to OCC symbology.
public string $option_symbol,

// The option's expiration date in Unix time.
public Carbon $expiration;
// The ticker symbol of the underlying security.
public string $underlying,

// The response will be call or put.
public Side $side;
// The option's expiration date in Unix time.
public Carbon $expiration,

// The exercise price of the option.
public float $strike;
// The response will be call or put.
public Side $side,

// The date the option was first traded.
public Carbon $first_traded;
// The exercise price of the option.
public float $strike,

// The number of days until the option expires.
public int $dte;
// The date the option was first traded.
public Carbon $first_traded,

// The ask price.
public float $ask;
// The number of days until the option expires.
public int $dte,

// The number of contracts offered at the ask price.
public int $ask_size;
// The ask price.
public float $ask,

// The bid price.
public float $bid;
// The number of contracts offered at the ask price.
public int $ask_size,

// The number of contracts offered at the bid price.
public int $bid_size;
// The bid price.
public float $bid,

// The midpoint price between the ask and the bid, also known as the mark price.
public float $mid;
// The number of contracts offered at the bid price.
public int $bid_size,

// The last price negotiated for this option contract at the time of this quote.
public float $last;
// The midpoint price between the ask and the bid, also known as the mark price.
public float $mid,

// The number of contracts negotiated during the trading day at the time of this quote.
public int $volume;
// The last price negotiated for this option contract at the time of this quote.
public float $last,

// The total number of contracts that have not yet been settled at the time of this quote.
public int $open_interest;
// The number of contracts negotiated during the trading day at the time of this quote.
public int $volume,

// The last price of the underlying security at the time of this quote.
public float $underlying_price;
// The total number of contracts that have not yet been settled at the time of this quote.
public int $open_interest,

// Specifies whether the option contract was in the money true or false at the time of this quote.
public bool $in_the_money;
// The last price of the underlying security at the time of this quote.
public float $underlying_price,

// The intrinsic value of the option.
public float $intrinsic_value;
// Specifies whether the option contract was in the money true or false at the time of this quote.
public bool $in_the_money,

// The extrinsic value of the option.
public float $extrinsic_value;
// The intrinsic value of the option.
public float $intrinsic_value,

// The implied volatility of the option.
public float $implied_volatility;
// The extrinsic value of the option.
public float $extrinsic_value,

// The delta of the option.
public float $delta;
// The implied volatility of the option.
public float $implied_volatility,

// The gamma of the option.
public float $gamma;
// The delta of the option.
public float $delta,

// The theta of the option.
public float $theta;
// The gamma of the option.
public float $gamma,

// The vega of the option.
public float $vega;
// The theta of the option.
public float $theta,

// The rho of the option.
public float $rho;
// The vega of the option.
public float $vega,

// The date/time of the quote.
public Carbon $updated;
// The rho of the option.
public float $rho,

public function __construct(
string $option_symbol,
string $underlying,
Carbon $expiration,
Side $side,
float $strike,
Carbon $first_traded,
int $dte,
float $ask,
int $ask_size,
float $bid,
int $bid_size,
float $mid,
float $last,
int $volume,
int $open_interest,
float $underlying_price,
bool $in_the_money,
float $intrinsic_value,
float $extrinsic_value,
float $implied_volatility,
float $delta,
float $gamma,
float $theta,
float $vega,
float $rho,
Carbon $updated,
// The date/time of the quote.
public Carbon $updated,
) {
$this->option_symbol = $option_symbol;
$this->underlying = $underlying;
$this->expiration = $expiration;
$this->side = $side;
$this->strike = $strike;
$this->first_traded = $first_traded;
$this->dte = $dte;
$this->ask = $ask;
$this->ask_size = $ask_size;
$this->bid = $bid;
$this->bid_size = $bid_size;
$this->mid = $mid;
$this->last = $last;
$this->volume = $volume;
$this->open_interest = $open_interest;
$this->underlying_price = $underlying_price;
$this->in_the_money = $in_the_money;
$this->intrinsic_value = $intrinsic_value;
$this->extrinsic_value = $extrinsic_value;
$this->implied_volatility = $implied_volatility;
$this->delta = $delta;
$this->gamma = $gamma;
$this->theta = $theta;
$this->vega = $vega;
$this->rho = $rho;
$this->updated = $updated;
}
}
Loading

0 comments on commit ed6cd49

Please sign in to comment.