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.
The API retrieve, store, and process stock data directly from 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 |
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 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 are ampersand(&)
separated i.e.
?symbol=BSP&interval=5min
symbol:exchange_name
=
?BSP:PNGX
Dates are in ISO 8601 format i.e. YYYY-MM-DD
or YYYY-MM-DDTHH:mm:ssZ
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. | โ> |
Check the health of the API
GET /api/v2/health
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 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"]} ```
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 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 /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 /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
[{}]
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
}
/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" }
You can create webhooks to subscribe to specific events that occur on NUKU-API.
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"]
}
}
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"
}
}
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"
},
]
}
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
}
The entire application is written in JavaScript and runs on NodeJS environment.
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.
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.
Letโs start development!
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.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Before PR, check to test lastly and then check any errors. If it has no error, commit and then push it!
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.
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.
Have a bug or a feature request? Please open a new issue.
The original author of NUKU-API is Christian Augustyn
Wonder how NUKU-API has been changing for years CHANGELOG
This software is licensed under the MIT License ยฉ Christian Augustyn.
Free Software, Hell Yeah!
ยฉ 2023, Christian Augustyn.