tmarois / polygon-php-sdk
PHP SDK for the Polygon Market API
Installs: 47
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Type:package
Requires
- php: >=7
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: 6.*
README
This package acts as the PHP SDK for the Polygon RESTful API.
Installation
Use Composer to install package.
Run composer require tmarois/polygon-php-sdk:^1.0
Getting Started
First you need to instantiate the Polygon
object.
use Polygon\Polygon; $polygon = new Polygon("YOUR_API_KEY");
Example Usage
Stock Snapshot: Get the snapshot of a stock for the given day.
This includes the last trade, last quote, previous day and current day of data.
$response = $polygon->stocks()->getSnapshot('AAPL');
Stock Details: Get the details of the symbol company/entity.
$response = $polygon->stocks()->getDetails('AAPL');
Stock News: Get the details of the symbol company/entity.
$response = $polygon->stocks()->getNews('AAPL', 1, 20);
Last Trade: Get the last trade for a given stock.
$response = $polygon->stocks()->getLastTrade('AAPL');
Last Quote: Get the last quote for a given stock.
$response = $polygon->stocks()->getLastQuote('AAPL');
Trade History: Get historic trades for a ticker.
$response = $polygon->stocks()->getTradeHistory('AAPL','2019-09-25',$limit = 100, $timestampOffset = 0);
Quote History: Get historic NBBO quotes for a ticker.
$response = $polygon->stocks()->getQuoteHistory('AAPL','2019-09-25',$limit = 100, $timestampOffset = 0);
There are more in the Polygon Documentation than what is presented above, if you want to extend this, please send in a pull request or request features you'd like to see added. Thanks!
Contributions
Anyone can contribute to polygon-php-sdk. Please do so by posting issues when you've found something that is unexpected or sending a pull request for improvements.
License
polygon-php-sdk (This Repository) is open-sourced software licensed under the MIT license.
This SDK has no affiliation with Polygon.io, Inc and acts as an unofficial SDK designed to be a simple solution with using PHP applications. Use at your own risk. If you have any issues with the SDK please submit an issue or pull request.