diff --git a/CHANGELOG.md b/CHANGELOG.md index c5fbe2a..a76749f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.4.1-alpha + +- Changed all Carbon date endpoints to receive a string rather than a Carbon instance. + ## v0.4.0-alpha - Completed remaining endpoints: diff --git a/README.md b/README.md index eeb5999..49c7253 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ $client = new MarketDataApp\Client('your_api_token'); $quote = $client->indices->quote('DJI'); $candles = $client->indices->candles( symbol: "DJI", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -37,17 +37,17 @@ $bulk_candles = $client->stocks->bulkCandles(['AAPL, MSFT']); $quote = $client->stocks->quote('AAPL'); $quotes = $client->stocks->quotes(['AAPL', 'NFLX']); $bulk_quotes = $client->stocks->bulk_quotes(['AAPL', 'NFLX']); -$earnings = $client->stocks->earnings(symbol: 'AAPL', from: Carbon::parse('2023-01-01')); -$news = $client->stocks->news(symbol: 'AAPL', from: Carbon::parse('2023-01-01')); +$earnings = $client->stocks->earnings(symbol: 'AAPL', from: '2023-01-01'); +$news = $client->stocks->news(symbol: 'AAPL', from: '2023-01-01'); // Markets -$status = $client->markets->status(date: Carbon::parse('2023-01-01')); +$status = $client->markets->status(date: '2023-01-01'); // Mutual Funds $candles = $client->mutual_funds->candles( symbol: 'VFINX', - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -56,12 +56,12 @@ $expirations = $client->options->expirations('AAPL'); $lookup = $client->options->lookup('AAPL 7/28/23 $200 Call'); $strikes = $client->options->strikes( symbol: 'AAPL', - expiration: Carbon::parse('2023-01-20'), - date: Carbon::parse('2023-01-03'), + expiration: '2023-01-20', + date: '2023-01-03', ); $option_chain = $client->options->option_chain( symbol: 'AAPL', - expiration: Carbon::parse('2025-01-17'), + expiration: '2025-01-17', side: Side::CALL, ); $quotes = $client->options->quotes('AAPL250117C00150000'); diff --git a/src/Endpoints/Indices.php b/src/Endpoints/Indices.php index 7ba0141..0ff4aea 100644 --- a/src/Endpoints/Indices.php +++ b/src/Endpoints/Indices.php @@ -2,7 +2,6 @@ namespace MarketDataApp\Endpoints; -use Carbon\Carbon; use GuzzleHttp\Exception\GuzzleException; use MarketDataApp\Client; use MarketDataApp\Endpoints\Responses\Indices\Candles; @@ -38,8 +37,12 @@ public function quote(string $symbol, bool $fifty_two_week = false): Quote * @param string $symbol The index symbol, without any leading or trailing index identifiers. For example, use DJI * do not use $DJI, ^DJI, .DJI, DJI.X, etc. * - * @param Carbon $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. - * @param Carbon|null $to The rightmost candle on a chart (inclusive). + * @param string $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. + * Accepted timestamp inputs: ISO 8601, unix, spreadsheet. + * + * @param string|null $to The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, + * spreadsheet. + * * @param string $resolution The duration of each candle. * Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) Hourly Resolutions: (hourly, H, 1H, 2H, ...) * Daily Resolutions: (daily, D, 1D, 2D, ...) @@ -51,12 +54,13 @@ public function quote(string $symbol, bool $fifty_two_week = false): Quote * is not required. * * @return Candles - * @throws GuzzleException|ApiException + * @throws ApiException + * @throws GuzzleException */ public function candles( string $symbol, - Carbon $from, - Carbon $to = null, + string $from, + string $to = null, string $resolution = 'D', int $countback = null ): Candles { diff --git a/src/Endpoints/Markets.php b/src/Endpoints/Markets.php index dc4dff4..9c9c8af 100644 --- a/src/Endpoints/Markets.php +++ b/src/Endpoints/Markets.php @@ -2,7 +2,6 @@ namespace MarketDataApp\Endpoints; -use Carbon\Carbon; use GuzzleHttp\Exception\GuzzleException; use MarketDataApp\Client; use MarketDataApp\Endpoints\Responses\Markets\Statuses; @@ -23,23 +22,28 @@ public function __construct($client) * Get the past, present, or future status for a stock market. The endpoint will respond with "open" for trading * days or "closed" for weekends or market holidays. * - * @param string $country The country. Use the two digit ISO 3166 country code. If no country is specified, US will + * @param string $country The country. Use the two-digit ISO 3166 country code. If no country is specified, US will * be assumed. Only countries that Market Data supports for stock price data are available (currently only the * United States). * - * @param Carbon|null $date Consult whether the market was open or closed on the specified date. - * @param Carbon|null $from The earliest date (inclusive). If you use countback, from is not required. - * @param Carbon|null $to The last date (inclusive). + * @param string|null $date Consult whether the market was open or closed on the specified date. Accepted timestamp + * inputs: ISO 8601, unix, spreadsheet. + * + * @param string|null $from The earliest date (inclusive). If you use countback, from is not required. Accepted + * timestamp inputs: ISO 8601, unix, spreadsheet. + * + * @param string|null $to The last date (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet. + * * @param int|null $countback Countback will fetch a number of dates before to If you use from, countback is not * required. - * @return Statuses + * * @throws GuzzleException|ApiException */ public function status( string $country = "US", - Carbon $date = null, - Carbon $from = null, - Carbon $to = null, + string $date = null, + string $from = null, + string $to = null, int $countback = null ): Statuses { // Stub diff --git a/src/Endpoints/MutualFunds.php b/src/Endpoints/MutualFunds.php index 846f3a5..567681a 100644 --- a/src/Endpoints/MutualFunds.php +++ b/src/Endpoints/MutualFunds.php @@ -2,7 +2,6 @@ namespace MarketDataApp\Endpoints; -use Carbon\Carbon; use GuzzleHttp\Exception\GuzzleException; use MarketDataApp\Client; use MarketDataApp\Endpoints\Responses\MutualFunds\Candles; @@ -23,14 +22,20 @@ public function __construct($client) * Get historical price candles for a mutual fund. * * @param string $symbol The mutual fund's ticker symbol. - * @param Carbon $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. - * @param Carbon|null $to The rightmost candle on a chart (inclusive). + * + * @param string $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. + * Accepted timestamp inputs: ISO 8601, unix, spreadsheet. + * + * @param string|null $to The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, + * spreadsheet. + * * @param string $resolution The duration of each candle. - * Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) Hourly Resolutions: (hourly, H, 1H, 2H, ...) - * Daily Resolutions: (daily, D, 1D, 2D, ...) - * Weekly Resolutions: (weekly, W, 1W, 2W, ...) - * Monthly Resolutions: (monthly, M, 1M, 2M, ...) - * Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...) + * - Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) + * - Hourly Resolutions: (hourly, H, 1H, 2H, ...) + * - Daily Resolutions: (daily, D, 1D, 2D, ...) + * - Weekly Resolutions: (weekly, W, 1W, 2W, ...) + * - Monthly Resolutions: (monthly, M, 1M, 2M, ...) + * - Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...) * * @param int|null $countback Will fetch a number of candles before (to the left of) to. If you use from, countback * is not required. @@ -40,8 +45,8 @@ public function __construct($client) */ public function candles( string $symbol, - Carbon $from, - Carbon $to = null, + string $from, + string $to = null, string $resolution = 'D', int $countback = null, ): Candles { diff --git a/src/Endpoints/Options.php b/src/Endpoints/Options.php index 1fd9bb4..ad34446 100644 --- a/src/Endpoints/Options.php +++ b/src/Endpoints/Options.php @@ -2,7 +2,6 @@ namespace MarketDataApp\Endpoints; -use Carbon\Carbon; use GuzzleHttp\Exception\GuzzleException; use MarketDataApp\Client; use MarketDataApp\Endpoints\Responses\Options\Expirations; @@ -35,13 +34,13 @@ public function __construct($client) * @param int|null $strike Limit the lookup of expiration dates to the strike provided. This will cause the endpoint to * only return expiration dates that include this strike. * - * @param Carbon|null $date Use to lookup a historical list of expiration dates from a specific previous trading + * @param string|null $date Use to lookup a historical list of expiration dates from a specific previous trading * day. If date is omitted the expiration dates will be from the current trading day during market hours or from the - * last trading day when the market is closed. + * last trading day when the market is closed. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * * @throws ApiException|GuzzleException */ - public function expirations(string $symbol, int $strike = null, Carbon $date = null): Expirations + public function expirations(string $symbol, int $strike = null, string $date = null): Expirations { // Stub return new Expirations($this->client->execute(self::BASE_URL . "options/expirations/$symbol", @@ -72,15 +71,15 @@ public function lookup(string $input): Lookup * * @param string $symbol The underlying ticker symbol for the options chain you wish to lookup. * - * @param Carbon|null $expiration Limit the lookup of strikes to options that expire on a specific expiration date. + * @param string|null $expiration Limit the lookup of strikes to options that expire on a specific expiration date. * - * @param Carbon|null $date Use to lookup a historical list of strikes from a specific previous trading day. If date + * @param string|null $date Use to lookup a historical list of strikes from a specific previous trading day. If date * is omitted the expiration dates will be from the current trading day during market hours or from the last trading - * day when the market is closed. + * day when the market is closed. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * * @throws ApiException|GuzzleException */ - public function strikes(string $symbol, Carbon $expiration = null, Carbon $date = null): Strikes + public function strikes(string $symbol, string $expiration = null, string $date = null): Strikes { // Stub return new Strikes($this->client->execute(self::BASE_URL . "options/strikes/$symbol", @@ -97,13 +96,15 @@ public function strikes(string $symbol, Carbon $expiration = null, Carbon $date * all expirations. * * @param string $symbol The ticker symbol of the underlying asset. - * @param Carbon|null $date Use to lookup a historical end of day options chain from a specific trading day. If no + * + * @param string|null $date Use to lookup a historical end of day options chain from a specific trading day. If no * date is specified the chain will be the most current chain available during market hours. When the market is - * closed the chain will be from the last trading day. + * closed the chain will be from the last trading day. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * - * @param Carbon|Expiration $expiration + * @param string|Expiration $expiration * - Limits the option chain to a specific expiration date. Accepted date inputs: ISO 8601, unix, spreadsheet. This - * parameter is only required if requesting a quote along with the chain. + * parameter is only required if requesting a quote along with the chain. Accepted timestamp inputs: ISO 8601, unix, + * spreadsheet. * * - If omitted the next monthly expiration for real-time quotes or the next monthly expiration relative to the date * parameter for historical quotes will be returned. @@ -114,11 +115,11 @@ public function strikes(string $symbol, Carbon $expiration = null, Carbon $date * consume your requests very quickly. The full SPX option chain has more than 20,000 contracts. A request is * consumed for each contact you request with a price in the option chain. * - * @param Carbon|null $from Limit the option chain to expiration dates after from (inclusive). Should be combined - * with to create a range. + * @param string|null $from Limit the option chain to expiration dates after from (inclusive). Should be combined + * with to create a range. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * - * @param Carbon|null $to Limit the option chain to expiration dates before to (not inclusive). Should be combined - * with from to create a range. + * @param string|null $to Limit the option chain to expiration dates before to (not inclusive). Should be combined + * with from to create a range. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * * @param int|null $month Limit the option chain to options that expire in a specific month (1-12). * @@ -202,10 +203,10 @@ public function strikes(string $symbol, Carbon $expiration = null, Carbon $date */ public function option_chain( string $symbol, - Carbon $date = null, - Carbon|Expiration $expiration = Expiration::ALL, - Carbon $from = null, - Carbon $to = null, + string $date = null, + string|Expiration $expiration = Expiration::ALL, + string $from = null, + string $to = null, int $month = null, int $year = null, bool $weekly = true, @@ -261,21 +262,23 @@ public function option_chain( * @param string $option_symbol The option symbol (as defined by the OCC) for the option you wish to lookup. Use the * current OCC option symbol format, even for historic options that quoted before the format change in 2010. * - * @param Carbon|null $date Use to lookup a historical end of day quote from a specific trading day. If no date is + * @param string|null $date Use to lookup a historical end of day quote from a specific trading day. If no date is * specified the quote will be the most current price available during market hours. When the market is closed the - * quote will be from the last trading day. + * quote will be from the last trading day. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * - * @param Carbon|null $from Use to lookup a series of end of day quotes. From is the oldest (leftmost) date to + * @param string|null $from Use to lookup a series of end of day quotes. From is the oldest (leftmost) date to * return (inclusive). If from/to is not specified the quote will be the most current price available during market - * hours. When the market is closed the quote will be from the last trading day. + * hours. When the market is closed the quote will be from the last trading day. Accepted timestamp inputs: ISO + * 8601, unix, spreadsheet. * - * @param Carbon|null $to Use to lookup a series of end of day quotes. From is the newest (rightmost) date to return + * @param string|null $to Use to lookup a series of end of day quotes. From is the newest (rightmost) date to return * (exclusive). If from/to is not specified the quote will be the most current price available during market hours. - * When the market is closed the quote will be from the last trading day. + * When the market is closed the quote will be from the last trading day. Accepted timestamp inputs: ISO 8601, unix, + * spreadsheet. * * @throws ApiException|GuzzleException */ - public function quotes(string $option_symbol, Carbon $date = null, Carbon $from = null, Carbon $to = null): Quotes + public function quotes(string $option_symbol, string $date = null, string $from = null, string $to = null): Quotes { // Stub return new Quotes($this->client->execute(self::BASE_URL . "options/quotes/$option_symbol/", diff --git a/src/Endpoints/Stocks.php b/src/Endpoints/Stocks.php index 78f8174..848bd79 100644 --- a/src/Endpoints/Stocks.php +++ b/src/Endpoints/Stocks.php @@ -2,7 +2,6 @@ namespace MarketDataApp\Endpoints; -use Carbon\Carbon; use GuzzleHttp\Exception\GuzzleException; use MarketDataApp\Client; use MarketDataApp\Endpoints\Responses\Stocks\BulkCandles; @@ -40,11 +39,11 @@ public function __construct($client) * @param bool $snapshot Returns candles for all available symbols for the date indicated. The symbols parameter can * be omitted if snapshot is set to true. * - * @param Carbon|null $date The date of the candles to be returned. If no date is specified, during market hours the + * @param string|null $date The date of the candles to be returned. If no date is specified, during market hours the * candles returned will be from the current session. If the market is closed the candles will be from the most - * recent session. + * recent session. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. * - * @param bool $adjustsplits Adjust historical data for historical splits and reverse splits. Market Data uses + * @param bool $adjust_splits Adjust historical data for historical splits and reverse splits. Market Data uses * the CRSP methodology for adjustment. Daily candles default: true. * * @return BulkCandles @@ -55,8 +54,8 @@ public function bulkCandles( array $symbols = [], string $resolution = 'D', bool $snapshot = false, - Carbon $date = null, - bool $adjustsplits = false, + string $date = null, + bool $adjust_splits = false, ): BulkCandles { if (empty($symbols) && !$snapshot) { throw new \InvalidArgumentException('Either symbols or snapshot must be set'); @@ -65,7 +64,12 @@ public function bulkCandles( $symbols = implode(',', array_map('trim', $symbols)); return new BulkCandles($this->client->execute(self::BASE_URL . "bulkcandles/{$resolution}/", - compact('symbols', 'date', 'snapshot', 'adjustsplits') + [ + 'symbols' => $symbols, + 'snapshot' => $snapshot, + 'date' => $date, + 'adjustsplits' => $adjust_splits + ] )); } @@ -73,14 +77,20 @@ public function bulkCandles( * Get historical price candles for an index. * * @param string $symbol The company's ticker symbol. - * @param Carbon $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. - * @param Carbon|null $to The rightmost candle on a chart (inclusive). + * + * @param string $from The leftmost candle on a chart (inclusive). If you use countback, to is not required. + * Accepted timestamp inputs: ISO 8601, unix, spreadsheet. + * + * @param string|null $to The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, + * spreadsheet. + * * @param string $resolution The duration of each candle. - * Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) Hourly Resolutions: (hourly, H, 1H, 2H, ...) - * Daily Resolutions: (daily, D, 1D, 2D, ...) - * Weekly Resolutions: (weekly, W, 1W, 2W, ...) - * Monthly Resolutions: (monthly, M, 1M, 2M, ...) - * Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...) + * - Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) + * - Hourly Resolutions: (hourly, H, 1H, 2H, ...) + * - Daily Resolutions: (daily, D, 1D, 2D, ...) + * - Weekly Resolutions: (weekly, W, 1W, 2W, ...) + * - Monthly Resolutions: (monthly, M, 1M, 2M, ...) + * - Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...) * * @param int|null $countback Will fetch a number of candles before (to the left of) to. If you use from, countback * is not required. @@ -98,10 +108,10 @@ public function bulkCandles( * the exchange, but not the exchange code. Use the two digit ISO 3166 country code. If no country is specified, US * exchanges will be assumed. * - * @param bool $adjustsplits Adjust historical data for for historical splits and reverse splits. Market Data uses + * @param bool $adjust_splits Adjust historical data for for historical splits and reverse splits. Market Data uses * the CRSP methodology for adjustment. Daily candles default: true. Intraday candles default: false. * - * @param bool $adjustdividends CAUTION: Adjusted dividend data is planned for the future, but not yet implemented. + * @param bool $adjust_dividends CAUTION: Adjusted dividend data is planned for the future, but not yet implemented. * All data is currently returned unadjusted for dividends. Market Data uses the CRSP methodology for adjustment. * Daily candles default: true. Intraday candles default: false. * @@ -110,18 +120,26 @@ public function bulkCandles( */ public function candles( string $symbol, - Carbon $from, - Carbon $to = null, + string $from, + string $to = null, string $resolution = 'D', int $countback = null, string $exchange = null, bool $extended = false, string $country = null, - bool $adjustsplits = false, - bool $adjustdividends = false, + bool $adjust_splits = false, + bool $adjust_dividends = false, ): Candles { - return new Candles($this->client->execute(self::BASE_URL . "candles/{$resolution}/{$symbol}/", - compact('from', 'to', 'countback', 'exchange', 'extended', 'country', 'adjustsplits', 'adjustdividends') + return new Candles($this->client->execute(self::BASE_URL . "candles/{$resolution}/{$symbol}/", [ + 'from' => $from, + 'to' => $to, + 'countback' => $countback, + 'exchange' => $exchange, + 'extended' => $extended, + 'country' => $country, + 'adjustsplits' => $adjust_splits, + 'adjustdividends' => $adjust_dividends + ] )); } @@ -192,14 +210,14 @@ public function bulkQuotes(array $symbols = [], bool $snapshot = false): BulkQuo * Premium subscription required. * * @param string $symbol The company's ticker symbol. - * @param Carbon|null $from The earliest earnings report to include in the output. If you use countback, from is not + * @param string|null $from The earliest earnings report to include in the output. If you use countback, from is not * required. * - * @param Carbon|null $to The latest earnings report to include in the output. + * @param string|null $to The latest earnings report to include in the output. * @param int|null $countback Countback will fetch a specific number of earnings reports before to. If you use from, * countback is not required. * - * @param Carbon|null $date Retrieve a specific earnings report by date. + * @param string|null $date Retrieve a specific earnings report by date. * @param string|null $datekey Retrieve a specific earnings report by date and quarter. Example: 2023-Q4. This * allows you to retrieve a 4th quarter value without knowing the company's specific fiscal year. * @@ -209,10 +227,10 @@ public function bulkQuotes(array $symbols = [], bool $snapshot = false): BulkQuo */ public function earnings( string $symbol, - Carbon $from = null, - Carbon $to = null, + string $from = null, + string $to = null, int $countback = null, - Carbon $date = null, + string $date = null, string $datekey = null ): Earnings { if (is_null($from) && (is_null($countback) || is_null($to))) { @@ -229,20 +247,20 @@ public function earnings( * CAUTION: This endpoint is in beta. * * @param string $symbol The ticker symbol of the stock. - * @param Carbon|null $from The earliest news to include in the output. If you use countback, from is not required. - * @param Carbon|null $to The latest news to include in the output. + * @param string|null $from The earliest news to include in the output. If you use countback, from is not required. + * @param string|null $to The latest news to include in the output. * @param int|null $countback Countback will fetch a specific number of news before to. If you use from, countback * is not required. * - * @param Carbon|null $date Retrieve news for a specific day. + * @param string|null $date Retrieve news for a specific day. * @throws \InvalidArgumentException */ public function news( string $symbol, - Carbon $from = null, - Carbon $to = null, + string $from = null, + string $to = null, int $countback = null, - Carbon $date = null, + string $date = null, ): News { if (is_null($from) && (is_null($countback) || is_null($to))) { throw new \InvalidArgumentException('Either `from` or `countback` and `to` must be set'); diff --git a/tests/IndicesTest.php b/tests/IndicesTest.php index 80e450b..8ade408 100644 --- a/tests/IndicesTest.php +++ b/tests/IndicesTest.php @@ -90,8 +90,8 @@ public function testCandles_fromTo_success() $response = $this->client->indices->candles( symbol: "DJI", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -122,8 +122,8 @@ public function testCandles_noData_success() $response = $this->client->indices->candles( symbol: "DJI", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -147,8 +147,8 @@ public function testCandles_noDataNextTime_success() $response = $this->client->indices->candles( symbol: "DJI", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); diff --git a/tests/MarketsTest.php b/tests/MarketsTest.php index 9a98b92..1621413 100644 --- a/tests/MarketsTest.php +++ b/tests/MarketsTest.php @@ -34,7 +34,7 @@ public function testStatus_success() $this->setMockResponses([new Response(200, [], json_encode($mocked_response))]); $response = $this->client->markets->status( - date: Carbon::createFromTimestamp(1680580800) + date: '1680580800' ); // Verify that the response is an object of the correct type. diff --git a/tests/MutualFundsTest.php b/tests/MutualFundsTest.php index 93aca96..350e6fb 100644 --- a/tests/MutualFundsTest.php +++ b/tests/MutualFundsTest.php @@ -40,8 +40,8 @@ public function testCandles_fromTo_success() $response = $this->client->mutual_funds->candles( symbol: 'VFINX', - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -72,8 +72,8 @@ public function testCandles_noData_success() $response = $this->client->mutual_funds->candles( symbol: 'VFINX', - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -96,8 +96,8 @@ public function testCandles_noDataNextTime_success() $response = $this->client->mutual_funds->candles( symbol: 'VFINX', - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); diff --git a/tests/OptionsTest.php b/tests/OptionsTest.php index 9c545c5..196eb41 100644 --- a/tests/OptionsTest.php +++ b/tests/OptionsTest.php @@ -101,8 +101,8 @@ public function testStrikes_success() $response = $this->client->options->strikes( symbol: 'AAPL', - expiration: Carbon::parse('2023-01-20'), - date: Carbon::parse('2023-01-03'), + expiration: '2023-01-20', + date: '2023-01-03', ); // Verify that the response is an object of the correct type. @@ -122,8 +122,8 @@ public function testStrikes_noData_success() $response = $this->client->options->strikes( symbol: 'AAPL', - expiration: Carbon::parse('2023-01-20'), - date: Carbon::parse('2023-01-03'), + expiration: '2023-01-20', + date: '2023-01-03', ); // Verify that the response is an object of the correct type. @@ -245,7 +245,7 @@ public function testOptionChain_success() $response = $this->client->options->option_chain( symbol: 'AAPL', - expiration: Carbon::parse('2025-01-17'), + expiration: '2025-01-17', side: Side::CALL, ); diff --git a/tests/StocksTest.php b/tests/StocksTest.php index 1e40c0b..60145bf 100644 --- a/tests/StocksTest.php +++ b/tests/StocksTest.php @@ -83,8 +83,8 @@ public function testCandles_fromTo_success() $response = $this->client->stocks->candles( symbol: "AAPL", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -116,8 +116,8 @@ public function testCandles_noData_success() $response = $this->client->stocks->candles( symbol: "AAPl", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -140,8 +140,8 @@ public function testCandles_noDataNextTime_success() $response = $this->client->stocks->candles( symbol: "AAPL", - from: Carbon::parse('2022-09-01'), - to: Carbon::parse('2022-09-05'), + from: '2022-09-01', + to: '2022-09-05', resolution: 'D' ); @@ -399,7 +399,7 @@ public function testEarnings_success() 'updated' => 1701690000 ]; $this->setMockResponses([new Response(200, [], json_encode($mocked_response))]); - $earnings = $this->client->stocks->earnings(symbol: 'AAPL', from: Carbon::parse('2023-01-01')); + $earnings = $this->client->stocks->earnings(symbol: 'AAPL', from: '2023-01-01'); $this->assertInstanceOf(Earnings::class, $earnings); $this->assertEquals($mocked_response['s'], $earnings->status); @@ -438,7 +438,7 @@ public function testNews_success() 'publicationDate' => 1703041200 ]; $this->setMockResponses([new Response(200, [], json_encode($mocked_response))]); - $news = $this->client->stocks->news(symbol: 'AAPL', from: Carbon::parse('2023-01-01')); + $news = $this->client->stocks->news(symbol: 'AAPL', from: '2023-01-01'); $this->assertInstanceOf(News::class, $news); $this->assertEquals($mocked_response['s'], $news->status);