Skip to content

Commit

Permalink
Fix null in dto
Browse files Browse the repository at this point in the history
  • Loading branch information
marekskopal committed Nov 29, 2024
1 parent 3f3845f commit c8c7ea2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Dto/Fundamentals/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public static function fromJson(string $json): self
* quarterly_earnings_growth_yoy: float|null,
* },
* balance_sheet: array{
* total_cash_mrq: int,
* total_cash_mrq: int|null,
* total_cash_per_share_mrq: float|null,
* total_debt_mrq: int,
* total_debt_mrq: int|null,
* total_debt_to_equity_mrq: float|null,
* current_ratio_mrq: float|null,
* book_value_per_share_mrq: float|null,
Expand Down
8 changes: 4 additions & 4 deletions src/Dto/Fundamentals/StatisticsBalanceSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
readonly class StatisticsBalanceSheet
{
public function __construct(
public int $totalCashMrq,
public ?int $totalCashMrq,
public ?float $totalCashPerShareMrq,
public int $totalDebtMrq,
public ?int $totalDebtMrq,
public ?float $totalDebtToEquityMrq,
public ?float $currentRatioMrq,
public ?float $bookValuePerShareMrq,
Expand All @@ -18,9 +18,9 @@ public function __construct(

/**
* @param array{
* total_cash_mrq: int,
* total_cash_mrq: int|null,
* total_cash_per_share_mrq: float|null,
* total_debt_mrq: int,
* total_debt_mrq: int|null,
* total_debt_to_equity_mrq: float|null,
* current_ratio_mrq: float|null,
* book_value_per_share_mrq: float|null,
Expand Down
4 changes: 2 additions & 2 deletions src/Dto/Fundamentals/StatisticsFinancials.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function __construct(
* quarterly_earnings_growth_yoy: float|null,
* },
* balance_sheet: array{
* total_cash_mrq: int,
* total_cash_mrq: int|null,
* total_cash_per_share_mrq: float|null,
* total_debt_mrq: int,
* total_debt_mrq: int|null,
* total_debt_to_equity_mrq: float|null,
* current_ratio_mrq: float|null,
* book_value_per_share_mrq: float|null,
Expand Down
4 changes: 2 additions & 2 deletions src/Dto/Fundamentals/StatisticsStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function __construct(
* quarterly_earnings_growth_yoy: float|null,
* },
* balance_sheet: array{
* total_cash_mrq: int,
* total_cash_mrq: int|null,
* total_cash_per_share_mrq: float|null,
* total_debt_mrq: int,
* total_debt_mrq: int|null,
* total_debt_to_equity_mrq: float|null,
* current_ratio_mrq: float|null,
* book_value_per_share_mrq: float|null,
Expand Down
4 changes: 2 additions & 2 deletions tests/Api/FundamentalsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ public function testEarnings(): void

public function testStatistics(): void
{
$fundamentals = new Fundamentals(ClientFixture::createDemo());
$fundamentals = new Fundamentals(ClientFixture::createWithResponse('statistics.json'));

$this->assertInstanceOf(
Statistics::class,
$fundamentals->statistics('AAPL'),
$fundamentals->statistics('TSM'),
);
}

Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Response/statistics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"meta":{"symbol":"TSM","name":"Taiwan Semiconductor Manufacturing Co Ltd","currency":"USD","exchange":"NYSE","mic_code":"XNYS","exchange_timezone":"America/New_York"},"statistics":{"valuations_metrics":{"market_capitalization":953495257088,"enterprise_value":112485253434,"trailing_pe":29.55627,"forward_pe":22.752476,"peg_ratio":22.752476,"price_to_sales_ttm":0.35962284,"price_to_book_mrq":1.194635,"enterprise_to_revenue":1.37,"enterprise_to_ebitda":2.02},"financials":{"fiscal_year_ends":"2023-12-31","most_recent_quarter":"2024-09-30","gross_margin":0.5783198980639522,"profit_margin":0.39123002,"operating_margin":0.47487998,"return_on_assets_ttm":0.12409,"return_on_equity_ttm":0.28027,"income_statement":{"revenue_ttm":2161735800000,"revenue_per_share_ttm":63.906876,"quarterly_revenue_growth":0.39,"gross_profit_ttm":1175110600000,"ebitda":1693781958000,"net_income_to_common_ttm":851740000000,"diluted_eps_ttm":6.22,"quarterly_earnings_growth_yoy":0.542},"balance_sheet":{"total_cash_mrq":null,"total_cash_per_share_mrq":83.601,"total_debt_mrq":null,"total_debt_to_equity_mrq":24.081,"current_ratio_mrq":2.567,"book_value_per_share_mrq":153.888},"cash_flow":{"operating_cash_flow_ttm":1465315400000,"levered_free_cash_flow_ttm":851740000000}},"stock_statistics":{"shares_outstanding":5186549760,"float_shares":23355164560,"avg_10_volume":12553421,"avg_90_volume":15353140,"shares_short":28225792,"short_ratio":1.83,"short_percent_of_shares_outstanding":0.0055,"percent_held_by_insiders":0.000010000001,"percent_held_by_institutions":0.16420001},"stock_price_summary":{"fifty_two_week_low":95.25,"fifty_two_week_high":212.6,"fifty_two_week_change":45.61,"beta":1.232,"day_50_ma":188.256,"day_200_ma":162.83266},"dividends_and_splits":{"forward_annual_dividend_rate":2.463356,"forward_annual_dividend_yield":0.013503390434425106,"trailing_annual_dividend_rate":15.5,"trailing_annual_dividend_yield":0.083747566,"5_year_average_dividend_yield":2.06,"payout_ratio":0.344,"dividend_date":"2025-04-10","ex_dividend_date":"2024-12-12","last_split_factor":"1005-for-1000 split","last_split_date":"2009-07-15"}}}

0 comments on commit c8c7ea2

Please sign in to comment.