-
Notifications
You must be signed in to change notification settings - Fork 261
feat: six adapter #4805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cll-dawid
wants to merge
10
commits into
main
Choose a base branch
from
feat/six-adapter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: six adapter #4805
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ea46d33
feat: six adapter
cll-dawid 91030ab
Merge branch 'main' into feat/six-adapter
cll-dawid 616b9ad
cr fixes
cll-dawid 1e89dce
fix: CI failures
cll-dawid 9b28919
fix: CI build
cll-dawid bce35a9
feat: hendla marketStatus
cll-dawid 388141f
Merge branch 'main' into feat/six-adapter
cll-dawid c55cb7d
fix: cr fixes
cll-dawid bf49656
feat: fetch marketStatus from SIX Market Base REST endpoint
cll-dawid 42522c5
Merge branch 'main' into feat/six-adapter
cll-dawid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@chainlink/six-adapter': minor | ||
| --- | ||
|
|
||
| New adapter for SIX Exchange and BME equity market data via WebSocket streaming with mTLS authentication | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "name": "@chainlink/six-adapter", | ||
| "version": "0.1.0", | ||
| "description": "Chainlink six adapter.", | ||
| "keywords": [ | ||
| "Chainlink", | ||
| "LINK", | ||
| "blockchain", | ||
| "oracle", | ||
| "six" | ||
| ], | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "repository": { | ||
| "url": "https://github.com/smartcontractkit/external-adapters-js", | ||
| "type": "git" | ||
| }, | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo", | ||
| "prepack": "yarn build", | ||
| "build": "tsc -b", | ||
| "server": "node -e 'require(\"./index.js\").server()'", | ||
| "server:dist": "node -e 'require(\"./dist/index.js\").server()'", | ||
| "start": "yarn server:dist" | ||
| }, | ||
| "devDependencies": { | ||
| "@sinonjs/fake-timers": "9.1.2", | ||
| "@types/jest": "^29.5.14", | ||
| "@types/node": "22.14.1", | ||
| "@types/sinonjs__fake-timers": "8.1.5", | ||
| "@types/ws": "^8", | ||
| "nock": "13.5.6", | ||
| "typescript": "5.8.3" | ||
| }, | ||
| "dependencies": { | ||
| "@chainlink/external-adapter-framework": "2.11.6", | ||
| "tslib": "2.4.1", | ||
| "ws": "^8.18.3" | ||
| } | ||
| } |
|
cll-dawid marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { AdapterConfig } from '@chainlink/external-adapter-framework/config' | ||
|
|
||
| export const config = new AdapterConfig( | ||
| { | ||
| WS_API_ENDPOINT: { | ||
| description: 'SIX WebSocket API endpoint', | ||
| type: 'string', | ||
| default: 'wss://api.six-group.com/web/v2/websocket', | ||
| required: true, | ||
| sensitive: false, | ||
| }, | ||
| CERT_BASE64: { | ||
| description: | ||
| 'Base64-encoded signed certificate (signed-certificate.pem) for mTLS authentication', | ||
| type: 'string', | ||
| required: true, | ||
| sensitive: true, | ||
| }, | ||
| KEY_BASE64: { | ||
| description: 'Base64-encoded private key (private-key.pem) for mTLS authentication', | ||
| type: 'string', | ||
| required: true, | ||
| sensitive: true, | ||
| }, | ||
| CONFLATION_PERIOD: { | ||
| description: 'Conflation period in ISO 8601 duration format (e.g. PT1S for 1 second)', | ||
| type: 'string', | ||
| default: 'PT1S', | ||
| required: false, | ||
| sensitive: false, | ||
| }, | ||
| }, | ||
| { | ||
| envDefaultOverrides: { | ||
| // SIX requires ping every 10s, disconnects after 60s inactivity. | ||
| // Detect zombie connections faster than the default 120s. | ||
| WS_SUBSCRIPTION_UNRESPONSIVE_TTL: 30_000, // 30s without data -> reconnect | ||
| CACHE_MAX_AGE: 10_000, // 10s - data updates every 1s, stale after 10s | ||
| }, | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter/endpoint' | ||
| import { InputParameters } from '@chainlink/external-adapter-framework/validation' | ||
| import { config } from '../config' | ||
| import { generateTransport } from '../transport/price' | ||
|
|
||
| const inputParameters = new InputParameters( | ||
| { | ||
| ticker: { | ||
| aliases: ['base', 'symbol', 'asset'], | ||
| required: true, | ||
| type: 'string', | ||
| description: 'Instrument ticker (e.g. ABBN, ALC, ANA, ANE)', | ||
| }, | ||
| bc: { | ||
| aliases: ['market', 'bourseCode', 'exchange'], | ||
| required: true, | ||
| type: 'string', | ||
| description: 'SIX Bourse Code (e.g. 4 for SIX Swiss Exchange, 1058 for BME)', | ||
| }, | ||
| }, | ||
| [ | ||
| { | ||
| ticker: 'ABBN', | ||
| bc: '4', | ||
| }, | ||
| ], | ||
| ) | ||
|
|
||
| interface PriceResponse { | ||
| Result: number | null | ||
| Data: { | ||
| mid: number | null | ||
| bid: number | null | ||
| bidSize: number | null | ||
| ask: number | null | ||
| askSize: number | null | ||
| lastTradedPrice: number | null | ||
| volume: number | null | ||
| ripcord: boolean | ||
| ripcordAsInt: number | ||
| ripcordDetails?: string | ||
| } | ||
| } | ||
|
|
||
| export type BaseEndpointTypes = { | ||
| Parameters: typeof inputParameters.definition | ||
| Response: PriceResponse | ||
| Settings: typeof config.settings | ||
| } | ||
|
|
||
| const transport = generateTransport() | ||
|
|
||
| export const endpoint = new AdapterEndpoint({ | ||
| name: 'price', | ||
| aliases: ['equity', 'stock'], | ||
| transport, | ||
| inputParameters, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { expose, ServerInstance } from '@chainlink/external-adapter-framework' | ||
| import { Adapter } from '@chainlink/external-adapter-framework/adapter' | ||
| import { config } from './config' | ||
| import { endpoint } from './endpoint/price' | ||
|
|
||
| export const adapter = new Adapter({ | ||
| defaultEndpoint: endpoint.name, | ||
| name: 'SIX', | ||
| config, | ||
| endpoints: [endpoint], | ||
| }) | ||
|
|
||
| export const server = (): Promise<ServerInstance | undefined> => expose(adapter) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.