{"id":30974078,"url":"https://github.com/bitquery/bitquery-tradingview-sdk-example","last_synced_at":"2026-02-15T10:09:48.240Z","repository":{"id":309694425,"uuid":"1036688715","full_name":"bitquery/bitquery-tradingview-sdk-example","owner":"bitquery","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-13T08:33:20.000Z","size":185,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-13T10:24:19.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitquery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-12T12:49:09.000Z","updated_at":"2025-08-13T08:33:23.000Z","dependencies_parsed_at":"2025-08-13T10:24:33.244Z","dependency_job_id":null,"html_url":"https://github.com/bitquery/bitquery-tradingview-sdk-example","commit_stats":null,"previous_names":["bitquery/bitquery-tradingview-sdk-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bitquery/bitquery-tradingview-sdk-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitquery%2Fbitquery-tradingview-sdk-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitquery%2Fbitquery-tradingview-sdk-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitquery%2Fbitquery-tradingview-sdk-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitquery%2Fbitquery-tradingview-sdk-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitquery","download_url":"https://codeload.github.com/bitquery/bitquery-tradingview-sdk-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitquery%2Fbitquery-tradingview-sdk-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274752637,"owners_count":25342816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-12T04:10:17.517Z","updated_at":"2026-02-15T10:09:48.235Z","avatar_url":"https://github.com/bitquery.png","language":"HTML","readme":"# Bitquery TradingView SDK — plain HTML demo\n\nSimple demo that hosts TradingView Charting Library and uses `@bitquery/tradingview-sdk` to render charts via a lightweight WebSocket server.\n\nLinks\n- SDK on npm: https://www.npmjs.com/package/@bitquery/tradingview-sdk\n- Get Bitquery Authorization Token key: https://account.bitquery.io/user/api_v2/access_tokens\n- TradingView Charting Library: https://www.tradingview.com/charting-library-docs/\n\nRequirements\n- Bitquery OAuth Token (required) — without it data will not load\n- Access to the TradingView Charting Library\n- Node.js 18+\n\nProject structure (key parts)\n- `public/static/charting_library/` — TradingView assets (place your copy here)\n- `server.mjs` — serves static pages and runs Bitquery WS server\n- `public/{index,currency,token,pair}.html` — demo pages\n\nSetup\n1) Install deps\n```bash\nnpm ci\n```\n2) Place your TradingView Charting Library into:\n```\npublic/static/charting_library/\n```\n3) Create `.env.local`\n```bash\nBITQUERY_OAUTH_TOKEN=YOUR_OAUTH_TOKEN\nWS_PORT=8081\nNEXT_PUBLIC_WS_URL=ws://localhost:8081\n```\n\nRun\n```bash\nnpm run dev\n# Web: http://localhost:3000\n# WS:  ws://localhost:8081\n```\n\nDemo pages\n- `/` — overview and navigation\n- `/currency.html` — currency mode (base: currencyID, quote: 'usd', market: '')\n- `/token.html` — token mode (base: tokenID, quote: 'usd', market: network or 'all')\n- `/pair.html` — pair mode (base: tokenID, quote: quoteTokenID, market: marketID)\n\nMinimal usage\n```html\n\u003cscript type=\"module\"\u003e\n  import { BitqueryWidget } from '@bitquery/tradingview-sdk/dist/client.js';\n  const widget = new BitqueryWidget({\n    base: 'bid:bitcoin',\n    quote: 'usd',\n    market: '',\n    container: document.getElementById('chart'),\n    serverUrl: 'ws://localhost:8081',\n    tradingViewPath: '/static/charting_library/',\n    theme: 'dark',\n  });\n  widget.init();\n\u003c/script\u003e\n```\n\nServer-side (WebSocket)\n\nThis demo runs a lightweight WebSocket server provided by the SDK. Minimal example:\n\n```js\nimport { BitqueryServer } from '@bitquery/tradingview-sdk/server';\n\nconst server = new BitqueryServer({\n  port: process.env.WS_PORT || 8081,\n  apiKey: process.env.BITQUERY_OAUTH_TOKEN, // https://account.bitquery.io/user/api_v2/access_tokens\n  bitqueryEndpoint:'https://streaming.bitquery.io/eap';\n\n});\n\nserver.init();\n```\n\nIn this project, the server is started in `server.mjs` alongside a static file server (Express) and is available at `ws://localhost:8081` by default. Ensure your client `serverUrl` matches it (use `wss://` when serving over HTTPS).\n\nData modes (parameters contract)\n\n- Currency mode\n  - base: currencyID (e.g. `bid:bitcoin`)\n  - quote: `'usd'`\n  - market: empty string `''` (currencies do not have a market)\n\n- Token mode\n  - base: tokenID (e.g. `bid:solana:So1111...`)\n  - quote: `'usd'` \n  - market: a network/market selector. For now, `'all'`; later this will accept a specific network/market value\n\n- Pair mode\n  - base: tokenID (base token)\n  - quote: quoteTokenID (quote token)\n  - market: marketID (DEX pool/market where the pair trades)\n\n- No parameters\n  - If no `base/quote/market` are passed, the widget automatically selects and shows the top currency for the last 24h\n\nLocal development of the SDK (optional)\nIf you maintain the SDK locally, you can link it:\n```bash\n# in the SDK repo\nnpm i \u0026\u0026 npm run build \u0026\u0026 npm link\n\n# in this demo\nnpm link @bitquery/tradingview-sdk\n```\nKeep the SDK dist up-to-date while developing (watch/build).\n\nTroubleshooting\n- Blank chart: make sure the Charting Library is available at `/static/charting_library/`\n- 404 on SDK client: this server exposes `node_modules` under `/vendor`. Ensure `node_modules` exist and imports point to `/vendor/@bitquery/tradingview-sdk/dist/client.js`\n- WebSocket errors: verify the WS server is running (port 8081 by default) and `BITQUERY_OAUTH_TOKEN` is valid\n- Pair mode shows wrong entity: ensure `market` is a real DEX pool/market ID, not a program address\n\n### Server-side configuration\n\nPass `widgetOptions` to the WebSocket server. These options will be sent to clients and applied to the TradingView widget.\n\n```js\nimport { BitqueryServer } from '@bitquery/tradingview-sdk/server';\n\nconst server = new BitqueryServer({\n  port: 8080,\n  apiKey: process.env.BITQUERY_OAUTH_TOKEN,\n  widgetOptions: {\n    locale: 'ru',\n    time_scale: { min_bar_spacing: 2 },\n    overrides: {\n      \"paneProperties.background\": \"#fff1e6\"\n    },\n    studies_overrides: {\n      \"volume.volume.color.0\": \"#ef5350\",\n      \"volume.volume.color.1\": \"#26a69a\",\n      \"volume.volume.transparency\": 70\n    }\n  }\n});\n\nserver.init();\n```\n\n### Client-side overrides\n\nOptionally, pass `widgetOptions` to the browser widget. Client options override server options.\n\n```js\nimport { BitqueryWidget } from '@bitquery/tradingview-sdk';\n\nconst widget = new BitqueryWidget({\n  container: document.getElementById('chart-container'),\n  serverUrl: 'ws://localhost:8080',\n  tradingViewPath: '/static/charting_library/',\n  theme: 'dark',\n  widgetOptions: {\n    // Any TradingView widget options are allowed here\n    locale: 'ru',\n    overrides: { \"paneProperties.background\": \"#e8f5ff\" },\n    time_scale: { min_bar_spacing: 2 },\n    studies_overrides: {\n      \"volume.volume.color.0\": \"#ef5350\",\n      \"volume.volume.color.1\": \"#26a69a\",\n      \"volume.volume.transparency\": 60\n    }\n  }\n});\n\nawait widget.init();\n```\n\nCommonly used keys:\n\n- `locale`: UI language (requires localization files in your Charting Library assets).\n- `overrides`: style overrides (e.g., `paneProperties.background`, legend, grid).\n- `studies_overrides`: study colors and transparency (e.g., volume colors).\n- `time_scale`: chart time scale settings (e.g., `min_bar_spacing`).\n- `enabled_features` / `disabled_features`: toggle Charting Library features (arrays replace previous values).\n\nPrecedence: defaults \u003c server `widgetOptions` \u003c client `widgetOptions`.\n\nTo verify final options in the browser console, set `__debug: true`. The client will print:\n\n`TradingViewWidget: merged widget options → { ... }`.\n\nNotes\n- `.gitignore` already excludes `public/static/charting_library/` and `public/static/datafeeds/` from version control\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitquery%2Fbitquery-tradingview-sdk-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitquery%2Fbitquery-tradingview-sdk-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitquery%2Fbitquery-tradingview-sdk-example/lists"}