tmarois/polygon-php-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.3.1) of this package.

PHP SDK for the Polygon Market API

v1.3.1 2020-05-28 17:29 UTC

This package is auto-updated.

Last update: 2023-01-28 23:21:39 UTC


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.