goapi-io/php-sdk

GOAPI.IO PHP SDK

1.0.3 2024-11-01 01:27 UTC

This package is auto-updated.

Last update: 2024-11-01 01:30:19 UTC


README

Test

This is the official GOAPI.IO SDK for PHP. It provides a set of functions and classes to interact with the Goapi API.

Requirements

  • PHP 8.1 or higher
  • GuzzleHttp library

Installation

You can install the SDK using Composer. Run the following command in your project directory:

composer require goapi-io/php-sdk

Stock Market Data (IDX)

Create Instance

To use the SDK, you need to include the autoloader and create an instance of the main class. Here is an example:

require 'vendor/autoload.php';

$client = new GOAPI\IO\Client(['api_key' => 'your_api_key']);

$marketDataIDX = $client->createStockIDX();

Get all listed companies

$companies = $marketDataIDX->getCompanies();

The $companies response is a Collection with GOAPI\IO\Resources\Stock\Company items data.

Get Detail Company Profile

$profile = $marketDataIDX->getProfile('BBCA');

Get price by symbols

$prices = $marketDataIDX->getStockPrices(['AALI','BBCA']);

The $prices is a Collection with StockPrice items data.

Get historical price by symbol

// maximum date range (from-to) is 1 year.
$historicalPrice = $marketDataIDX->getHistoricalData('BBCA', '2023-10-01', '2023-10-20');

The $historicalPrice is a Collection with StockPrice items data.

Get trending, top loser, top gainer

$trending = $marketDataIDX->getTrendingStocks();
$gainer = $marketDataIDX->getTopGainerStocks();
$loser = $marketDataIDX->getTopLoserStocks();

The $trending,$gainer, $loser is a Collection with StockPriceChange items data.

Get Broker Summary

$brokerSum = $marketDataIDX->getBrokerSummary('BBCA', '2023-10-30');

The $brokerSum is a Collection with BrokerSummary items data.

Get stock indicators

$indicators = $marketDataIDX->getStockIndicators(page: 1, date: '2023-10-30');

The $indicators is a Collection with StockIndicator items data.

Contributing

If you find any issues or have suggestions for improvement, please open an issue or submit a pull request on GitHub.