From ade9d86960075694fe245125335a1c9356b5cbe7 Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Tue, 11 Jan 2022 16:19:50 +0100 Subject: [PATCH 01/10] Update BaseRequest.php Old method was still being called. --- src/Requests/BaseRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Requests/BaseRequest.php b/src/Requests/BaseRequest.php index 8d3b22b..aaa3047 100644 --- a/src/Requests/BaseRequest.php +++ b/src/Requests/BaseRequest.php @@ -54,7 +54,7 @@ public function post(): Collection $this->method = 'POST'; if (empty($this->payload)) { - throw InvalidData::invalidValuesProvided('Payload required to perform a POST request'); + throw InvalidData::invalidDataProvided('Payload required to perform a POST request'); } return $this->send(); From 928f5f5cc07f78494a8ce47a07217d8a4e652e4a Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Wed, 9 Feb 2022 15:30:22 +0100 Subject: [PATCH 02/10] Added endpoint HistoricalPriceFull --- src/CompanyValuation/HistoricalPriceFull.php | 66 +++++++++++++++++++ .../CompanyValuation/HistoricalPriceFull.php | 13 ++++ 2 files changed, 79 insertions(+) create mode 100644 src/CompanyValuation/HistoricalPriceFull.php create mode 100644 src/Facades/CompanyValuation/HistoricalPriceFull.php diff --git a/src/CompanyValuation/HistoricalPriceFull.php b/src/CompanyValuation/HistoricalPriceFull.php new file mode 100644 index 0000000..fdf0096 --- /dev/null +++ b/src/CompanyValuation/HistoricalPriceFull.php @@ -0,0 +1,66 @@ +symbol, self::ENDPOINT) . http_build_query($this->query_string); + } + + /** + * @param string $date_from + * + * @return HistoricalPriceFull + */ + public function setDateFrom(int $date_from): self + { + $this->query_string['from'] = $date_from; + + return $this; + } + + /** + * @param string $date_to + * + * @return HistoricalPriceFull + */ + public function setDateTo(int $date_to): self + { + $this->query_string['to'] = $date_to; + + return $this; + } + + /** + * @return bool|void + * @throws InvalidData + */ + protected function validateParams(): void + { + if (empty($this->symbol)) { + throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); + } + } +} diff --git a/src/Facades/CompanyValuation/HistoricalPriceFull.php b/src/Facades/CompanyValuation/HistoricalPriceFull.php new file mode 100644 index 0000000..93ece32 --- /dev/null +++ b/src/Facades/CompanyValuation/HistoricalPriceFull.php @@ -0,0 +1,13 @@ + Date: Wed, 9 Feb 2022 15:37:28 +0100 Subject: [PATCH 03/10] type fix --- src/CompanyValuation/HistoricalPriceFull.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CompanyValuation/HistoricalPriceFull.php b/src/CompanyValuation/HistoricalPriceFull.php index fdf0096..5182463 100644 --- a/src/CompanyValuation/HistoricalPriceFull.php +++ b/src/CompanyValuation/HistoricalPriceFull.php @@ -34,7 +34,7 @@ protected function getFullEndpoint(): string * * @return HistoricalPriceFull */ - public function setDateFrom(int $date_from): self + public function setDateFrom(string $date_from): self { $this->query_string['from'] = $date_from; @@ -46,7 +46,7 @@ public function setDateFrom(int $date_from): self * * @return HistoricalPriceFull */ - public function setDateTo(int $date_to): self + public function setDateTo(string $date_to): self { $this->query_string['to'] = $date_to; From 12acb59adb2da8023e44d626406c4d0e05a2e0f4 Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Fri, 11 Feb 2022 11:16:21 +0100 Subject: [PATCH 04/10] moved api version to the endpoints because FMP uses different versions per endpoint --- config/fmp.php | 2 +- src/Calendars/DividendCalendar.php | 4 +-- src/Calendars/EarningsCalendar.php | 4 +-- src/Calendars/EconomicCalendar.php | 4 +-- src/Calendars/HistoricalEarningsCalendar.php | 2 +- src/Calendars/IpoCalendar.php | 4 +-- src/Calendars/StockSplitCalendar.php | 4 +-- src/Client.php | 31 +++++++++---------- src/CompanyValuation/CountriesList.php | 2 +- src/CompanyValuation/DiscountedCashFlow.php | 4 +-- src/CompanyValuation/EarningsSurprises.php | 4 +-- src/CompanyValuation/EtfsList.php | 4 +-- src/CompanyValuation/HistoricalPriceFull.php | 2 +- src/CompanyValuation/KeyExecutives.php | 4 +-- src/CompanyValuation/MarketCapitalization.php | 4 +-- src/CompanyValuation/Profile.php | 4 +-- src/CompanyValuation/Quote.php | 4 +-- src/CompanyValuation/Rating.php | 4 +-- src/CompanyValuation/StockScreener.php | 4 +-- src/CompanyValuation/SymbolsList.php | 4 +-- src/CompanyValuation/TradableSymbolsList.php | 4 +-- src/InstitutionalFunds/Cik.php | 2 +- src/InstitutionalFunds/CikList.php | 2 +- src/InstitutionalFunds/CikSearch.php | 2 +- src/InstitutionalFunds/CusipMapper.php | 2 +- .../EtfCountryWeightings.php | 2 +- src/InstitutionalFunds/EtfHolder.php | 2 +- .../EtfSectorWeightings.php | 2 +- src/InstitutionalFunds/Form13F.php | 2 +- .../InstitutionalHolder.php | 2 +- src/InstitutionalFunds/MutualFundHolder.php | 2 +- src/InstitutionalFunds/SecRssFeed.php | 2 +- src/StockMarket/Actives.php | 2 +- src/StockMarket/Gainers.php | 2 +- src/StockMarket/Losers.php | 2 +- src/StockMarket/MarketHours.php | 2 +- src/StockMarket/SectorsPerformance.php | 2 +- 37 files changed, 67 insertions(+), 68 deletions(-) diff --git a/config/fmp.php b/config/fmp.php index 97fc925..99e694c 100644 --- a/config/fmp.php +++ b/config/fmp.php @@ -23,6 +23,6 @@ | */ - 'base_url' => env('FMP_BASE_URL', 'https://financialmodelingprep.com/api/v3/'), + 'base_url' => env('FMP_BASE_URL', 'https://financialmodelingprep.com/api/'), ]; diff --git a/src/Calendars/DividendCalendar.php b/src/Calendars/DividendCalendar.php index 16d4ac2..3869013 100644 --- a/src/Calendars/DividendCalendar.php +++ b/src/Calendars/DividendCalendar.php @@ -10,7 +10,7 @@ class DividendCalendar extends BaseRequest { - const ENDPOINT = 'stock_dividend_calendar?'; + const ENDPOINT = 'v3/stock_dividend_calendar?'; private $query_string = array(); @@ -40,7 +40,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/Calendars/EarningsCalendar.php b/src/Calendars/EarningsCalendar.php index 5e35774..7a33fcd 100644 --- a/src/Calendars/EarningsCalendar.php +++ b/src/Calendars/EarningsCalendar.php @@ -10,7 +10,7 @@ class EarningsCalendar extends BaseRequest { - const ENDPOINT = 'earning_calendar?'; + const ENDPOINT = 'v3/earning_calendar?'; private $query_string = array(); @@ -40,7 +40,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/Calendars/EconomicCalendar.php b/src/Calendars/EconomicCalendar.php index 8bfb79e..20478b2 100644 --- a/src/Calendars/EconomicCalendar.php +++ b/src/Calendars/EconomicCalendar.php @@ -10,7 +10,7 @@ class EconomicCalendar extends BaseRequest { - const ENDPOINT = 'economic_calendar?'; + const ENDPOINT = 'v3/economic_calendar?'; private $query_string = array(); @@ -40,7 +40,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/Calendars/HistoricalEarningsCalendar.php b/src/Calendars/HistoricalEarningsCalendar.php index 76d1e87..c1642b6 100644 --- a/src/Calendars/HistoricalEarningsCalendar.php +++ b/src/Calendars/HistoricalEarningsCalendar.php @@ -8,7 +8,7 @@ class HistoricalEarningsCalendar extends BaseRequest { - const ENDPOINT = 'historical/earning_calendar/{symbol}?'; + const ENDPOINT = 'v3/historical/earning_calendar/{symbol}?'; private $query_string = array(); diff --git a/src/Calendars/IpoCalendar.php b/src/Calendars/IpoCalendar.php index 1791a4b..deb203e 100644 --- a/src/Calendars/IpoCalendar.php +++ b/src/Calendars/IpoCalendar.php @@ -10,7 +10,7 @@ class IpoCalendar extends BaseRequest { - const ENDPOINT = 'ipo_calendar?'; + const ENDPOINT = 'v3/ipo_calendar?'; private $query_string = array(); @@ -40,7 +40,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/Calendars/StockSplitCalendar.php b/src/Calendars/StockSplitCalendar.php index 331e936..0965e00 100644 --- a/src/Calendars/StockSplitCalendar.php +++ b/src/Calendars/StockSplitCalendar.php @@ -10,7 +10,7 @@ class StockSplitCalendar extends BaseRequest { - const ENDPOINT = 'stock_split_calendar?'; + const ENDPOINT = 'v3/stock_split_calendar?'; private $query_string = array(); @@ -40,7 +40,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/Client.php b/src/Client.php index bb5e921..009a515 100644 --- a/src/Client.php +++ b/src/Client.php @@ -13,28 +13,28 @@ class Client implements Fmp { /** - * @var Guzzle|null - */ + * @var Guzzle|null + */ private $client = null; /** - * Client constructor. - * - * @param Guzzle $client - */ + * Client constructor. + * + * @param Guzzle $client + */ public function __construct(Guzzle $client) { $this->client = $client; } /** - * @param RequestInterface $request - * @param array $options - * - * @return ResponseInterface - * @throws GuzzleException - * @throws InvalidData - */ + * @param RequestInterface $request + * @param array $options + * + * @return ResponseInterface + * @throws GuzzleException + * @throws InvalidData + */ public function send(RequestInterface $request, array $options = []): ResponseInterface { try { @@ -43,9 +43,8 @@ public function send(RequestInterface $request, array $options = []): ResponseIn return $this->client->send($request, [ 'query' => array_merge($this->client->getConfig('query') ?? [], $query) ]); - } - catch (ClientException $e) { - throw InvalidData::invalidValuesProvided($e->getMessage()); + } catch (ClientException $e) { + throw InvalidData::invalidDataProvided($e->getMessage()); } } } diff --git a/src/CompanyValuation/CountriesList.php b/src/CompanyValuation/CountriesList.php index 5497c88..7595bef 100644 --- a/src/CompanyValuation/CountriesList.php +++ b/src/CompanyValuation/CountriesList.php @@ -7,7 +7,7 @@ class CountriesList extends BaseRequest { - const ENDPOINT = 'get-all-countries'; + const ENDPOINT = 'v3/get-all-countries'; /** * Create constructor. diff --git a/src/CompanyValuation/DiscountedCashFlow.php b/src/CompanyValuation/DiscountedCashFlow.php index 221d83e..f088537 100644 --- a/src/CompanyValuation/DiscountedCashFlow.php +++ b/src/CompanyValuation/DiscountedCashFlow.php @@ -8,7 +8,7 @@ class DiscountedCashFlow extends BaseRequest { - const ENDPOINT = 'discounted-cash-flow/{symbol}'; + const ENDPOINT = 'v3/discounted-cash-flow/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/EarningsSurprises.php b/src/CompanyValuation/EarningsSurprises.php index 10c2ade..21e8543 100644 --- a/src/CompanyValuation/EarningsSurprises.php +++ b/src/CompanyValuation/EarningsSurprises.php @@ -8,7 +8,7 @@ class EarningsSurprises extends BaseRequest { - const ENDPOINT = 'earnings-surpises/{symbol}'; + const ENDPOINT = 'v3/earnings-surpises/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/EtfsList.php b/src/CompanyValuation/EtfsList.php index 535784d..14d6f47 100644 --- a/src/CompanyValuation/EtfsList.php +++ b/src/CompanyValuation/EtfsList.php @@ -7,7 +7,7 @@ class EtfsList extends BaseRequest { - const ENDPOINT = 'etf/list'; + const ENDPOINT = 'v3/etf/list'; /** * Create constructor. @@ -27,4 +27,4 @@ protected function getFullEndpoint(): string { return self::ENDPOINT; } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/HistoricalPriceFull.php b/src/CompanyValuation/HistoricalPriceFull.php index 5182463..fcf8eba 100644 --- a/src/CompanyValuation/HistoricalPriceFull.php +++ b/src/CompanyValuation/HistoricalPriceFull.php @@ -8,7 +8,7 @@ class HistoricalPriceFull extends BaseRequest { - const ENDPOINT = 'historical-price-full/{symbol}?'; + const ENDPOINT = 'v3/historical-price-full/{symbol}?'; /** * Create constructor. diff --git a/src/CompanyValuation/KeyExecutives.php b/src/CompanyValuation/KeyExecutives.php index 35cd3a2..5190683 100644 --- a/src/CompanyValuation/KeyExecutives.php +++ b/src/CompanyValuation/KeyExecutives.php @@ -8,7 +8,7 @@ class KeyExecutives extends BaseRequest { - const ENDPOINT = 'key-executives/{symbol}'; + const ENDPOINT = 'v3/key-executives/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/MarketCapitalization.php b/src/CompanyValuation/MarketCapitalization.php index 2b8e09c..35bcc3a 100644 --- a/src/CompanyValuation/MarketCapitalization.php +++ b/src/CompanyValuation/MarketCapitalization.php @@ -8,7 +8,7 @@ class MarketCapitalization extends BaseRequest { - const ENDPOINT = 'market-capitalization/{symbol}'; + const ENDPOINT = 'v3/market-capitalization/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/Profile.php b/src/CompanyValuation/Profile.php index 80e0fc9..2e30164 100644 --- a/src/CompanyValuation/Profile.php +++ b/src/CompanyValuation/Profile.php @@ -8,7 +8,7 @@ class Profile extends BaseRequest { - const ENDPOINT = 'profile/{symbol}'; + const ENDPOINT = 'v3/profile/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/Quote.php b/src/CompanyValuation/Quote.php index 8bbc61b..8bc8060 100644 --- a/src/CompanyValuation/Quote.php +++ b/src/CompanyValuation/Quote.php @@ -8,7 +8,7 @@ class Quote extends BaseRequest { - const ENDPOINT = 'quote/{symbol}'; + const ENDPOINT = 'v3/quote/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/Rating.php b/src/CompanyValuation/Rating.php index c6e2c8f..ca55101 100644 --- a/src/CompanyValuation/Rating.php +++ b/src/CompanyValuation/Rating.php @@ -8,7 +8,7 @@ class Rating extends BaseRequest { - const ENDPOINT = 'rating/{symbol}'; + const ENDPOINT = 'v3/rating/{symbol}'; /** * Create constructor. @@ -39,4 +39,4 @@ protected function validateParams(): void throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); } } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/StockScreener.php b/src/CompanyValuation/StockScreener.php index 15484a1..214c516 100644 --- a/src/CompanyValuation/StockScreener.php +++ b/src/CompanyValuation/StockScreener.php @@ -7,7 +7,7 @@ class StockScreener extends BaseRequest { - const ENDPOINT = 'stock-screener?'; + const ENDPOINT = 'v3/stock-screener?'; public $query_string = array(); @@ -27,7 +27,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return self::ENDPOINT.http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** diff --git a/src/CompanyValuation/SymbolsList.php b/src/CompanyValuation/SymbolsList.php index a90376d..29978b6 100644 --- a/src/CompanyValuation/SymbolsList.php +++ b/src/CompanyValuation/SymbolsList.php @@ -7,7 +7,7 @@ class SymbolsList extends BaseRequest { - const ENDPOINT = 'stock/list'; + const ENDPOINT = 'v3/stock/list'; /** * Create constructor. @@ -27,4 +27,4 @@ protected function getFullEndpoint(): string { return self::ENDPOINT; } -} \ No newline at end of file +} diff --git a/src/CompanyValuation/TradableSymbolsList.php b/src/CompanyValuation/TradableSymbolsList.php index a6daf40..3280499 100644 --- a/src/CompanyValuation/TradableSymbolsList.php +++ b/src/CompanyValuation/TradableSymbolsList.php @@ -7,7 +7,7 @@ class TradableSymbolsList extends BaseRequest { - const ENDPOINT = 'available-traded/list'; + const ENDPOINT = 'v3/available-traded/list'; /** * Create constructor. @@ -27,4 +27,4 @@ protected function getFullEndpoint(): string { return self::ENDPOINT; } -} \ No newline at end of file +} diff --git a/src/InstitutionalFunds/Cik.php b/src/InstitutionalFunds/Cik.php index 5eab4da..3115752 100644 --- a/src/InstitutionalFunds/Cik.php +++ b/src/InstitutionalFunds/Cik.php @@ -8,7 +8,7 @@ class Cik extends BaseRequest { - const ENDPOINT = 'cik/{cik}'; + const ENDPOINT = 'v3/cik/{cik}'; /** * @var string diff --git a/src/InstitutionalFunds/CikList.php b/src/InstitutionalFunds/CikList.php index cb5af68..88d73cc 100644 --- a/src/InstitutionalFunds/CikList.php +++ b/src/InstitutionalFunds/CikList.php @@ -7,7 +7,7 @@ class CikList extends BaseRequest { - const ENDPOINT = 'cik_list'; + const ENDPOINT = 'v3/cik_list'; /** * Create constructor. diff --git a/src/InstitutionalFunds/CikSearch.php b/src/InstitutionalFunds/CikSearch.php index 712b31e..e167653 100644 --- a/src/InstitutionalFunds/CikSearch.php +++ b/src/InstitutionalFunds/CikSearch.php @@ -8,7 +8,7 @@ class CikSearch extends BaseRequest { - const ENDPOINT = 'cik-search/{name}'; + const ENDPOINT = 'v3/cik-search/{name}'; /** * @var string diff --git a/src/InstitutionalFunds/CusipMapper.php b/src/InstitutionalFunds/CusipMapper.php index 67f0cba..bd90f91 100644 --- a/src/InstitutionalFunds/CusipMapper.php +++ b/src/InstitutionalFunds/CusipMapper.php @@ -8,7 +8,7 @@ class CusipMapper extends BaseRequest { - const ENDPOINT = 'cusip/{cusip}'; + const ENDPOINT = 'v3/cusip/{cusip}'; /** * @var string diff --git a/src/InstitutionalFunds/EtfCountryWeightings.php b/src/InstitutionalFunds/EtfCountryWeightings.php index b53233a..3fd3793 100644 --- a/src/InstitutionalFunds/EtfCountryWeightings.php +++ b/src/InstitutionalFunds/EtfCountryWeightings.php @@ -8,7 +8,7 @@ class EtfCountryWeightings extends BaseRequest { - const ENDPOINT = 'etf-country-weightings/{symbol}'; + const ENDPOINT = 'v3/etf-country-weightings/{symbol}'; /** * Create constructor. diff --git a/src/InstitutionalFunds/EtfHolder.php b/src/InstitutionalFunds/EtfHolder.php index 58f9341..1f3e028 100644 --- a/src/InstitutionalFunds/EtfHolder.php +++ b/src/InstitutionalFunds/EtfHolder.php @@ -8,7 +8,7 @@ class EtfHolder extends BaseRequest { - const ENDPOINT = 'etf-holder/{symbol}'; + const ENDPOINT = 'v3/etf-holder/{symbol}'; /** * Create constructor. diff --git a/src/InstitutionalFunds/EtfSectorWeightings.php b/src/InstitutionalFunds/EtfSectorWeightings.php index f52ab1a..c6f380b 100644 --- a/src/InstitutionalFunds/EtfSectorWeightings.php +++ b/src/InstitutionalFunds/EtfSectorWeightings.php @@ -8,7 +8,7 @@ class EtfSectorWeightings extends BaseRequest { - const ENDPOINT = 'etf-sector-weightings/{symbol}'; + const ENDPOINT = 'v3/etf-sector-weightings/{symbol}'; /** * Create constructor. diff --git a/src/InstitutionalFunds/Form13F.php b/src/InstitutionalFunds/Form13F.php index c9e873a..e609e23 100644 --- a/src/InstitutionalFunds/Form13F.php +++ b/src/InstitutionalFunds/Form13F.php @@ -10,7 +10,7 @@ class Form13F extends BaseRequest { - const ENDPOINT = 'form-thirteen/{cik}?'; + const ENDPOINT = 'v3/form-thirteen/{cik}?'; private $query_string = array(); diff --git a/src/InstitutionalFunds/InstitutionalHolder.php b/src/InstitutionalFunds/InstitutionalHolder.php index 8d68083..4e973b9 100644 --- a/src/InstitutionalFunds/InstitutionalHolder.php +++ b/src/InstitutionalFunds/InstitutionalHolder.php @@ -8,7 +8,7 @@ class InstitutionalHolder extends BaseRequest { - const ENDPOINT = 'institutional-holder/{symbol}'; + const ENDPOINT = 'v3/institutional-holder/{symbol}'; /** * Create constructor. diff --git a/src/InstitutionalFunds/MutualFundHolder.php b/src/InstitutionalFunds/MutualFundHolder.php index e5e2e78..6cc5103 100644 --- a/src/InstitutionalFunds/MutualFundHolder.php +++ b/src/InstitutionalFunds/MutualFundHolder.php @@ -8,7 +8,7 @@ class MutualFundHolder extends BaseRequest { - const ENDPOINT = 'mutual-fund-holder/{symbol}'; + const ENDPOINT = 'v3/mutual-fund-holder/{symbol}'; /** * Create constructor. diff --git a/src/InstitutionalFunds/SecRssFeed.php b/src/InstitutionalFunds/SecRssFeed.php index aba9502..ea6fd55 100644 --- a/src/InstitutionalFunds/SecRssFeed.php +++ b/src/InstitutionalFunds/SecRssFeed.php @@ -7,7 +7,7 @@ class SecRssFeed extends BaseRequest { - const ENDPOINT = 'rss_feeds?'; + const ENDPOINT = 'v3/rss_feeds?'; private $query_string = array(); diff --git a/src/StockMarket/Actives.php b/src/StockMarket/Actives.php index 23a7e44..de42697 100644 --- a/src/StockMarket/Actives.php +++ b/src/StockMarket/Actives.php @@ -7,7 +7,7 @@ class Actives extends BaseRequest { - const ENDPOINT = 'actives'; + const ENDPOINT = 'v3/actives'; /** * Create constructor. diff --git a/src/StockMarket/Gainers.php b/src/StockMarket/Gainers.php index d7c76ee..7dc65d3 100644 --- a/src/StockMarket/Gainers.php +++ b/src/StockMarket/Gainers.php @@ -7,7 +7,7 @@ class Gainers extends BaseRequest { - const ENDPOINT = 'gainers'; + const ENDPOINT = 'v3/gainers'; /** * Create constructor. diff --git a/src/StockMarket/Losers.php b/src/StockMarket/Losers.php index 5ddfd06..2fc5e35 100644 --- a/src/StockMarket/Losers.php +++ b/src/StockMarket/Losers.php @@ -7,7 +7,7 @@ class Losers extends BaseRequest { - const ENDPOINT = 'losers'; + const ENDPOINT = 'v3/losers'; /** * Create constructor. diff --git a/src/StockMarket/MarketHours.php b/src/StockMarket/MarketHours.php index 0add560..f6ca2a3 100644 --- a/src/StockMarket/MarketHours.php +++ b/src/StockMarket/MarketHours.php @@ -7,7 +7,7 @@ class MarketHours extends BaseRequest { - const ENDPOINT = 'market-hours'; + const ENDPOINT = 'v3/market-hours'; /** * Create constructor. diff --git a/src/StockMarket/SectorsPerformance.php b/src/StockMarket/SectorsPerformance.php index 817a80a..945918d 100644 --- a/src/StockMarket/SectorsPerformance.php +++ b/src/StockMarket/SectorsPerformance.php @@ -7,7 +7,7 @@ class SectorsPerformance extends BaseRequest { - const ENDPOINT = '{endpoint}?'; + const ENDPOINT = 'v3/{endpoint}?'; private $query_string = array(); From 0bd5b031003d1cb593e25db02c46d61c7f931e2e Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Fri, 11 Feb 2022 11:55:06 +0100 Subject: [PATCH 05/10] Get Profile by Isin --- src/Facades/Misc/ProfileByIsin.php | 13 +++++++ src/Misc/ProfileByIsin.php | 54 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/Facades/Misc/ProfileByIsin.php create mode 100644 src/Misc/ProfileByIsin.php diff --git a/src/Facades/Misc/ProfileByIsin.php b/src/Facades/Misc/ProfileByIsin.php new file mode 100644 index 0000000..ff574f3 --- /dev/null +++ b/src/Facades/Misc/ProfileByIsin.php @@ -0,0 +1,13 @@ +query_string); + } + + /** + * @param string $isin + * + * @return ProfileByIsin + */ + public function setIsin(string $isin): self + { + $this->query_string['isin'] = $isin; + + return $this; + } + + /** + * @return bool|void + * @throws InvalidData + */ + protected function validateParams(): void + { + if (empty($this->symbol)) { + throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); + } + } +} From af1839dac1a263ea427d524a50800130daaf05ee Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Mon, 14 Feb 2022 11:15:11 +0100 Subject: [PATCH 06/10] Validation issue --- src/Misc/ProfileByIsin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Misc/ProfileByIsin.php b/src/Misc/ProfileByIsin.php index cf536c9..2908961 100644 --- a/src/Misc/ProfileByIsin.php +++ b/src/Misc/ProfileByIsin.php @@ -47,8 +47,8 @@ public function setIsin(string $isin): self */ protected function validateParams(): void { - if (empty($this->symbol)) { - throw InvalidData::invalidDataProvided('Please provide a symbol to query!'); + if (empty($this->query_string['isin'])) { + throw InvalidData::invalidDataProvided('Please provide an isin code to query!'); } } } From f4abc6b1f635c62f68e14f8d8e1e5b5aa77aa6e1 Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Mon, 14 Feb 2022 11:21:36 +0100 Subject: [PATCH 07/10] endpoint fix --- src/Misc/ProfileByIsin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Misc/ProfileByIsin.php b/src/Misc/ProfileByIsin.php index 2908961..ae4d634 100644 --- a/src/Misc/ProfileByIsin.php +++ b/src/Misc/ProfileByIsin.php @@ -26,7 +26,7 @@ public function __construct(Fmp $api) */ protected function getFullEndpoint(): string { - return http_build_query($this->query_string); + return self::ENDPOINT . http_build_query($this->query_string); } /** From 71fbf2c9f8d0f6452e2f428dcc25342226dae533 Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Mon, 14 Feb 2022 11:23:25 +0100 Subject: [PATCH 08/10] typo --- src/Misc/ProfileByIsin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Misc/ProfileByIsin.php b/src/Misc/ProfileByIsin.php index ae4d634..54d3013 100644 --- a/src/Misc/ProfileByIsin.php +++ b/src/Misc/ProfileByIsin.php @@ -8,7 +8,7 @@ class ProfileByIsin extends BaseRequest { - const ENDPOINT = 'v4/search/isin'; + const ENDPOINT = 'v4/search/isin?'; /** * Create constructor. From a85acd36a0d79905efe1058b236d651d83455cfe Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Fri, 25 Feb 2022 11:07:51 +0100 Subject: [PATCH 09/10] composer update --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index d9a7693..485d640 100644 --- a/composer.json +++ b/composer.json @@ -7,14 +7,14 @@ "type": "library", "license": "MIT", "require": { - "php": "^7.3|^8.0", + "php": "^8.1", "ext-json": "*", - "guzzlehttp/guzzle": "^7.0.1", - "illuminate/support": "8.*" + "illuminate/support": "*", + "guzzlehttp/guzzle": "^7.4", }, "require-dev": { - "orchestra/testbench": "6.*", - "phpunit/phpunit": "^9.3.3" + "orchestra/testbench": "7.*", + "phpunit/phpunit": "^9.5" }, "authors": [ { From d35ffe739be566fcc34e670a6691064c511c317e Mon Sep 17 00:00:00 2001 From: TutanRamon Date: Fri, 25 Feb 2022 11:13:28 +0100 Subject: [PATCH 10/10] typo --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 485d640..b4bd530 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "php": "^8.1", "ext-json": "*", "illuminate/support": "*", - "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/guzzle": "^7.4" }, "require-dev": { "orchestra/testbench": "7.*",