├── docs ├── .nojekyll ├── forex.md ├── _media │ ├── icon-color.png │ └── logo-color.svg ├── _navbar.md ├── ref-data.md ├── _sidebar.md ├── _coverpage.md ├── iex-data.md ├── system-metadata.md ├── getting-started.md ├── index.html ├── account.md ├── README.md ├── alt-data.md ├── cryptocurrency.md ├── dev-status.md ├── quickstart.md ├── data-apis.md └── stocks.md ├── .styleci.yml ├── src ├── Exceptions │ ├── WrongData.php │ └── InvalidConfig.php ├── Facades │ ├── Stocks │ │ ├── Logo.php │ │ ├── News.php │ │ ├── Batch.php │ │ ├── Price.php │ │ ├── Quote.php │ │ ├── Company.php │ │ ├── KeyStats.php │ │ ├── PriceTarget.php │ │ ├── BalanceSheet.php │ │ ├── DelayedQuote.php │ │ ├── AdvancedStats.php │ │ ├── IntradayPrices.php │ │ ├── VolumeByVenue.php │ │ └── PreviousDayPrice.php │ ├── Account │ │ ├── Usage.php │ │ └── Metadata.php │ ├── ReferenceData │ │ ├── Tags.php │ │ ├── Search.php │ │ ├── Sectors.php │ │ ├── Symbols.php │ │ ├── Exchanges.php │ │ ├── FxSymbols.php │ │ ├── IEXSymbols.php │ │ ├── OtcSymbols.php │ │ ├── USExchanges.php │ │ ├── CryptoSymbols.php │ │ ├── OptionsSymbols.php │ │ ├── RegionSymbols.php │ │ ├── ExchangeSymbols.php │ │ ├── USHolTradeDates.php │ │ └── MutualFundSymbols.php │ ├── DataApis │ │ ├── DataPoints.php │ │ └── TimeSeries │ │ │ ├── Query.php │ │ │ └── Inventory.php │ ├── AlternativeData │ │ ├── CeoComp.php │ │ ├── Crypto │ │ │ ├── Book.php │ │ │ ├── Price.php │ │ │ └── Quote.php │ │ └── SocialSentiment.php │ ├── APISystemMetadata │ │ └── Status.php │ ├── InvestorsExchangeData │ │ ├── Deep.php │ │ ├── Last.php │ │ ├── Tops.php │ │ ├── Deep │ │ │ ├── Book.php │ │ │ ├── Trades.php │ │ │ ├── Auction.php │ │ │ ├── SsrStatus.php │ │ │ ├── SystemEvent.php │ │ │ ├── TradeBreak.php │ │ │ ├── OpHaltStatus.php │ │ │ ├── OfficialPrice.php │ │ │ ├── SecurityEvent.php │ │ │ └── TradingStatus.php │ │ └── Stats │ │ │ ├── Recent.php │ │ │ ├── Intraday.php │ │ │ └── Records.php │ └── ForexCurrencies │ │ └── ExchangeRates.php ├── Contracts │ └── IEXCloud.php ├── Account │ ├── Usage.php │ └── Metadata.php ├── ReferenceData │ ├── Tags.php │ ├── Sectors.php │ ├── Symbols.php │ ├── Exchanges.php │ ├── FxSymbols.php │ ├── IEXSymbols.php │ ├── OtcSymbols.php │ ├── CryptoSymbols.php │ ├── OptionsSymbols.php │ ├── USExchanges.php │ ├── MutualFundSymbols.php │ ├── Search.php │ ├── RegionSymbols.php │ ├── ExchangeSymbols.php │ └── USHolTradeDates.php ├── APISystemMetadata │ └── Status.php ├── DataApis │ ├── TimeSeries │ │ ├── Inventory.php │ │ └── Query.php │ └── DataPoints.php ├── InvestorsExchangeData │ ├── Stats │ │ ├── Recent.php │ │ ├── Intraday.php │ │ └── Records.php │ ├── Deep │ │ ├── SystemEvent.php │ │ ├── Book.php │ │ ├── Auction.php │ │ ├── SecurityEvent.php │ │ ├── SsrStatus.php │ │ ├── OpHaltStatus.php │ │ ├── OfficialPrice.php │ │ ├── TradingStatus.php │ │ ├── Trades.php │ │ └── TradeBreak.php │ ├── Deep.php │ ├── Tops.php │ └── Last.php ├── Stocks │ ├── Logo.php │ ├── Price.php │ ├── Company.php │ ├── PriceTarget.php │ ├── BalanceSheet.php │ ├── AdvancedStats.php │ ├── PreviousDayPrice.php │ ├── VolumeByVenue.php │ ├── IntradayPrices.php │ ├── DelayedQuote.php │ ├── Quote.php │ ├── KeyStats.php │ ├── News.php │ └── Batch.php ├── AlternativeData │ ├── CeoComp.php │ ├── Crypto │ │ ├── Book.php │ │ ├── Price.php │ │ └── Quote.php │ └── SocialSentiment.php ├── Client.php ├── ForexCurrencies │ └── ExchangeRates.php ├── Requests │ └── BaseRequest.php └── IexCloudSdkServiceProvider.php ├── LICENSE.md ├── composer.json ├── README.md ├── config └── config.php ├── CHANGELOG.md ├── CONTRIBUTING.md └── GETTING_STARTED.md /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/forex.md: -------------------------------------------------------------------------------- 1 | # Forex / Currencies 2 | 3 | ## Exchange Rates 4 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | 3 | disabled: 4 | - single_class_element_per_statement 5 | -------------------------------------------------------------------------------- /docs/_media/icon-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitonic/iex-cloud-sdk/HEAD/docs/_media/icon-color.png -------------------------------------------------------------------------------- /docs/_navbar.md: -------------------------------------------------------------------------------- 1 | * IEX Cloud Support 2 | * [Getting Started](https://iexcloud.io/support/) 3 | * [API Docs](https://iexcloud.io/docs/api/) 4 | * [Quickstart](https://intercom.help/iexcloud/getting-started/getting-started-with-iex-cloud) 5 | * [Help Center](https://intercom.help/iexcloud) 6 | -------------------------------------------------------------------------------- /src/Exceptions/WrongData.php: -------------------------------------------------------------------------------- 1 | 0.1.0 4 | 5 | > An unofficial PHP package for interacting with the IEX Cloud API 6 | 7 | - 99% unit test coverage 8 | - Configurable Sandbox and Production mode 9 | - Developed by [Steven Richardson](https://github.com/richdynamix/) for [Digitonic](https://digitonic.co.uk) 10 | 11 | [GitHub](https://github.com/digitonic/iex-cloud-sdk/) 12 | [Get Started](/getting-started.md) 13 | [Digitonic](https://digitonic.co.uk) 14 | 15 | ![color](#F7F8FB) 16 | -------------------------------------------------------------------------------- /docs/iex-data.md: -------------------------------------------------------------------------------- 1 | # Investors Exchange Data 2 | 3 | ## TOPS 4 | ## TOPS last 5 | ## DEEP 6 | ## DEEP Auction 7 | ## DEEP Book 8 | ## DEEP Operational Halt Status 9 | ## DEEP Official Price 10 | ## DEEP Security Event 11 | ## DEEP Short Sale Price Test Status 12 | ## DEEP System Event 13 | ## DEEP Trades 14 | ## DEEP Trade Break 15 | ## DEEP Trading Status 16 | ## Listed Regulation SHO Threshold Securities List 17 | ## Listed Short Interest List 18 | ## Stats Historical Daily 19 | ## Stats Historical Summary 20 | ## Stats Intraday 21 | ## Stats Recent 22 | ## Stats Records 23 | -------------------------------------------------------------------------------- /docs/system-metadata.md: -------------------------------------------------------------------------------- 1 | # API System Metadata 2 | 3 | ## Status 4 | 5 | Used to retrieve current system status. 6 | 7 | **Example** 8 | 9 | ```php 10 | use \Digitonic\IexCloudSdk\APISystemMetadata\Status; 11 | 12 | $endpoint = new Status($client); 13 | $response = $endpoint->get(); 14 | 15 | // Laravel 16 | use \Digitonic\IexCloudSdk\Facades\APISystemMetadata\Status; 17 | 18 | $response = Status::get(); 19 | ``` 20 | 21 | **Response** 22 | 23 | ```php 24 | Collection {#275 ▼ 25 | #items: array:3 [▼ 26 | "status" => "up" 27 | "version" => "1.17" 28 | "time" => 1570900357804 29 | ] 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /src/Account/Usage.php: -------------------------------------------------------------------------------- 1 | Package in heavy development. Follow the [status](dev-status.md) 12 | 13 | #### What next? 14 | Read the [Quick Start](quickstart.md) 15 | 16 | Read more information on [IEX Cloud](https://iexcloud.io) 17 | 18 | ##### IEX Cloud Support 19 | * [Getting Started](https://iexcloud.io/support/) 20 | * [API Docs](https://iexcloud.io/docs/api/) 21 | * [Quickstart](https://intercom.help/iexcloud/getting-started/getting-started-with-iex-cloud) 22 | * [Help Center](https://intercom.help/iexcloud) 23 | -------------------------------------------------------------------------------- /src/ReferenceData/Search.php: -------------------------------------------------------------------------------- 1 | term = $term; 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{term}', $this->term, self::ENDPOINT); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Stocks/Logo.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/AlternativeData/CeoComp.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AlternativeData/Crypto/Book.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AlternativeData/Crypto/Price.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AlternativeData/Crypto/Quote.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Stocks/Price.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Stocks/Company.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/Book.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Stocks/PriceTarget.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/Auction.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Stocks/BalanceSheet.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Stocks/AdvancedStats.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Stocks/PreviousDayPrice.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | * @throws WrongData 34 | */ 35 | protected function validateParams(): void 36 | { 37 | if (empty($this->symbol)) { 38 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/SecurityEvent.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 29 | } 30 | 31 | /** 32 | * @return bool|void 33 | */ 34 | protected function validateParams(): void 35 | { 36 | if (empty($this->symbol)) { 37 | throw WrongData::invalidValuesProvided('Please provide symbol to query!'); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Steven Richardson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Stocks/VolumeByVenue.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 31 | } 32 | 33 | /** 34 | * @return bool|void 35 | * @throws WrongData 36 | */ 37 | protected function validateParams(): void 38 | { 39 | if (empty($this->symbol)) { 40 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 |
18 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Stocks/IntradayPrices.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 36 | } 37 | 38 | /** 39 | * @return bool|void 40 | * @throws WrongData 41 | */ 42 | protected function validateParams(): void 43 | { 44 | if (empty($this->symbol)) { 45 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Tops.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 33 | 34 | return $this; 35 | } 36 | 37 | /** 38 | * @return string 39 | */ 40 | protected function getFullEndpoint(): string 41 | { 42 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 43 | } 44 | 45 | /** 46 | * @return bool|void 47 | */ 48 | protected function validateParams(): void 49 | { 50 | if (empty($this->symbols)) { 51 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Last.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 33 | 34 | return $this; 35 | } 36 | 37 | /** 38 | * @return string 39 | */ 40 | protected function getFullEndpoint(): string 41 | { 42 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 43 | } 44 | 45 | /** 46 | * @return bool|void 47 | */ 48 | protected function validateParams(): void 49 | { 50 | if (empty($this->symbols)) { 51 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/SsrStatus.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->symbols)) { 54 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/OpHaltStatus.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->symbols)) { 54 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/OfficialPrice.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->symbols)) { 54 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/TradingStatus.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->symbols)) { 54 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/Trades.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 37 | 38 | return $this; 39 | } 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{symbols}', $this->symbols, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->symbols)) { 54 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Client.php: -------------------------------------------------------------------------------- 1 | client = $client; 28 | } 29 | 30 | /** 31 | * @param RequestInterface $request 32 | * @param array $options 33 | * 34 | * @return ResponseInterface 35 | * @throws GuzzleException 36 | * @throws WrongData 37 | */ 38 | public function send(RequestInterface $request, array $options = []): ResponseInterface 39 | { 40 | try { 41 | parse_str(parse_url($request->getUri(), PHP_URL_QUERY), $query); 42 | 43 | return $this->client->send($request, [ 44 | 'query' => array_merge($this->client->getConfig('query') ?? [], $query) 45 | ]); 46 | } 47 | catch (ClientException $e) { 48 | throw WrongData::invalidValuesProvided($e->getMessage()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/DataApis/DataPoints.php: -------------------------------------------------------------------------------- 1 | key = $key; 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace( 46 | '{symbol}', 47 | $this->symbol, 48 | str_replace( 49 | '{key}', 50 | $this->key, 51 | self::ENDPOINT 52 | ) 53 | ); 54 | } 55 | 56 | protected function validateParams() 57 | { 58 | if (empty($this->symbol)) { 59 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /docs/account.md: -------------------------------------------------------------------------------- 1 | # Account 2 | 3 | ## Metadata 4 | 5 | Used to retrieve account details such as current tier, payment status, message quote usage, etc. 6 | 7 | **Example** 8 | 9 | ```php 10 | use \Digitonic\IexCloudSdk\Account\Metadata; 11 | 12 | $endpoint = new Metadata($client); 13 | $response = $endpoint->get(); 14 | 15 | // Laravel 16 | use \Digitonic\IexCloudSdk\Facades\Account\Metadata; 17 | 18 | $response = Metadata::get(); 19 | ``` 20 | 21 | **Response** 22 | 23 | ```php 24 | Collection {#275 ▼ 25 | #items: array:7 [▼ 26 | "payAsYouGoEnabled" => false 27 | "effectiveDate" => 1621337109805 28 | "subscriptionTermType" => "mnlhyto" 29 | "tierName" => "tstar" 30 | "messageLimit" => 514440 31 | "messagesUsed" => 13578 32 | "circuitBreaker" => null 33 | ] 34 | } 35 | ``` 36 | 37 | ## Usage 38 | 39 | Used to retrieve current month usage for your account. 40 | 41 | **Example** 42 | 43 | ```php 44 | use \Digitonic\IexCloudSdk\Account\Usage; 45 | 46 | $endpoint = new Usage($client); 47 | $response = $endpoint->get(); 48 | 49 | // Laravel 50 | use \Digitonic\IexCloudSdk\Facades\Account\Usage; 51 | 52 | $response = Usage::get(); 53 | ``` 54 | 55 | **Response** 56 | 57 | ```php 58 | Collection {#265 ▼ 59 | #items: array:2 [▼ 60 | "messages" => {#275 ▼ 61 | +"dailyUsage": {#277 ▶} 62 | +"monthlyUsage": 12778 63 | +"monthlyPayAsYouGo": 0 64 | +"tokenUsage": {#278 ▶} 65 | +"keyUsage": {#272 ▶} 66 | } 67 | "rules" => [] 68 | ] 69 | } 70 | ``` 71 | -------------------------------------------------------------------------------- /src/ReferenceData/RegionSymbols.php: -------------------------------------------------------------------------------- 1 | region = $region; 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{region}', $this->region, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->region)) { 54 | throw WrongData::invalidValuesProvided( 55 | 'Region required using 2 letter case insensitive string of country codes using ISO 3166-1 alpha-2' 56 | ); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Stocks/DelayedQuote.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 36 | 37 | return $this->oddLot ? "$endpoint/oddLot=$this->oddLot" : $endpoint; 38 | } 39 | 40 | /** 41 | * @return bool|void 42 | * @throws WrongData 43 | */ 44 | protected function validateParams(): void 45 | { 46 | if (empty($this->symbol)) { 47 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 48 | } 49 | } 50 | 51 | public function oddLot(bool $oddLot = true): self 52 | { 53 | $this->oddLot = $oddLot; 54 | 55 | return $this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/ReferenceData/ExchangeSymbols.php: -------------------------------------------------------------------------------- 1 | exchange = $exchange; 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | protected function getFullEndpoint(): string 44 | { 45 | return str_replace('{exchange}', $this->exchange, self::ENDPOINT); 46 | } 47 | 48 | /** 49 | * @return bool|void 50 | */ 51 | protected function validateParams(): void 52 | { 53 | if (empty($this->exchange)) { 54 | throw WrongData::invalidValuesProvided( 55 | 'Required case insensitive string of Exchange using IEX Supported Exchanges list' 56 | ); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "digitonic/iex-cloud-sdk", 3 | "description": "Unofficial PHP SDK for IEX Cloud API", 4 | "keywords": [ 5 | "digitonic", 6 | "iex-cloud-sdk" 7 | ], 8 | "homepage": "https://github.com/digitonic/iex-cloud-sdk", 9 | "license": "MIT", 10 | "type": "library", 11 | "authors": [ 12 | { 13 | "name": "Steven Richardson", 14 | "email": "steven@digitonic.co.uk", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^7.1", 20 | "ext-json": "*", 21 | "guzzlehttp/guzzle": "^6.3", 22 | "illuminate/support": "5.8.*|6.*|7.*|8.*" 23 | }, 24 | "require-dev": { 25 | "orchestra/testbench": "3.8.*", 26 | "phpunit/phpunit": "^7.0" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "Digitonic\\IexCloudSdk\\": "src" 31 | } 32 | }, 33 | "autoload-dev": { 34 | "psr-4": { 35 | "Digitonic\\IexCloudSdk\\Tests\\": "tests" 36 | } 37 | }, 38 | "scripts": { 39 | "test": "vendor/bin/phpunit", 40 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage" 41 | 42 | }, 43 | "config": { 44 | "sort-packages": true 45 | }, 46 | "extra": { 47 | "laravel": { 48 | "providers": [ 49 | "Digitonic\\IexCloudSdk\\IexCloudSdkServiceProvider" 50 | ], 51 | "aliases": { 52 | "IexCloudSdk": "Digitonic\\IexCloudSdk\\IexCloudSdkFacade" 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/ForexCurrencies/ExchangeRates.php: -------------------------------------------------------------------------------- 1 | fromCurrency = $fromCurrency; 40 | 41 | return $this; 42 | } 43 | 44 | /** 45 | * @param string $toCurrency 46 | * 47 | * @return ExchangeRates 48 | */ 49 | public function setTo(string $toCurrency): self 50 | { 51 | $this->toCurrency = $toCurrency; 52 | 53 | return $this; 54 | } 55 | 56 | /** 57 | * @return string 58 | */ 59 | protected function getFullEndpoint(): string 60 | { 61 | return str_replace( 62 | '{from}', 63 | $this->fromCurrency, 64 | str_replace( 65 | '{to}', 66 | $this->toCurrency, 67 | self::ENDPOINT 68 | ) 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Requests/BaseRequest.php: -------------------------------------------------------------------------------- 1 | api = $api; 25 | } 26 | 27 | public function setSymbol(string $symbol): self 28 | { 29 | $this->symbol = $symbol; 30 | 31 | return $this; 32 | } 33 | 34 | public function send(): Collection 35 | { 36 | $this->validateParams(); 37 | 38 | $request = new Request($this->method, $this->getFullEndpoint(), [], json_encode($this->payload)); 39 | 40 | $response = $this->api->send($request); 41 | 42 | return collect(json_decode($response->getBody()->getContents())); 43 | } 44 | 45 | public function get(): Collection 46 | { 47 | $this->method = 'GET'; 48 | 49 | return $this->send(); 50 | } 51 | 52 | public function post(): Collection 53 | { 54 | $this->method = 'POST'; 55 | 56 | if (empty($this->payload)) { 57 | throw WrongData::invalidValuesProvided('Payload required to perform a POST request'); 58 | } 59 | 60 | return $this->send(); 61 | } 62 | 63 | abstract protected function getFullEndpoint(): string; 64 | 65 | protected function validateParams() 66 | { 67 | return true; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Stocks/Quote.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 38 | 39 | return $this->field ? "$endpoint/$this->field" : $endpoint; 40 | } 41 | 42 | /** 43 | * @return bool|void 44 | * @throws WrongData 45 | */ 46 | protected function validateParams(): void 47 | { 48 | if (empty($this->symbol)) { 49 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 50 | } 51 | } 52 | 53 | /** 54 | * Setter for field property 55 | * 56 | * @param string $field 57 | * 58 | * @return Quote 59 | */ 60 | public function only(string $field): self 61 | { 62 | $this->field = $field; 63 | 64 | return $this; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Stocks/KeyStats.php: -------------------------------------------------------------------------------- 1 | symbol, self::ENDPOINT); 38 | 39 | return $this->field ? "$endpoint/$this->field" : $endpoint; 40 | } 41 | 42 | /** 43 | * @return bool|void 44 | * @throws WrongData 45 | */ 46 | protected function validateParams(): void 47 | { 48 | if (empty($this->symbol)) { 49 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 50 | } 51 | } 52 | 53 | /** 54 | * Setter for field property 55 | * 56 | * @param string $field 57 | * 58 | * @return KeyStats 59 | */ 60 | public function only(string $field): self 61 | { 62 | $this->field = $field; 63 | 64 | return $this; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IEX Cloud SDK 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/digitonic/iex-cloud-sdk.svg?style=flat-square)](https://packagist.org/packages/digitonic/iex-cloud-sdk) 4 | [![Build Status](https://travis-ci.com/digitonic/iex-cloud-sdk.svg?branch=master)](https://travis-ci.com/digitonic/iex-cloud-sdk) 5 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/?branch=master) 6 | [![Code Coverage](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/?branch=master) 7 | [![Total Downloads](https://img.shields.io/packagist/dt/digitonic/iex-cloud-sdk.svg?style=flat-square)](https://packagist.org/packages/digitonic/iex-cloud-sdk) 8 | 9 | A PHP package for accessing the IEX Cloud API. It focuses heavily on the Laravel Framework however it will work in any standalone project with usage of Composer. 10 | 11 | ## Installation 12 | 13 | You can install the package via composer: 14 | 15 | ```bash 16 | composer require digitonic/iex-cloud-sdk 17 | ``` 18 | 19 | ## Usage 20 | 21 | Please see the [documentation](https://digitonic.github.io/iex-cloud-sdk/#/) for details. 22 | 23 | ### Testing 24 | 25 | ``` bash 26 | composer test 27 | ``` 28 | 29 | ### Changelog 30 | 31 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. 32 | 33 | ## Contributing 34 | 35 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details. 36 | 37 | ### Security 38 | 39 | If you discover any security related issues, please email steven@digitonic.co.uk instead of using the issue tracker. 40 | 41 | ## Credits 42 | 43 | - [Steven Richardson](https://github.com/richdynamix) 44 | - [All Contributors](../../contributors) 45 | 46 | ## License 47 | 48 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 49 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # IEX Cloud SDK 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/digitonic/iex-cloud-sdk.svg?style=flat-square)](https://packagist.org/packages/digitonic/iex-cloud-sdk) 4 | [![Build Status](https://travis-ci.com/digitonic/iex-cloud-sdk.svg?branch=master)](https://travis-ci.com/digitonic/iex-cloud-sdk) 5 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/?branch=master) 6 | [![Code Coverage](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/digitonic/iex-cloud-sdk/?branch=master) 7 | [![Total Downloads](https://img.shields.io/packagist/dt/digitonic/iex-cloud-sdk.svg?style=flat-square)](https://packagist.org/packages/digitonic/iex-cloud-sdk) 8 | 9 | A PHP package for accessing the IEX Cloud API. It focuses heavily on the Laravel Framework however it will work in any standalone project with usage of Composer. 10 | 11 | ## Installation 12 | 13 | You can install the package via composer: 14 | 15 | ```bash 16 | composer require digitonic/iex-cloud-sdk 17 | ``` 18 | 19 | ## Usage 20 | 21 | Please see the [documentation](https://digitonic.github.io/iex-cloud-sdk/#/) for details. 22 | 23 | ### Testing 24 | 25 | ``` bash 26 | composer test 27 | ``` 28 | 29 | ### Changelog 30 | 31 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. 32 | 33 | ## Contributing 34 | 35 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details. 36 | 37 | ### Security 38 | 39 | If you discover any security related issues, please email steven@digitonic.co.uk instead of using the issue tracker. 40 | 41 | ## Credits 42 | 43 | - [Steven Richardson](https://github.com/richdynamix) 44 | - [All Contributors](../../contributors) 45 | 46 | ## License 47 | 48 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 49 | -------------------------------------------------------------------------------- /src/Stocks/News.php: -------------------------------------------------------------------------------- 1 | validateLastParam($take); 37 | 38 | $this->last = $take; 39 | 40 | return $this; 41 | } 42 | 43 | /** 44 | * @return string 45 | */ 46 | protected function getFullEndpoint(): string 47 | { 48 | $endpoint = str_replace('{symbol}', $this->symbol, self::ENDPOINT); 49 | $endpoint = str_replace('{last}', "/last/$this->last", $endpoint); 50 | 51 | return $endpoint; 52 | } 53 | 54 | /** 55 | * @return bool|void 56 | * @throws WrongData 57 | */ 58 | protected function validateParams(): void 59 | { 60 | if (empty($this->symbol)) { 61 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 62 | } 63 | } 64 | 65 | /** 66 | * @param int $take 67 | * 68 | * @throws WrongData 69 | */ 70 | private function validateLastParam(int $take) 71 | { 72 | if ($take < 1) { 73 | throw WrongData::invalidValuesProvided('Must take at least one item.'); 74 | } 75 | 76 | if ($take > 50) { 77 | throw WrongData::invalidValuesProvided('Cannot take more than 50 items in one call'); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/IexCloudSdkServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 18 | $this->publishes([ 19 | __DIR__.'/../config/config.php' => config_path('iex-cloud-sdk.php'), 20 | ], 'config'); 21 | } 22 | } 23 | 24 | /** 25 | * Register the application services. 26 | */ 27 | public function register() 28 | { 29 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'iex-cloud-sdk'); 30 | 31 | $this->app->bind(IEXCloud::class, function () { 32 | $config = config('iex-cloud-sdk'); 33 | 34 | $this->guardAgainstInvalidConfig($config); 35 | 36 | $guzzle = new Client([ 37 | 'base_uri' => $config['sandbox'] ? $config['sandbox_base_url'] : $config['base_url'], 38 | 'headers' => [ 39 | 'Accept' => 'application/json', 40 | 'Content-Type' => 'application/json' 41 | ], 42 | 'query' => ['token' => $config['secret_key']] 43 | ]); 44 | 45 | return new \Digitonic\IexCloudSdk\Client($guzzle); 46 | }); 47 | } 48 | 49 | /** 50 | * @param array|null $config 51 | */ 52 | protected function guardAgainstInvalidConfig(array $config = null) 53 | { 54 | if (empty($config['base_url'])) { 55 | throw InvalidConfig::baseUrlNotSpecified(); 56 | } 57 | 58 | if (empty($config['secret_key'])) { 59 | throw InvalidConfig::apiKeyNotSpecified(); 60 | } 61 | 62 | if (empty($config['public_key'])) { 63 | throw InvalidConfig::apiKeyNotSpecified(); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AlternativeData/SocialSentiment.php: -------------------------------------------------------------------------------- 1 | type = $type; 36 | 37 | return $this; 38 | } 39 | 40 | public function setDate(string $date): self 41 | { 42 | $this->validateDate($date); 43 | 44 | $this->date = $date; 45 | 46 | return $this; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | protected function getFullEndpoint(): string 53 | { 54 | $endpoint = str_replace('{symbol}', $this->symbol, self::ENDPOINT); 55 | $endpoint = str_replace('{type}', $this->type, $endpoint); 56 | $endpoint = str_replace('{date}', $this->date, $endpoint); 57 | 58 | return $endpoint; 59 | 60 | } 61 | 62 | /** 63 | * @return bool|void 64 | * @throws WrongData 65 | */ 66 | protected function validateParams(): void 67 | { 68 | if (empty($this->symbol)) { 69 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 70 | } 71 | } 72 | 73 | private function validateDate(string $date) 74 | { 75 | $re = '/(20\d{2})(\d{2})(\d{2})/mi'; 76 | 77 | preg_match_all($re, $date, $matches, PREG_SET_ORDER, 0); 78 | 79 | if (empty($matches)) { 80 | throw WrongData::invalidValuesProvided('Format date to use YYYYMMDD to fetch sentiment data.'); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/InvestorsExchangeData/Deep/TradeBreak.php: -------------------------------------------------------------------------------- 1 | symbols = implode(',', $symbols); 42 | 43 | return $this; 44 | } 45 | 46 | /** 47 | * @param int $last 48 | * 49 | * @return TradeBreak 50 | */ 51 | public function setLast(int $last): self 52 | { 53 | $this->validateLast($last); 54 | 55 | $this->last = $last; 56 | 57 | return $this; 58 | } 59 | 60 | /** 61 | * @return string 62 | */ 63 | protected function getFullEndpoint(): string 64 | { 65 | $endpoint = str_replace('{symbols}', $this->symbols, self::ENDPOINT); 66 | $endpoint = str_replace('{last}', $this->last, $endpoint); 67 | 68 | return $endpoint; 69 | } 70 | 71 | /** 72 | * @return bool|void 73 | */ 74 | protected function validateParams(): void 75 | { 76 | if (empty($this->symbols)) { 77 | throw WrongData::invalidValuesProvided('Please provide symbol(s) to query!'); 78 | } 79 | } 80 | 81 | private function validateLast(int $last) 82 | { 83 | if ($last > 500) { 84 | throw WrongData::invalidValuesProvided('Last query param must be less than 500'); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | env('IEX_CLOUD_SANDBOX', false), 16 | 17 | /* 18 | |-------------------------------------------------------------------------- 19 | | Sandbox Base URL 20 | |-------------------------------------------------------------------------- 21 | | 22 | | Specify which Sandbox API should be used when sandbox = true 23 | | 24 | */ 25 | 'sandbox_base_url' => 'https://sandbox.iexapis.com/v1/', 26 | 27 | /* 28 | |-------------------------------------------------------------------------- 29 | | Base URL 30 | |-------------------------------------------------------------------------- 31 | | 32 | | IEX Cloud will release new versions when they make backwards-incompatible 33 | | changes to the API. Use the Base URL configuration to determine which 34 | | version of the API should be used. 35 | | 36 | */ 37 | 'base_url' => env('IEX_CLOUD_BASE_URL', 'https://cloud.iexapis.com/v1/'), 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Secret API Token 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Secret API tokens should be kept confidential and only stored on your 45 | | own servers. Your account’s secret API token can perform any 46 | | API request to IEX Cloud. 47 | | 48 | */ 49 | 'secret_key' => env('IEX_CLOUD_SECRET_KEY'), 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Publishable API Token 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Publishable API tokens are meant solely to identify your account with 57 | | IEX Cloud, they aren’t secret. They can be published in places like 58 | | your website JavaScript code, or in an iPhone or Android app. 59 | | 60 | */ 61 | 'public_key' => env('IEX_CLOUD_PUBLIC_KEY') 62 | ]; 63 | -------------------------------------------------------------------------------- /src/DataApis/TimeSeries/Query.php: -------------------------------------------------------------------------------- 1 | id = $id; 46 | 47 | return $this; 48 | } 49 | 50 | /** 51 | * @param string $key 52 | * 53 | * @return Query 54 | */ 55 | public function setKey(string $key): self 56 | { 57 | $this->key = $key; 58 | 59 | return $this; 60 | } 61 | 62 | /** 63 | * @param string $subKey 64 | * 65 | * @return Query 66 | */ 67 | public function setSubKey(string $subKey): self 68 | { 69 | $this->subKey = $subKey; 70 | 71 | return $this; 72 | } 73 | 74 | /** 75 | * @return string 76 | */ 77 | protected function getFullEndpoint(): string 78 | { 79 | $endpoint = str_replace('{id}', $this->id, self::ENDPOINT); 80 | $endpoint = str_replace('{key}', $this->key, $endpoint); 81 | $endpoint = str_replace('{subKey}', $this->subKey, $endpoint); 82 | 83 | return $endpoint; 84 | } 85 | 86 | /** 87 | * @return bool|void 88 | */ 89 | protected function validateParams() 90 | { 91 | if (empty($this->id)) { 92 | throw WrongData::invalidValuesProvided('ID required to identify a time series dataset.'); 93 | } 94 | 95 | if (empty($this->key)) { 96 | throw WrongData::invalidValuesProvided( 97 | 'Key required to identify data within a dataset. A common example is a symbol such as AAPL.' 98 | ); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /docs/alt-data.md: -------------------------------------------------------------------------------- 1 | # Alternative Data 2 | 3 | ## Social Sentiment 4 | 5 | This endpoint provides social sentiment data from StockTwits. Data can be viewed as a daily value, or by minute for a given date. 6 | 7 | ```php 8 | use \Digitonic\IexCloudSdk\AlternativeData\SocialSentiment; 9 | 10 | $endpoint = new SocialSentiment($client); 11 | $response = $endpoint->setSymbol('aapl') 12 | ->setDate('20191012') // optional 13 | ->setType('minute') // optional 14 | ->get(); 15 | 16 | // Laravel 17 | use \Digitonic\IexCloudSdk\Facades\AlternativeData\SocialSentiment; 18 | 19 | $response = SocialSentiment::setSymbol('aapl') 20 | ->setDate('20191012') // optional 21 | ->setType('minute') // optional 22 | ->get(); 23 | ``` 24 | 25 | **Response** 26 | 27 | ```php 28 | // Default daily 29 | Collection {#275 ▼ 30 | #items: array:4 [▼ 31 | "sentiment" => -0.03563327966 32 | "totalScores" => 133 33 | "positive" => 0.77 34 | "negative" => 0.26 35 | ] 36 | } 37 | 38 | // Minute 39 | Collection {#390 ▼ 40 | #items: array:119 [▼ 41 | 0 => {#277 ▼ 42 | +"sentiment": 0 43 | +"totalScores": 1 44 | +"positive": 1 45 | +"negative": 0 46 | +"minute": "0006" 47 | } 48 | 1 => {#275 ▼ 49 | +"sentiment": 0.5764 50 | +"totalScores": 1 51 | +"positive": 1 52 | +"negative": 0 53 | +"minute": "0009" 54 | } 55 | 2 => {#278 ▼ 56 | +"sentiment": 0 57 | +"totalScores": 1 58 | +"positive": 1 59 | +"negative": 0 60 | +"minute": "0011" 61 | } 62 | 3 => {#272 ▶} 63 | ... 64 | ``` 65 | 66 | 67 | 68 | ## CEO Compensation 69 | 70 | This endpoint provides CEO compensation for a company by symbol. 71 | 72 | **Example** 73 | 74 | ```php 75 | use \Digitonic\IexCloudSdk\AlternativeData\CeoComp; 76 | 77 | $endpoint = new CeoComp($client); 78 | $response = $endpoint->setSymbol('aapl')->get(); 79 | 80 | // Laravel 81 | use \Digitonic\IexCloudSdk\Facades\AlternativeData\CeoComp; 82 | 83 | $response = CeoComp::setSymbol('aapl')->get(); 84 | ``` 85 | 86 | **Response** 87 | 88 | ```php 89 | Collection {#275 ▼ 90 | #items: array:13 [▼ 91 | "symbol" => "AAPL" 92 | "name" => "oykh CtmooiT" 93 | "companyName" => "Apple Inc." 94 | "location" => "pCu,nACrt oei" 95 | "salary" => 3027049 96 | "bonus" => 0 97 | "stockAwards" => 0 98 | "optionAwards" => 0 99 | "nonEquityIncentives" => 12413724 100 | "pensionAndDeferred" => 0 101 | "otherComp" => 687647 102 | "total" => 16079556 103 | "year" => "2047" 104 | ] 105 | } 106 | ``` 107 | -------------------------------------------------------------------------------- /docs/cryptocurrency.md: -------------------------------------------------------------------------------- 1 | # Cryptocurrency 2 | 3 | ## Crypto Book 4 | 5 | This returns a current snapshot of the book for a specified cryptocurrency. 6 | 7 | **Example** 8 | 9 | ```php 10 | use \Digitonic\IexCloudSdk\AlternativeData\Crypto\Book; 11 | 12 | $endpoint = new Book($client); 13 | $response = $endpoint->setSymbol('BTCUSDT')->get(); 14 | 15 | // Laravel 16 | use \Digitonic\IexCloudSdk\Facades\AlternativeData\Crypto\Book; 17 | 18 | $response = Book::setSymbol('BTCUSDT')->get(); 19 | ``` 20 | 21 | **Response** 22 | 23 | ```php 24 | Collection {#272 ▼ 25 | #items: array:2 [▼ 26 | "bids" => array:1 [▼ 27 | 0 => {#277 ▼ 28 | +"price": "8400.34" 29 | +"size": "0.054989" 30 | +"timestamp": 1615268896297 31 | } 32 | ] 33 | "asks" => array:1 [▼ 34 | 0 => {#278 ▼ 35 | +"price": "8479.93" 36 | +"size": "0.033894" 37 | +"timestamp": 1630724675505 38 | } 39 | ] 40 | ] 41 | } 42 | ``` 43 | 44 | ## Crypto Price 45 | 46 | This returns the price for a specified cryptocurrency. 47 | 48 | **Example** 49 | 50 | ```php 51 | use \Digitonic\IexCloudSdk\AlternativeData\Crypto\Price; 52 | 53 | $endpoint = new Price($client); 54 | $response = $endpoint->setSymbol('BTCUSDT')->get(); 55 | 56 | // Laravel 57 | use \Digitonic\IexCloudSdk\Facades\AlternativeData\Crypto\Price; 58 | 59 | $response = Price::setSymbol('BTCUSDT')->get(); 60 | ``` 61 | 62 | **Response** 63 | 64 | ```php 65 | Collection {#275 ▼ 66 | #items: array:2 [▼ 67 | "price" => "8598.47" 68 | "symbol" => "BTCUSDT" 69 | ] 70 | } 71 | ``` 72 | 73 | ## Crypto Quote 74 | 75 | This returns the quote for a specified cryptocurrency. 76 | 77 | **Example** 78 | 79 | ```php 80 | use \Digitonic\IexCloudSdk\AlternativeData\Crypto\Quote; 81 | 82 | $endpoint = new Quote($client); 83 | $response = $endpoint->setSymbol('BTCUSDT')->get(); 84 | 85 | // Laravel 86 | use \Digitonic\IexCloudSdk\Facades\AlternativeData\Crypto\Quote; 87 | 88 | $response = Quote::setSymbol('BTCUSDT')->get(); 89 | ``` 90 | 91 | **Response** 92 | 93 | ```php 94 | Collection {#275 ▼ 95 | #items: array:15 [▼ 96 | "symbol" => "BTCUSDT" 97 | "primaryExchange" => "0" 98 | "sector" => "nrcpercyuytrco" 99 | "calculationPrice" => "realtime" 100 | "latestPrice" => "8498.33" 101 | "latestSource" => "Real time price" 102 | "latestUpdate" => 1597241012754 103 | "latestVolume" => null 104 | "bidPrice" => "8438.55" 105 | "bidSize" => "0.026231" 106 | "askPrice" => "8357" 107 | "askSize" => "0.237439" 108 | "high" => null 109 | "low" => null 110 | "previousClose" => null 111 | ] 112 | } 113 | ``` 114 | -------------------------------------------------------------------------------- /src/Stocks/Batch.php: -------------------------------------------------------------------------------- 1 | symbol = $symbols[0]; 44 | } 45 | 46 | $this->symbols = implode(',', $symbols); 47 | 48 | return $this; 49 | } 50 | 51 | public function setTypes(...$types): self 52 | { 53 | $this->types = implode(',', $types); 54 | 55 | return $this; 56 | } 57 | 58 | public function setRange(string $range): self 59 | { 60 | $this->range = $range; 61 | 62 | return $this; 63 | } 64 | 65 | /** 66 | * @return string 67 | */ 68 | public function getFullEndpoint(): string 69 | { 70 | $params = [ 71 | 'types' => $this->types, 72 | ]; 73 | 74 | if (count(explode(',', $this->symbols)) > 1) { 75 | $params['symbols'] = $this->symbols; 76 | } 77 | 78 | if ($this->range) { 79 | if (in_array('chart', explode(',', $this->types))) { 80 | $params['range'] = $this->range; 81 | } 82 | } 83 | 84 | $query = http_build_query($params); 85 | 86 | $endpoint = str_replace('{symbol}', $this->symbol, self::ENDPOINT); 87 | $endpoint = $endpoint . $query; 88 | 89 | return $endpoint; 90 | } 91 | 92 | /** 93 | * @return bool|void 94 | * @throws WrongData 95 | */ 96 | protected function validateParams(): void 97 | { 98 | if (empty($this->symbols)) { 99 | throw WrongData::invalidValuesProvided('Please provide a symbol to query!'); 100 | } 101 | 102 | if (empty($this->types)) { 103 | throw WrongData::invalidValuesProvided( 104 | 'Types Required: comma delimited list of endpoints to call. ' . 105 | 'The names should match the individual endpoint names. Limited to 10 endpoints.' 106 | ); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `iex-cloud-sdk` will be documented in this file 4 | 5 | ## v0.1.1 - 2020-06-24 6 | 7 | ### Added 8 | 9 | ##### Stocks 10 | 11 | - Quote 12 | 13 | ### Changed 14 | 15 | - Docs - Updated docs to include new endpoints 16 | 17 | ## v0.1.0 - 2019-10-15 18 | 19 | ### Added 20 | 21 | ##### Stocks 22 | 23 | - Company 24 | - News 25 | - Logo 26 | - Previous Day Price 27 | - Price 28 | - Price Target 29 | 30 | ### Changed 31 | 32 | - Docs - Updated docs to include new endpoints 33 | 34 | ## v0.1.0-beta.10 - 2019-10-08 35 | 36 | ### Added 37 | 38 | - Docs - New documentation section hosted on GitHub pages 39 | 40 | ## v0.1.0-beta.9 - 2019-10-05 41 | 42 | ### Changed 43 | 44 | - Refactored Tests for consistency 45 | - Use a `get()` method for returning from GET requests 46 | 47 | ## v0.1.0-beta.8 - 2019-10-05 48 | 49 | ### Added 50 | 51 | ##### Stocks 52 | 53 | - Advanced Stats 54 | - Balance Sheet 55 | - Batch Requests 56 | 57 | ## v0.1.0-beta.7 - 2019-10-04 58 | 59 | ### Added 60 | 61 | ##### Reference Data 62 | 63 | - International Symbols (Region) 64 | - International Symbols (Exchange) 65 | - International Exchanges 66 | - U.S. Exchanges 67 | - U.S. Holidays and Trading Days 68 | - Sectors 69 | - Tags 70 | - Mutual Fund Symbols 71 | - OTC Symbols 72 | - FX Symbols 73 | - Options Symbols 74 | 75 | ## v0.1.0-beta.6 - 2019-10-03 76 | 77 | ### Added 78 | 79 | ##### Alternative Data 80 | 81 | - Social Sentiment 82 | 83 | ##### Investors Exchange Data 84 | 85 | - DEEP Operational Halt Status 86 | - DEEP Official Price 87 | - DEEP Short Sale Price Test Status 88 | - DEEP Trade Break 89 | - DEEP Trading Status 90 | 91 | ##### Reference Data 92 | 93 | - Search 94 | 95 | ## v0.1.0-beta.5 - 2019-10-02 96 | 97 | ### Added 98 | 99 | ##### Alternative Data 100 | 101 | - Crypto Price 102 | - Crypto Book 103 | - Crypto Symbols 104 | 105 | ### Changed 106 | 107 | - Crypto Quote 108 | 109 | ## v0.1.0-beta.4 - 2019-10-01 110 | 111 | ### Added 112 | 113 | ##### Investors Exchange Data 114 | 115 | - DEEP System Event 116 | - DEEP Trades 117 | - Stats Intraday 118 | - Stats Recent 119 | - Stats Records 120 | 121 | ## v0.1.0-beta.3 - 2019-10-01 122 | 123 | ### Added 124 | 125 | ##### Alternative Data 126 | 127 | - Crypto 128 | - CEO Compensation 129 | 130 | ##### Investors Exchange Data 131 | 132 | - TOPS 133 | - TOPS Last 134 | - DEEP 135 | - DEEP Auction 136 | - DEEP Book 137 | - DEEP Security Event 138 | 139 | ## v0.1.0-beta.2 - 2019-09-30 140 | 141 | ### Added 142 | 143 | ##### Data Apis 144 | 145 | - Data Points 146 | - Time Series Inventory 147 | - Time Series Query 148 | 149 | ## v0.1.0-beta.1 - 2019-09-26 150 | 151 | ### Added 152 | 153 | ##### Account 154 | 155 | - Metadata 156 | - Usage 157 | 158 | ##### API System Metadata 159 | 160 | - Status 161 | 162 | ##### Forex / Currencies 163 | 164 | - Exchange Rates 165 | 166 | ##### Reference Data 167 | 168 | - Symbols 169 | - IEX Symbols 170 | -------------------------------------------------------------------------------- /docs/dev-status.md: -------------------------------------------------------------------------------- 1 | # Development Status 2 | 3 | #### Active Development 4 | 5 | Below is a list of endpoints to be implemented. (53/97) 6 | 7 | !> **TODO** Optional query parameters 8 | 9 | ### Account 10 | 11 | - [x] Metadata 12 | - [x] Usage 13 | - [ ] Pay as you go toggle 14 | - [ ] Message Cutoff 15 | 16 | ### Data Apis 17 | 18 | - [x] Data Points 19 | - [x] Time Series Inventory 20 | - [x] Time Series Query 21 | 22 | ### Alternative Data 23 | 24 | - [x] Social Sentiment 25 | - [x] CEO Compensation 26 | - [x] Crypto Book 27 | - [ ] ~~Crypto Events~~ (Streaming Only) 28 | - [x] Crypto Price 29 | - [x] Crypto Quote 30 | 31 | ### API System Metadata 32 | 33 | - [x] Status 34 | 35 | ### Forex / Currencies 36 | 37 | - [x] Exchange Rates 38 | 39 | ### Investors Exchange Data 40 | 41 | - [x] TOPS 42 | - [x] TOPS last 43 | - [x] DEEP 44 | - [x] DEEP Auction 45 | - [x] DEEP Book 46 | - [x] DEEP Operational Halt Status 47 | - [x] DEEP Official Price 48 | - [x] DEEP Security Event 49 | - [x] DEEP Short Sale Price Test Status 50 | - [x] DEEP System Event 51 | - [x] DEEP Trades 52 | - [x] DEEP Trade Break 53 | - [x] DEEP Trading Status 54 | - [ ] Listed Regulation SHO Threshold Securities List 55 | - [ ] Listed Short Interest List 56 | - [ ] Stats Historical Daily 57 | - [ ] Stats Historical Summary 58 | - [x] Stats Intraday 59 | - [x] Stats Recent 60 | - [x] Stats Records 61 | 62 | ### Reference Data 63 | 64 | - [x] Symbols 65 | - [x] Crypto Symbols 66 | - [x] Search 67 | - [x] IEX Symbols 68 | - [x] International Symbols (Region) 69 | - [x] International Symbols (Exchange) 70 | - [x] International Exchanges 71 | - [x] U.S. Exchanges 72 | - [x] U.S. Holidays and Trading Days 73 | - [x] Sectors 74 | - [x] Tags 75 | - [ ] ISIN Mapping 76 | - [x] Mutual Fund Symbols 77 | - [x] OTC Symbols 78 | - [x] FX Symbols 79 | - [x] Options Symbols 80 | 81 | ### Stocks 82 | 83 | - [x] Advanced Stats 84 | - [x] Balance Sheet 85 | - [x] Batch Requests 86 | - [ ] Book 87 | - [ ] Cash Flow 88 | - [ ] Collections 89 | - [x] Company 90 | - [ ] Delayed Quote 91 | - [ ] Dividends 92 | - [ ] Earnings 93 | - [ ] Earnings Today 94 | - [ ] Estimates 95 | - [ ] Financials 96 | - [ ] Fund Ownership 97 | - [ ] Historical Prices 98 | - [ ] Income Statement 99 | - [ ] Insider Roster 100 | - [ ] Insider Summary 101 | - [ ] Insider Transactions 102 | - [ ] Intraday Prices 103 | - [ ] Institutional Ownership 104 | - [ ] IPO Calendar (upcoming) 105 | - [ ] IPO Calendar (today) 106 | - [ ] Key Stats 107 | - [ ] Largest Trades 108 | - [ ] List 109 | - [x] Logo 110 | - [ ] Market Volume 111 | - [x] News 112 | - [ ] OHLC 113 | - [ ] Options (exp dates) 114 | - [ ] Options (data) 115 | - [ ] Peers 116 | - [x] Previous Day Prices 117 | - [x] Price 118 | - [x] Price Target 119 | - [x] Quote 120 | - [ ] Recommendation Trends 121 | - [ ] Sector Performance 122 | - [ ] Splits 123 | - [ ] Upcoming Events (All) 124 | - [ ] Upcoming Events (earnings) 125 | - [ ] Upcoming Events (dividends) 126 | - [ ] Upcoming Events (splits) 127 | - [ ] Upcoming Events (ipos) 128 | - [ ] Volume by Venue 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /src/ReferenceData/USHolTradeDates.php: -------------------------------------------------------------------------------- 1 | validateInput($type, '/(trade|holiday)/mi', 'Type can be trade or holiday'); 51 | 52 | $this->type = $type; 53 | 54 | return $this; 55 | } 56 | 57 | /** 58 | * @param string $direction 59 | * 60 | * @return USHolTradeDates 61 | */ 62 | public function setDirection(string $direction): self 63 | { 64 | $this->validateInput($direction, '/(next|last)/mi', 'Direction can be next or last'); 65 | 66 | $this->direction = $direction; 67 | 68 | return $this; 69 | } 70 | 71 | /** 72 | * @param string $last 73 | * 74 | * @return USHolTradeDates 75 | */ 76 | public function setLast(string $last): self 77 | { 78 | $this->last = (int) $last; 79 | 80 | return $this; 81 | } 82 | 83 | /** 84 | * @param string $startDate 85 | * 86 | * @return USHolTradeDates 87 | */ 88 | public function setStartDate(string $startDate): self 89 | { 90 | $this->validateInput( 91 | $startDate, 92 | '/(20\d{2})(\d{2})(\d{2})/mi', 93 | 'Format date to use YYYYMMDD to fetch sentiment data.' 94 | ); 95 | 96 | $this->startDate = $startDate; 97 | 98 | return $this; 99 | } 100 | 101 | /** 102 | * @return string 103 | */ 104 | protected function getFullEndpoint(): string 105 | { 106 | return self::ENDPOINT; 107 | } 108 | 109 | /** 110 | * @param string $input 111 | * @param string $pattern 112 | * @param string $errorMessage 113 | */ 114 | private function validateInput(string $input, string $pattern, string $errorMessage): void 115 | { 116 | preg_match_all($pattern, $input, $matches, PREG_SET_ORDER, 0); 117 | 118 | if (empty($matches)) { 119 | throw WrongData::invalidValuesProvided($errorMessage); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /GETTING_STARTED.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ```php 4 | $baseUrl = 'https://cloud.iexapis.com/v1/'; 5 | $secretKey = 'xFiXd5RnPhUD8Qz1Q2esNVIFfqmrqgB'; 6 | ``` 7 | 8 | ```php 9 | // Instantiate a new Guzzle client 10 | $guzzle = new Client([ 11 | 'base_uri' => $baseUrl, 12 | 'headers' => [ 13 | 'Accept' => 'application/json', 14 | 'Content-Type' => 'application/json' 15 | ], 16 | 'query' => ['token' => $secretKey] 17 | ]); 18 | ``` 19 | 20 | ```php 21 | // Instantiate a new IEX API client with the Guzzle dependency. 22 | $iexApi = new \Digitonic\IexCloudSdk\Client($guzzle); 23 | ``` 24 | 25 | The IEX API client can now be used as a dependency for communicating with various endpoints. for example, to call the `account/metadata` endpoint - 26 | 27 | ```php 28 | $metadata = new \Digitonic\IexCloudSdk\Account\Metadata($iexApi); 29 | $response = $metadata->get(); 30 | 31 | print_r($response); 32 | ``` 33 | 34 | All endpoints that return data will return data as a `\Illuminate\Support\Collection`. This will provide various utility methods when searching the response. For more information on Laravel Collections see [https://laravel.com/docs/6.x/collections](https://laravel.com/docs/6.x/collections). Please note, this package does not require the full Laravel framework to be used. 35 | 36 | ```php 37 | Collection {#275 ▼ 38 | #items: array:7 [▼ 39 | "payAsYouGoEnabled" => false 40 | "effectiveDate" => 1621337109805 41 | "subscriptionTermType" => "mnlhyto" 42 | "tierName" => "tstar" 43 | "messageLimit" => 514440 44 | "messagesUsed" => 13578 45 | "circuitBreaker" => null 46 | ] 47 | } 48 | ``` 49 | 50 | ### Laravel >5.8 Usage 51 | 52 | The package will auto register the service provider and all Facades. 53 | 54 | You can publish the config file of this package with this command: 55 | 56 | ``` bash 57 | php artisan vendor:publish --provider="Digitonic\IexCloudSdk\IexCloudSdkServiceProvider" 58 | ``` 59 | 60 | The following [config](config/config.php) file will be published in `config/iex-cloud-sdk.php` 61 | 62 | Once you have installed the package, configure your `.env` with the following keys setting the correct values for your account. 63 | 64 | ```bash 65 | IEX_CLOUD_SANDBOX=true 66 | IEX_CLOUD_SECRET_KEY=Tsk_1234567899876543211236547896541c 67 | IEX_CLOUD_PUBLIC_KEY=Tpk_1234567899876543211236547896541c 68 | ``` 69 | 70 | #### IoC container 71 | 72 | The IoC container will automatically resolve the `IEX API` dependencies for you when calling any endpoint. Which means you can just type hint your endpoint to retrieve the object from the container with all configurations in place. 73 | 74 | ```php 75 | // From a constructor 76 | class FooClass { 77 | public function __construct(Digitonic\IexCloudSdk\Account\Metadata $metadata) { 78 | $response = $metadata->get(); 79 | } 80 | } 81 | 82 | // From a method 83 | class BarClass { 84 | public function barMethod(Digitonic\IexCloudSdk\Account\Metadata $metadata) { 85 | $response = $metadata->get(); 86 | } 87 | } 88 | ``` 89 | 90 | Alternatively you may use the facades directly which provides a much faster and fluent interface. 91 | 92 | ```php 93 | $response = Digitonic\IexCloudSdk\Facades\Account\Metadata::get(); 94 | ``` 95 | -------------------------------------------------------------------------------- /docs/quickstart.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | Although the SDK can be used in a standalone application with composer, it works best when it is included with a Laravel application. 4 | 5 | ## Installation 6 | 7 | You can install the package via composer: 8 | 9 | ```bash 10 | composer require digitonic/iex-cloud-sdk 11 | ``` 12 | 13 | ## Basic Usage 14 | 15 | Obtain your secret and public keys from the IEX Console. The base URL can be swapped out for the sandbox URL and paired with sandbox keys will allow your to work in development mode. 16 | ```php 17 | $baseUrl = 'https://cloud.iexapis.com/v1/'; 18 | $secretKey = 'sFiXd5RnPhUD8Qz1Q2esNVIFfqmrqgB'; 19 | $publicKey = 'pFiXd5RnPhUD8Qz1Q2esNVIFfqmrqgB'; 20 | ``` 21 | 22 | The SDK uses Guzzle as dependency for interacting with the HTTP layer. You should instantiate a new Guzzle client with your `$baseUrl` and `$secretKey` as shown below. 23 | 24 | ```php 25 | $guzzle = new Client([ 26 | 'base_uri' => $baseUrl, 27 | 'headers' => [ 28 | 'Accept' => 'application/json', 29 | 'Content-Type' => 'application/json' 30 | ], 31 | 'query' => ['token' => $secretKey] 32 | ]); 33 | ``` 34 | 35 | You can now use the Guzzle client as a dependency for the IEX SDK client. The IEX Client is nothing more than a simple configuration wrapper for the Guzzle client that exposes one method `send()`, this `send` method is public which means you are free to override this or call it directly should you wish. The send method will be used for all endpoints exposed in the SDK and will catch and display any and all data related errors. 36 | 37 | ```php 38 | $client = new \Digitonic\IexCloudSdk\Client($guzzle); 39 | ``` 40 | 41 | The IEX API client can now be used as a dependency for communicating with various endpoints. for example, to call the `account/metadata` endpoint - 42 | 43 | ```php 44 | use \Digitonic\IexCloudSdk\Account\Metadata; 45 | 46 | $metadata = new Metadata($client); 47 | $response = $metadata->get(); 48 | 49 | print_r($response); 50 | ``` 51 | 52 | All endpoints that return data will return data as a `\Illuminate\Support\Collection`. This will provide various utility methods when searching the response. For more information on Laravel Collections see [https://laravel.com/docs/6.x/collections](https://laravel.com/docs/6.x/collections). 53 | 54 | ```php 55 | Collection {#275 ▼ 56 | #items: array:7 [▼ 57 | "payAsYouGoEnabled" => false 58 | "effectiveDate" => 1621337109805 59 | "subscriptionTermType" => "mnlhyto" 60 | "tierName" => "tstar" 61 | "messageLimit" => 514440 62 | "messagesUsed" => 13578 63 | "circuitBreaker" => null 64 | ] 65 | } 66 | ``` 67 | 68 | ## Laravel Usage 69 | 70 | The SDK comes with a Laravel Service Provider to facilitate a much cleaner and streamlined setup. The SDK will only work with Laravel 5.8 and above and as such the package will automatically register the provider and the facades. 71 | 72 | You can publish the config file of this package with this command: 73 | 74 | ``` bash 75 | php artisan vendor:publish --provider="Digitonic\IexCloudSdk\IexCloudSdkServiceProvider" 76 | ``` 77 | 78 | The following [config](config/config.php) file will be published in `config/iex-cloud-sdk.php` 79 | 80 | Once you have installed the package, configure your `.env` with the following keys setting the correct values for your account. 81 | 82 | ```bash 83 | IEX_CLOUD_SANDBOX=true 84 | IEX_CLOUD_SECRET_KEY=Tsk_1234567899876543211236547896541c 85 | IEX_CLOUD_PUBLIC_KEY=Tpk_1234567899876543211236547896541c 86 | ``` 87 | 88 | #### IoC container 89 | 90 | The IoC container will automatically resolve the `IEX API Client` dependencies for you when calling any endpoint. Which means you can just type hint your endpoint to retrieve the object from the container with all configurations in place. 91 | 92 | ```php 93 | use \Digitonic\IexCloudSdk\Account\Metadata; 94 | 95 | // From a constructor 96 | class FooClass { 97 | public function __construct(Metadata $metadata) { 98 | $response = $metadata->get(); 99 | } 100 | } 101 | 102 | // From a method 103 | class BarClass { 104 | public function barMethod(Metadata $metadata) { 105 | $response = $metadata->get(); 106 | } 107 | } 108 | ``` 109 | 110 | Alternatively you may use the facades directly which provides a much faster and fluent interface. 111 | 112 | ```php 113 | use \Digitonic\IexCloudSdk\Facades\Account\Metadata; 114 | 115 | $response = Metadata::get(); 116 | ``` 117 | 118 | Some endpoints require extra parameters being passed to the endpoint object. Please see each endpoint documentation for requirements and example usage. 119 | -------------------------------------------------------------------------------- /docs/data-apis.md: -------------------------------------------------------------------------------- 1 | # Data APIs 2 | 3 | ## Data Points 4 | 5 | Data points are available per symbol and return individual plain text values. Retrieving individual data points is useful for Excel and Google Sheet users, and applications where a single, lightweight value is needed. 6 | 7 | To use this endpoint, you’ll first make a free call to list all available data points for your desired symbol, which can be a security or data category. 8 | 9 | **Example** 10 | 11 | ```php 12 | use \Digitonic\IexCloudSdk\DataApis\DataPoints; 13 | 14 | $endpoint = new DataPoints($client); 15 | $response = $endpoint->setSymbol('aapl')->get(); 16 | 17 | // Laravel 18 | use \Digitonic\IexCloudSdk\Facades\DataApis\DataPoints; 19 | 20 | $response = DataPoints::setSymbol('aapl')->get(); 21 | ``` 22 | 23 | **Response** 24 | 25 | ```php 26 | Collection {#397 ▼ 27 | #items: array:126 [▼ 28 | 0 => {#277 ▼ 29 | +"key": "NEXTDIVIDENDDATE" 30 | +"weight": 1 31 | +"description": "" 32 | +"lastUpdated": "2019-08-09T08:50:31+00:00" 33 | } 34 | 1 => {#275 ▶} 35 | 2 => {#278 ▶} 36 | 3 => {#272 ▶} 37 | 4 => {#267 ▶} 38 | 5 => {#265 ▶} 39 | ... 40 | ``` 41 | Once you find the data point you want, use the key to fetch the individual data point. 42 | 43 | **Example** 44 | 45 | ```php 46 | use \Digitonic\IexCloudSdk\DataApis\DataPoints; 47 | 48 | $endpoint = new DataPoints($client); 49 | $response = $endpoint->setSymbol('aapl') 50 | ->setKey('NEXTDIVIDENDDATE') 51 | ->get(); 52 | 53 | // Laravel 54 | use \Digitonic\IexCloudSdk\Facades\DataApis\DataPoints; 55 | 56 | $response = DataPoints::setSymbol('aapl') 57 | ->setKey('NEXTDIVIDENDDATE') 58 | ->get(); 59 | ``` 60 | 61 | **Response** 62 | 63 | ```php 64 | Collection {#277 ▼ 65 | #items: array:1 [▼ 66 | 0 => "2019-08-20" 67 | ] 68 | } 69 | ``` 70 | 71 | ## Time Series Inventory 72 | 73 | Time series is the most common type of data available, and consists of a collection of data points over a period of time. Time series data is indexed by a single date field, and can be retrieved by any portion of time. 74 | 75 | To use this endpoint, you’ll first make a free call to get an inventory of available time series data. 76 | 77 | **Example** 78 | 79 | ```php 80 | use \Digitonic\IexCloudSdk\DataApis\TimeSeries\Inventory; 81 | 82 | $endpoint = new Inventory($client); 83 | $response = $endpoint->get(); 84 | 85 | // Laravel 86 | use \Digitonic\IexCloudSdk\Facades\DataApis\TimeSeries\Inventory; 87 | 88 | $response = Inventory::get(); 89 | ``` 90 | 91 | **Response** 92 | 93 | ```php 94 | Collection {#281 ▼ 95 | #items: array:1 [▼ 96 | 0 => {#277 ▼ 97 | +"id": "ERAATLIF_OSPRNDCNIE" 98 | +"description": "edas tfaRpieonlcnri" 99 | +"schema": {#275 ▼ 100 | +"type": "object" 101 | +"properties": {#272 ▼ 102 | +"formFiscalYear": {#278 ▼ 103 | +"type": "number" 104 | } 105 | +"formFiscalQuarter": {#267 ▼ 106 | +"type": "number" 107 | } 108 | +"version": {#265 ▼ 109 | +"type": "string" 110 | } 111 | +"periodStart": {#276 ▼ 112 | +"type": "string" 113 | } 114 | +"periodEnd": {#269 ▼ 115 | +"type": "string" 116 | } 117 | +"dateFiled": {#279 ▼ 118 | +"type": "string" 119 | } 120 | +"reportLink": {#280 ▼ 121 | +"type": "string" 122 | } 123 | } 124 | +"required": [] 125 | +"additionalProperties": true 126 | } 127 | +"weight": 5080 128 | +"created": "32240- 001-:13604:9" 129 | +"lastUpdated": "12400- :00-6349:213" 130 | } 131 | ] 132 | } 133 | ``` 134 | A full inventory of time series data is returned by calling /time-series without a data id. The data structure returned is an array of available data sets that includes the data set id, a description of the data set, the data weight, a data schema, date created, and last updated date. The schema defines the minimum data properties for the data set, but note that additional properties can be returned. This is possible when data varies between keys of a given data set. 135 | 136 | Each inventory entry may include a key and subkey which describes what can be used for the key or subkey parameter. 137 | 138 | ## Time Series Query 139 | 140 | Once you find the data set you want, use the id to query the time series data. 141 | 142 | Time series data is queried by a required data set id. For example, “REPORTED_FINANCIALS”. Some time series data sets are broken down further by a data set key. This may commonly be a symbol. For example, REPORTED_FINANCIALS accepts a symbol such as “AAPL” as a key. Data sets can be even further broken down by sub key. For example, REPORTED_FINANCIALS data set with the key “AAPL” can have a sub key of “10-Q” or “10-K”. 143 | 144 | Keys and sub keys will be defined in the data set inventory. 145 | 146 | **Example** 147 | 148 | ```php 149 | use \Digitonic\IexCloudSdk\DataApis\TimeSeries\Query; 150 | 151 | $endpoint = new Inventory($client); 152 | $response = $endpoint->get(); 153 | 154 | // Laravel 155 | use \Digitonic\IexCloudSdk\Facades\DataApis\TimeSeries\Query; 156 | 157 | $response = Query::setId('REPORTED_FINANCIALS') 158 | ->setKey('AAPL') 159 | ->setSubKey('10-Q') 160 | ->get(); 161 | ``` 162 | 163 | !> Query String Parameters still to be implemented 164 | 165 | **Response** 166 | 167 | ```php 168 | Collection {#301 ▼ 169 | #items: array:30 [▼ 170 | 0 => {#277 ▼ 171 | +"id": "EECINTS_RALDFOAIRPN" 172 | +"source": "SEC" 173 | +"key": "ALPA" 174 | +"subkey": "01Q-" 175 | +"updated": 1609211733 176 | +"AccountsPayable": 4921590385 177 | +"formFiscalYear": 2087 178 | +"version": "sgaa-up" 179 | +"periodStart": 1273268848459 180 | +"periodEnd": 1272111501454 181 | +"dateFiled": 1304048033673 182 | +"formFiscalQuarter": 3 183 | +"reportLink": "0001w/vecA03da5ws53ss/pv9e3hgri/tw/315/0ec1/.1r.d090h:2a91tg0/261t0/oa" 184 | +"AccountsReceivableNetCurrent": 2738746127 185 | +"AccruedLiabilities": 3481227682 186 | +"AccumulatedOtherComprehensiveIncomeLossNetOfTax": 53392828 187 | +"AllowanceForDoubtfulAccountsReceivableCurrent": 58043568 188 | +"Assets": 49200608778 189 | +"AssetsCurrent": 36411768693 190 | +"AvailableForSaleSecuritiesCurrent": 18846832822 191 | +"AvailableForSaleSecuritiesNoncurrent": 7134630236 192 | +"CashAndCashEquivalentsAtCarryingValue": 5805755013 193 | +"CashAndCashEquivalentsPeriodIncreaseDecrease": -6433032533 194 | +"CommitmentsAndContingencies": 0 195 | +"CommonStockNoParValue": 0 196 | +"CommonStockSharesAuthorized": 1818958014 197 | +"CommonStockSharesIssued": 896700592 198 | +"CommonStockSharesOutstanding": 916218997 199 | +"CommonStockValue": 8073436587 200 | +"CostOfGoodsAndServicesSold": 17467639130 201 | +"DeferredIncomeTaxExpenseBenefit": -202044184 202 | +"DeferredRevenueCurrent": 8651845268 203 | +"DeferredRevenueNoncurrent": 3719260915 204 | +"DeferredTaxAssetsNetCurrent": 1736495003 205 | +"DepreciationAmortizationAndAccretionNet": 530942016 206 | +"EarningsPerShareBasic": 4.66 207 | +"EarningsPerShareDiluted": 4.58 208 | +"EmployeeServiceShareBasedCompensationCashFlowEffectCashUsedToSettleAwards": -71310080 209 | +"EntityCommonStockSharesOutstanding": 918060910 210 | +"EntityPublicFloat": 95831542710 211 | +"ExcessTaxBenefitFromShareBasedCompensationFinancingActivities": 128369811 212 | +"GainLossOnSaleOfPropertyPlantEquipment": -18362101 213 | +"Goodwill": 217003955 214 | +"GrossProfit": 3132775287 215 | +"IncomeLossFromContinuingOperationsBeforeIncomeTaxesMinorityInterestAndIncomeLossFromEquityMethodInvestments": 5906177733 216 | +"IncomeTaxesPaidNet": 2537284672 217 | +"IncomeTaxExpenseBenefit": 1765366397 218 | +"IncreaseDecreaseInAccountsPayable": -662362318 219 | +"IncreaseDecreaseInAccountsReceivable": 274659341 220 | +"IncreaseDecreaseInDeferredRevenue": 4279857195 221 | +"IncreaseDecreaseInInventories": -132276691 222 | +"IncreaseDecreaseInOtherOperatingAssets": 821126708 223 | +"IncreaseDecreaseInOtherOperatingLiabilities": -208539076 224 | +"IncreaseDecreaseOtherCurrentAssets": 301712345 225 | +"IntangibleAssetsNetExcludingGoodwill": 271072839 226 | +"InventoryNet": 380357258 227 | +"Liabilities": 23222565863 228 | +"LiabilitiesAndStockholdersEquity": 48356475067 229 | +"LiabilitiesCurrent": 17143774626 230 | +"NetCashProvidedByUsedInFinancingActivities": 360762189 231 | +"NetCashProvidedByUsedInInvestingActivities": -13755834742 232 | +"NetCashProvidedByUsedInOperatingActivities": 7319639761 233 | +"NetIncomeLoss": 1254413101 234 | +"NonoperatingIncomeExpense": 286707314 235 | +"OperatingExpenses": 1364587805 236 | +"OperatingIncomeLoss": 5654982022 237 | +"OtherAssetsCurrent": 6199701923 238 | +"OtherAssetsNoncurrent": 3052719603 239 | +"OtherLiabilitiesNoncurrent": 1974929483 240 | +"PaymentsForProceedsFromOtherInvestingActivities": 63505109 241 | +"PaymentsToAcquireAvailableForSaleSecurities": 35742646912 242 | +"PaymentsToAcquireIntangibleAssets": 56884699 243 | +"PaymentsToAcquireOtherInvestments": 62223140 244 | +"PaymentsToAcquireProductiveAssets": 713483118 245 | +"ProceedsFromIssuanceOfCommonStock": 299593198 246 | +"ProceedsFromMaturitiesPrepaymentsAndCallsOfAvailableForSaleSecurities": 12840799027 247 | +"ProceedsFromSaleOfAvailableForSaleSecurities": 9217869605 248 | +"PropertyPlantAndEquipmentAndCapitalizedSoftwareNet": 2766515102 249 | +"ResearchAndDevelopmentExpense": 346967174 250 | +"RetainedEarningsAccumulatedDeficit": 18471282567 251 | +"SalesRevenueNet": 8423777984 252 | +"SellingGeneralAndAdministrativeExpense": 1051686313 253 | +"ShareBasedCompensation": 554779236 254 | +"StockholdersEquity": 26621258478 255 | +"WeightedAverageNumberOfDilutedSharesOutstanding": 942565128 256 | +"WeightedAverageNumberOfSharesOutstandingBasic": 922346050 257 | } 258 | 1 => {#275 ▶} 259 | 2 => {#278 ▶} 260 | 3 => {#272 ▶} 261 | 4 => {#267 ▶} 262 | 5 => {#265 ▶} 263 | 6 => {#276 ▶} 264 | 7 => {#269 ▶} 265 | 8 => {#279 ▶} 266 | 9 => {#280 ▶} 267 | 10 => {#281 ▶} 268 | 11 => {#282 ▶} 269 | 12 => {#283 ▶} 270 | 13 => {#284 ▶} 271 | 14 => {#285 ▶} 272 | 15 => {#286 ▶} 273 | 16 => {#287 ▶} 274 | 17 => {#288 ▶} 275 | 18 => {#289 ▶} 276 | 19 => {#290 …99} 277 | 20 => {#291 …114} 278 | 21 => {#292 …151} 279 | 22 => {#293 …127} 280 | 23 => {#294 …103} 281 | 24 => {#295 …104} 282 | 25 => {#296 …125} 283 | 26 => {#297 …137} 284 | 27 => {#298 …154} 285 | 28 => {#299 …149} 286 | 29 => {#300 …102} 287 | ] 288 | } 289 | ``` 290 | 291 | Read more at [IEX API Docs](https://iexcloud.io/docs/api/#time-series) 292 | -------------------------------------------------------------------------------- /docs/_media/logo-color.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 152 | 154 | 156 | 159 | 160 | 162 | 164 | 167 | 168 | 171 | 173 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /docs/stocks.md: -------------------------------------------------------------------------------- 1 | # Stocks 2 | 3 | ## Advanced Stats 4 | 5 | **Example** 6 | 7 | ```php 8 | use \Digitonic\IexCloudSdk\Stocks\AdvancedStats; 9 | 10 | $endpoint = new AdvancedStats($client); 11 | $response = $endpoint->setSymbol('aapl')->get(); 12 | 13 | // Laravel 14 | use \Digitonic\IexCloudSdk\Facades\Stocks\AdvancedStats; 15 | 16 | $response = AdvancedStats::setSymbol('aapl')->get(); 17 | ``` 18 | 19 | **Response** 20 | 21 | ```php 22 | Collection {#275 ▼ 23 | #items: array:48 [▼ 24 | "week52change" => 0.075238 25 | "week52high" => 239.76 26 | "week52low" => 149 27 | "marketcap" => 1053163233867 28 | "employees" => 136690 29 | "day200MovingAvg" => 198.57 30 | "day50MovingAvg" => 215.01 31 | "float" => 4614803231.65 32 | "avg10Volume" => 30745371.8 33 | "avg30Volume" => 29058999.5 34 | "ttmEPS" => 12.35 35 | "ttmDividendRate" => 3.02 36 | "companyName" => "Apple, Inc." 37 | "sharesOutstanding" => 4631122772 38 | "maxChangePercent" => 237.1558 39 | "year5ChangePercent" => 1.3461 40 | "year2ChangePercent" => 0.496 41 | "year1ChangePercent" => 0.074545 42 | "ytdChangePercent" => 0.461451 43 | "month6ChangePercent" => 0.15767 44 | "month3ChangePercent" => 0.144236 45 | "month1ChangePercent" => 0.029289 46 | "day30ChangePercent" => 0.103451 47 | "day5ChangePercent" => 0.013725 48 | "nextDividendDate" => null 49 | "dividendYield" => 0.013236628206334 50 | "nextEarningsDate" => "2019-10-30" 51 | "exDividendDate" => "2019-08-21" 52 | "peRatio" => 20.21 53 | "beta" => 1.562248155631 54 | "totalCash" => 68907243651 55 | "currentDebt" => 20955390131 56 | "revenue" => 274040365476 57 | "grossProfit" => 106997648374 58 | "totalRevenue" => 270458247991 59 | "EBITDA" => 84232077562 60 | "revenuePerShare" => 59.51 61 | "revenuePerEmployee" => 2023261.99 62 | "debtToEquity" => 1.12 63 | "profitMargin" => 0.2263578794686 64 | "enterpriseValue" => 1123390829444 65 | "enterpriseValueToRevenue" => 4.28 66 | "priceToSales" => 4 67 | "priceToBook" => 10.12045889477 68 | "forwardPERatio" => 20.4 69 | "pegRatio" => -2.91 70 | "peHigh" => 20.19903852975 71 | "peLow" => 12.572083819829 72 | ] 73 | } 74 | ``` 75 | 76 | ## Balance Sheet 77 | 78 | **Example** 79 | 80 | ```php 81 | use \Digitonic\IexCloudSdk\Stocks\BalanceSheet; 82 | 83 | $endpoint = new BalanceSheet($client); 84 | $response = $endpoint->setSymbol('aapl')->get(); 85 | 86 | // Laravel 87 | use \Digitonic\IexCloudSdk\Facades\Stocks\BalanceSheet; 88 | 89 | $response = BalanceSheet::setSymbol('aapl')->get(); 90 | ``` 91 | 92 | **Response** 93 | 94 | ```php 95 | Collection {#278 ▼ 96 | #items: array:2 [▼ 97 | "symbol" => "AAPL" 98 | "balancesheet" => array:1 [▼ 99 | 0 => {#275 ▼ 100 | +"reportDate": "2019-07-12" 101 | +"currentCash": 51892629315 102 | +"shortTermInvestments": 44511654145 103 | +"receivables": 14323141767 104 | +"inventory": 3383336695 105 | +"otherCurrentAssets": 10640238508 106 | +"currentAssets": 136653129099 107 | +"longTermInvestments": 122697842784 108 | +"propertyPlantEquipment": 37856558309 109 | +"goodwill": 0 110 | +"intangibleAssets": null 111 | +"otherAssets": 32797750221 112 | +"totalAssets": 331283423725 113 | +"accountsPayable": 29910817882 114 | +"currentLongTermDebt": 13665033506 115 | +"otherCurrentLiabilities": 38346986429 116 | +"totalCurrentLiabilities": 92191397238 117 | +"longTermDebt": 86007873448 118 | +"otherLiabilities": 6089386415 119 | +"minorityInterest": 0 120 | +"totalLiabilities": 227379607321 121 | +"commonStock": 4654525258 122 | +"retainedEarnings": 56050947878 123 | +"treasuryStock": null 124 | +"capitalSurplus": null 125 | +"shareholderEquity": 100632356740 126 | +"netTangibleAssets": 100390265169 127 | } 128 | ] 129 | ] 130 | } 131 | ``` 132 | 133 | ## Batch Requests 134 | 135 | !> Still to be documented 136 | 137 | ## Company 138 | 139 | **Example** 140 | 141 | ```php 142 | use \Digitonic\IexCloudSdk\Stocks\Company; 143 | 144 | $endpoint = new Company($client); 145 | $response = $endpoint->setSymbol('aapl')->get(); 146 | 147 | // Laravel 148 | use \Digitonic\IexCloudSdk\Facades\Stocks\Company; 149 | 150 | $response = Company::setSymbol('aapl')->get(); 151 | ``` 152 | 153 | **Response** 154 | 155 | ```php 156 | Collection {#275 ▼ 157 | #items: array:20 [▼ 158 | "symbol" => "AAPL" 159 | "companyName" => "Apple, Inc." 160 | "exchange" => "ADQNSA" 161 | "industry" => "eqempesmincmlaEToctutnouni i" 162 | "website" => "h./cmopwtwpt.lw/epa:" 163 | "description" => "do rpa apimkaz giieC rlCg nhlopgaeqV,s ahha, ,fn dsT,lTA)e es uw rf Coam T olsaetS a sgWoA.ai ev,g, rhaletasteri n iocsl,aep si hdGa fEtetdIu,, n tinIngnm d ▶" 164 | "CEO" => "nhoya omTdCo oilDtk" 165 | "securityName" => "cpA.l pneI" 166 | "issueType" => "sc" 167 | "sector" => "icgoeoctllrnncehEoT y" 168 | "primarySicCode" => 3745 169 | "employees" => 136025 170 | "tags" => array:2 [▶] 171 | "address" => "n akrplApPWye Oe a" 172 | "address2" => null 173 | "state" => "AC" 174 | "city" => "tupeCiorn" 175 | "zip" => "1320984-50" 176 | "country" => "SU" 177 | "phone" => "4821.10933.4.7" 178 | ] 179 | } 180 | ``` 181 | 182 | ## Key Stats 183 | 184 | **Example 1** 185 | 186 | ```php 187 | use \Digitonic\IexCloudSdk\Stocks\KeyStats; 188 | 189 | $endpoint = new KeyStats($client); 190 | $response = $endpoint->setSymbol('aapl')->get(); 191 | 192 | // Laravel 193 | use \Digitonic\IexCloudSdk\Facades\KeyStats\Quote; 194 | 195 | $response = KeyStats::setSymbol('aapl')->get(); 196 | ``` 197 | 198 | **Response 1** 199 | 200 | ```php 201 | Collection {#277 ▼ 202 | #items: array:30 [ 203 | "companyName" => "Apple Inc." 204 | "marketcap" => 760334287200 205 | "week52high" => 156.65 206 | "week52low" => 93.63 207 | "week52change" => 58.801903 208 | "sharesOutstanding" => 5213840000 209 | "float" => 5203997571 210 | "avg10Volume" => 2774000 211 | "avg30Volume" => 12774000 212 | "day200MovingAvg" => 140.60541 213 | "day50MovingAvg" => 156.49678 214 | "employees" => 120000 215 | "ttmEPS" => 16.5 216 | "ttmDividendRate" => 2.25 217 | "dividendYield" => 0.021 218 | "nextDividendDate" => "2019-03-01" 219 | "exDividendDate" => "2019-02-08" 220 | "nextEarningsDate" => "2019-01-01" 221 | "peRatio" => 14 222 | "beta" => 1.25 223 | "maxChangePercent" => 153.021 224 | "year5ChangePercent" => 0.59025469322 225 | "year2ChangePercent" => 0.37774498741429 226 | "year1ChangePercent" => 0.39751716851558 227 | "ytdChangePercent" => 0.3665949203616 228 | "month6ChangePercent" => 0.12208398133748 229 | "month3ChangePercent" => 0.084665846658466 230 | "month1ChangePercent" => 0.0096685961452833 231 | "day30ChangePercent" => -0.0027626056999688 232 | "day5ChangePercent" => -0.0057626056999688 233 | ] 234 | 235 | } 236 | ``` 237 | 238 | **Example 2** 239 | 240 | ```php 241 | use \Digitonic\IexCloudSdk\Stocks\KeyStats; 242 | 243 | $endpoint = new KeyStats($client); 244 | $response = $endpoint->setSymbol('aapl')->only('latestPrice')->get(); 245 | 246 | // Laravel 247 | use \Digitonic\IexCloudSdk\Facades\Stocks\KeyStats; 248 | 249 | $response = KeyStats::setSymbol('aapl')->only('day50MovingAvg')->get(); 250 | ``` 251 | 252 | **Response 2** 253 | 254 | ```php 255 | Collection {#277 ▼ 256 | #items: array:1 [▼ 257 | "day50MovingAvg" => 156.49678 258 | ] 259 | } 260 | ``` 261 | 262 | ## Logo 263 | 264 | This is a helper function, but the Google APIs url is standardized. 265 | 266 | **Example** 267 | 268 | ```php 269 | use \Digitonic\IexCloudSdk\Stocks\Logo; 270 | 271 | $endpoint = new Logo($client); 272 | $response = $endpoint->setSymbol('aapl')->get(); 273 | 274 | // Laravel 275 | use \Digitonic\IexCloudSdk\Facades\Stocks\Logo; 276 | 277 | $response = Logo::setSymbol('aapl')->get(); 278 | ``` 279 | 280 | **Response** 281 | 282 | ```php 283 | Collection {#275 ▼ 284 | #items: array:1 [▼ 285 | "url" => "https://storage.googleapis.com/iex/api/logos/AAPL.png" 286 | ] 287 | } 288 | ``` 289 | 290 | ## News 291 | 292 | **Example** 293 | 294 | ```php 295 | use \Digitonic\IexCloudSdk\Stocks\News; 296 | 297 | $endpoint = new News($client); 298 | $response = $endpoint->setSymbol('aapl')->get(); 299 | 300 | // Laravel 301 | use \Digitonic\IexCloudSdk\Facades\Stocks\News; 302 | 303 | $response = News::setSymbol('aapl')->get(); 304 | 305 | // Limit results (between 1 and 50) - default 10 306 | $response = News::setSymbol('aapl')->take(5)->get(); 307 | ``` 308 | 309 | **Response** 310 | 311 | ```php 312 | Collection {#281 ▼ 313 | #items: array:10 [▼ 314 | 0 => {#277 ▼ 315 | +"datetime": 1585798516729 316 | +"headline": "iu McDcxsl ovo kSiosfefllTol ielESdap rs onptotp Aelo" 317 | +"source": "orBs'arn" 318 | +"url": "o-3sp9d2ee/tfa1./pl2cnc--6xti8r2eo0044wdthl5:f485m0-4s/e4ivaued602./s/cc/7icc2" 319 | +"summary": "r yphef-rk s u ki driodoaapiardencselaeshfw ffcpor ehnha loaifeelhaadtf ns5ntaie ctoegfrcithocctcasi gArte enni eddihino2nhastigcnpnt. aT " 320 | +"related": "APLA" 321 | +"image": "7/06pes.4h.fisnem-2//x0w8/-pae093-c2-:i5at5o6/e4s41vte224m0lodcc2ifuc8/c4dgd" 322 | +"lang": "ne" 323 | +"hasPaywall": true 324 | } 325 | 1 => {#275 ▶} 326 | 2 => {#278 ▶} 327 | 3 => {#272 ▶} 328 | 4 => {#267 ▶} 329 | 5 => {#265 ▶} 330 | 6 => {#276 ▶} 331 | 7 => {#269 ▶} 332 | 8 => {#279 ▶} 333 | 9 => {#280 ▶} 334 | ] 335 | } 336 | ``` 337 | 338 | ## Previous Day Price 339 | 340 | **Example** 341 | 342 | ```php 343 | use \Digitonic\IexCloudSdk\Stocks\PreviousDayPrice; 344 | 345 | $endpoint = new PreviousDayPrice($client); 346 | $response = $endpoint->setSymbol('aapl')->get(); 347 | 348 | // Laravel 349 | use \Digitonic\IexCloudSdk\Facades\Stocks\PreviousDayPrice; 350 | 351 | $response = PreviousDayPrice::setSymbol('aapl')->get(); 352 | 353 | // Previous Day Price (market) 354 | $response = PreviousDayPrice::setSymbol('market')->get(); 355 | ``` 356 | 357 | !> Warning: Previous day price for "market" will return all symbols. This can be approx 10-15MB of data and will quite possibly timeout a web request. This should be performed as a background task. 358 | 359 | **Response** 360 | 361 | ```php 362 | Collection {#275 ▼ 363 | #items: array:15 [▼ 364 | "date" => "2019-10-14" 365 | "open" => 241.7 366 | "close" => 239.82 367 | "high" => 244.49 368 | "low" => 246.29 369 | "volume" => 24742033 370 | "uOpen" => 237.9 371 | "uClose" => 241.9 372 | "uHigh" => 238.94 373 | "uLow" => 241.18 374 | "uVolume" => 24954674 375 | "change" => 0 376 | "changePercent" => 0 377 | "changeOverTime" => 0 378 | "symbol" => "AAPL" 379 | ] 380 | } 381 | ``` 382 | 383 | ## Price 384 | 385 | **Example** 386 | 387 | ```php 388 | use \Digitonic\IexCloudSdk\Stocks\Price; 389 | 390 | $endpoint = new Price($client); 391 | $response = $endpoint->setSymbol('aapl')->get(); 392 | 393 | // Laravel 394 | use \Digitonic\IexCloudSdk\Facades\Stocks\Price; 395 | 396 | $response = Price::setSymbol('aapl')->get(); 397 | ``` 398 | 399 | **Response** 400 | 401 | ```php 402 | Collection {#277 ▼ 403 | #items: array:1 [▼ 404 | 0 => 244.25 405 | ] 406 | } 407 | ``` 408 | 409 | ## Price Target 410 | 411 | Provides the latest avg, high, and low analyst price target for a symbol. 412 | 413 | **Example** 414 | 415 | ```php 416 | use \Digitonic\IexCloudSdk\Stocks\PriceTarget; 417 | 418 | $endpoint = new PriceTarget($client); 419 | $response = $endpoint->setSymbol('aapl')->get(); 420 | 421 | // Laravel 422 | use \Digitonic\IexCloudSdk\Facades\Stocks\PriceTarget; 423 | 424 | $response = PriceTarget::setSymbol('aapl')->get(); 425 | ``` 426 | 427 | **Response** 428 | 429 | ```php 430 | Collection {#275 ▼ 431 | #items: array:6 [▼ 432 | "symbol" => "AAPL" 433 | "updatedDate" => "2019-10-21" 434 | "priceTargetAverage" => 239 435 | "priceTargetHigh" => 270 436 | "priceTargetLow" => 156 437 | "numberOfAnalysts" => 39 438 | ] 439 | } 440 | ``` 441 | 442 | ## Quote 443 | 444 | **Example 1** 445 | 446 | ```php 447 | use \Digitonic\IexCloudSdk\Stocks\Quote; 448 | 449 | $endpoint = new Quote($client); 450 | $response = $endpoint->setSymbol('aapl')->get(); 451 | 452 | // Laravel 453 | use \Digitonic\IexCloudSdk\Facades\Stocks\Quote; 454 | 455 | $response = Quote::setSymbol('aapl')->get(); 456 | ``` 457 | 458 | **Response 1** 459 | 460 | ```php 461 | Collection {#277 ▼ 462 | #items: array:1 [▼ 463 | "symbol" => "AAPL", 464 | "companyName" => "Apple Inc.", 465 | "calculationPrice" => "tops", 466 | "open" => 154, 467 | "openTime" => 1506605400394, 468 | "close" => 153.28, 469 | "closeTime" => 1506605400394, 470 | "high" => 154.80, 471 | "low" => 153.25, 472 | "latestPrice" => 158.73, 473 | "latestSource" => "Previous close", 474 | "latestTime" => "September 19, 2017", 475 | "latestUpdate" => 1505779200000, 476 | "latestVolume" => 20567140, 477 | "volume" => 20567140, 478 | "iexRealtimePrice" => 158.71, 479 | "iexRealtimeSize" => 100, 480 | "iexLastUpdated" => 1505851198059, 481 | "delayedPrice" => 158.71, 482 | "delayedPriceTime" => 1505854782437, 483 | "oddLotDelayedPrice" => 158.70, 484 | "oddLotDelayedPriceTime" => 1505854782436, 485 | "extendedPrice" => 159.21, 486 | "extendedChange" => -1.68, 487 | "extendedChangePercent" => -0.0125, 488 | "extendedPriceTime" => 1527082200361, 489 | "previousClose" => 158.73, 490 | "previousVolume" => 22268140, 491 | "change" => -1.67, 492 | "changePercent" => -0.01158, 493 | "iexMarketPercent" => 0.00948, 494 | "iexVolume" => 82451, 495 | "avgTotalVolume" => 29623234, 496 | "iexBidPrice" => 153.01, 497 | "iexBidSize" => 100, 498 | "iexAskPrice" => 158.66, 499 | "iexAskSize" => 100, 500 | "marketCap" => 751627174400, 501 | "week52High" => 159.65, 502 | "week52Low" => 93.63, 503 | "ytdChange" => 0.3665, 504 | "peRatio" => 17.18, 505 | "lastTradeTime" => 1505779200000, 506 | "isUSMarketOpen" => false 507 | ] 508 | } 509 | ``` 510 | 511 | **Example 2** 512 | 513 | ```php 514 | use \Digitonic\IexCloudSdk\Stocks\Quote; 515 | 516 | $endpoint = new Quote($client); 517 | $response = $endpoint->setSymbol('aapl')->only('latestPrice')->get(); 518 | 519 | // Laravel 520 | use \Digitonic\IexCloudSdk\Facades\Stocks\Quote; 521 | 522 | $response = Quote::setSymbol('aapl')->only('latestPrice')->get(); 523 | ``` 524 | 525 | **Response 2** 526 | 527 | ```php 528 | Collection {#277 ▼ 529 | #items: array:1 [▼ 530 | "latestPrice" => 158.73 531 | ] 532 | } 533 | ``` 534 | --------------------------------------------------------------------------------