pngx-api

NUKU-API Logo

NUKU-API (formerly PNGX-API)

NUKU-API (formerly PNGX-API) is a RESTFul API that retrieves, stores and processes stock data directly from PNGX. It was formerly part of CrisBot, now a standalone API.

For complete documentation visit https://chrisaugu.github.io/pngx-api/.

GitHub last commit GitHub repo size GitHub forks Github Repo stars GitHub watchers GitHub contributors Build Status Docker Image CI Commitizen friendly

๐Ÿ“‹ Table of Contents


๐Ÿ“œ Description

The API retrieve, store, and process stock data directly from PNGX.

Companies listed on PNGX

Symbol Company
BSP BSP Financial Group Limited
CCP Credit Corporation (PNG) Ltd
CGA PNG Air Limited
CPL CPL Group
KAM Kina Asset Management Limited
KSL Kina Securities Limited
NEM Newmont Corporation
NGP NGIP Agmark Limited
NIU Niuminco Group Limited
SST Steamships Trading Company Limited
STO Santos Limited

Roadmap

We continuously make NUKU-API the only place where all users can obtain the necessary financial data. If you have any questions or ideas about improvement,ย contribute.

๐Ÿ”— API Reference

Endpoints

API endpoints are prefixed with http[s]://example.com/api. WebSocket endpoints are prefixed with ws[s]://example.com/ws. Websocket is only available from >= v2

v1.0.0

Base URL:

GET /api/v1

v2.0.0

Base URL:

GET /api/v2
WS /ws/v2

Parameters

How to separate params

Parameters are ampersand(&) separated i.e. ?symbol=BSP&interval=5min

Exchange

symbol:exchange_name = ?BSP:PNGX

Dates

Dates are in ISO 8601 format i.e. YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ

Errors

Error Codes Status Meaning
300 Multiple Choices ย 
301 Moved Permanently ย 
400 Bad Request ย 
404 Not Found Record requested is no longer available
500 Internal Server Error ย 

Update an existing pet by Id

` GET /api`

Request

curl -i -H 'Accept: application/json' https://example.com/api

Params

Parameter Type Description ย  ย 
<!โ€“ apiKey string Required. Your API key โ€“>
<!โ€“ dateFrom string Required. โ€“>
<!โ€“ dateTo string Required. โ€“>

API Health

Check the health of the API

GET /api/v2/health

Get all ticker symbols

Get all ticker symbols available on PNGX

GET /api/v2/tickers

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/tickers

Response

    HTTP/1.1 200 OK
    Date: Sat, 02 Oct 2021 03:25:07 GMT
    Status: 200 OK
    Connection: close
    Content-Type: application/json
    Content-Length: 85

    {"symbols":["BSP","CCP","CGA","COY","CPL","KAM","KSL","NCM","NGP","NIU","OSH","SST"]}

Get ticker data

Get ticker data for a specific ticker symbol

GET /api/v2/tickers/:symbol

Params

Parameter Type Description
symbol string Required. Ticker symbol of the stock

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/tickers/BSP

Response ``` HTTP/1.1 200 OK Date: Sat, 02 Oct 2021 03:25:07 GMT Status: 200 OK Connection: close Content-Type: application/json Content-Length: 85

{"symbols":["BSP","CCP","CGA","COY","CPL","KAM","KSL","NCM","NGP","NIU","OSH","S
ST"]} ```

Get latest stocks data

Update an existing pet by Id

GET /api/v2/stocks

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/stocks

Params

Parameter Type Description ย 
<!โ€“ apiKey string Required. Your API key
seasonId string Required.League Id e.g Premier League ย 
dateFrom string Required. ย 
dateTo string Required. โ€“>

Response

    HTTP/1.1 200 OK
    Date: Sat, 02 Oct 2021 03:25:07 GMT
    Status: 200 OK
    Connection: close
    Content-Type: application/json
    Content-Length: 85

    {"symbols":["BSP","CCP","CGA","COY","CPL","KAM","KSL","NCM","NGP","NIU","OSH","S
    ST"]}

Get a historical stock data

Get historical stock data for a specific ticker symbol

GET /api/v2/historicals/:symbol

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/historicals/BSP

Params

Name Location Type Required Description
symbol param string yes ticker symbol of the prefered stock

Query Params

Name Location Type Required Description
date query date no none
start query date no none
end query date no none
field query array no none
start body integer no none

Response

    HTTP/1.1 200 OK
    Date: Sat, 02 Oct 2021 03:25:07 GMT
    Status: 200 OK
    Connection: close
    Content-Type: application/json
    Content-Length: 85
    
    {"symbol": "BSP", "historical": [{}]}

Get a non-existent historical stock data

GET /api/v2/historicals/:symbol

Request Request a non-existent symbol

curl -i -H 'Accept: application/json' https://example.com/api/v2/historicals/HIL

Response

    HTTP/1.1 200 OK
    Date: Sat, 02 Oct 2021 03:25:07[^1] GMT
    Status: 200 OK
    Connection: close
    Content-Type: application/json
    Content-Length: 85

    {"status":404,"reason":"Not found"}

Get news

Get news

GET /api/v2/news

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/news

Response

    HTTP/1.1 200 OK
    Date: Sat, 02 Oct 2021 03:25:07[^1] GMT
    Status: 200 OK
    Connection: close
    Content-Type: application/json
    Content-Length: 85

    [{}]

Market Status

Get the current market status for local exchanges (whether exchanges are open or close). GET /api/v2/market/status

Request

curl -i -H 'Accept: application/json' https://example.com/api/v2/market/status

Response

{
    "marketStatus": "open",
    "session": "pre-market",
    "timezone": "Pacific/Port_Moresby",
    "t": 1735680000000,
    "source": "PNGX",
    "lastUpdated": "2023-10-01T00:00:00Z",
    "exchange": "PG",
    "holiday": null,
    "isOpen": false
}

Real-time Events

Watchlist

Tickers

/events?topics=tickers:BSP

Request:

{
    "event": "topic",
    "data": "message"
}

Request:

{
    "Authorization": "abc",
    "X-Access-Token": "abc",
    "X-Channel": "events",
    "X-Topics": "tickers:*",
    "X-API-Version": "v1"
}

How to integrate with third-parties

Webhook

You can create webhooks to subscribe to specific events that occur on NUKU-API.

Register Webhook

Register your callback function via the API to be notified the stock market events.

To register a webhook, send a POST request to Register Webhook Callback with a JSON body containing your webhook URL, the event type you want to be notified about, and an optional workflow ID.

For example:

{
    "eventTypes": [""],
    "endpointUrl": "<https://www.example.com/api/callback>",
}
curl --request POST \
     --url https://api.nuku-api.com.pg/api/webhook \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
        {
            "endpointUrl": "<https://your_website.com/webhook>",
            "eventTypes": ["workflowRun.completed"]
        }
    '

You will receive a response with the details of your registered webhook:

{
  "status": "success",
  "data": {
    "id": "<id of webhook>",
    "endpointUrl": "<https://mywebsite.com/webhook>",
    "eventTypes": ["workflowRun.completed"]
  }
}

View Webhook

You can view the details of a webhook endpoint via the API.

curl --request GET \
     --url https://api.nuku-api.com.pg/api/webhook/webhook_id \
     --header 'accept: application/json'

To view a webhook, send a GET request to https://api.nuku-api.com.pg/api/webhook/<webhook_id>.

You will receive a response with the details of the webhook.

{
	"status": "success",
	"data": {
		"id": "<webhook_id>",
		"url": "<https://mywebsite.com/webhook>",
		"eventType": "workflowRun.completed"
	}
}

Get All Webhooks

curl --request GET \
     --url 'https://api.nuku-api.com.pg/api/webhook?size=10&page=0' \
     --header 'accept: application/json'

To view all webhooks registered for your workspace, send a GET request to https://api.nuku-api.com.pg/api/webhook.

You will receive a response with the details for all webhooks.

{
    "total": 2,
    "data":
    [
        {
            "id": "<webhook_id>",
            "url": "<https://mywebsite.com/webhook>",
            "eventType": "workflowRun.completed",
            "workflowId": "<workflow_id>"
        },
        {
            "id": "<webhook_id>",
            "url": "<https://mywebsite.com/webhook>",
            "eventType": "workflowRun.started",
            "workflowId": null
        },
        {
            "_id": "680c958aa4fd958428e03da6",
            "url": "http://localhost:5000/api/webhook",
            "headers": {
                "x-cs-signature": "abc",
                "x-cs-timestamp": 1745712000000,
                "x-webhook-token": "abc"
            },
            "events": [
                "subscribe"
            ],
            "secret": "secr3t",
            "isActive": true,
            "description": "hello",
            "createdAt": "2025-04-26T08:12:58.977Z"
        },
    ]
}

Remove Webhook

You can remove a webhook endpoint via the API. To remove a webhook, send a DELETE request to https://api.nuku-api.com.pg/api/webhook/.

curl --request DELETE \
     --url https://api.nuku-api.com.pg/api/webhook/webhook_id \
     --header 'accept: application/json'

You will receive a response with the details for all webhooks.

{
    "success": true
}

๐Ÿ› ๏ธ Tech & Tools

The entire application is written in JavaScript and runs on NodeJS environment.

Dependencies

Nuku uses a number of open source projects to work properly:

And of course NUKU-API itself is open source with a public repository on GitHub.

๐Ÿ‘ฉโ€๐Ÿ’ป Contributing

Want to contribute? Great!

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Make sure you read Contributing Guide before making your contributions.

List of all contributors

๐Ÿง‘โ€๐Ÿ’ปDevelop

Letโ€™s start development!

Logging

LOG_DESTINATION = ./logs.txt
LOG_LEVEL = 'error'

TOAST UI products are open source, so you can create a pull request(PR) after you fix issues. Run npm scripts and develop yourself with the following process.

Setup

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Pull Request

Before PR, check to test lastly and then check any errors. If it has no error, commit and then push it!

๐Ÿ”ง Pull Request Steps

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Fork master branch into your personal repository.

git clone https://github.com/{your-personal-repo}/[[repo name]].git
cd [[repo name]]
npm install

Clone it to local computer. Install node modules. Before starting development, you should check to have any errors.

Running tests

Please make sure to update tests as appropriate.

To run the tests for _schedule_, run `npm install` to install dependencies and then:

npm run test

For more information on PRโ€™s step, please see links of Contributing section.

๐Ÿ› Bug tracker

Have a bug or a feature request? Please open a new issue.

๐Ÿง‘ Author Info

The original author of NUKU-API is Christian Augustyn

๐Ÿงพ Changelog

Wonder how NUKU-API has been changing for years CHANGELOG

๐Ÿ“œ License

This software is licensed under the MIT License ยฉ Christian Augustyn.

Free Software, Hell Yeah!

ยฉ 2023, Christian Augustyn.