Get API key
Historical prices

TradingView charting

The API service implements the parts of TradingView's Universal Data Feed (UDF) that the TradingView Charting Library uses: /config, /symbols, /search and /history.

TradingView datafeed
import { QuotesProvider } from "./datafeeds/udf/src/quotes-provider";
import { Requester } from "./datafeeds/udf/src/requester";
import { UDFCompatibleDatafeedBase } from "./datafeeds/udf/src/udf-compatible-datafeed-base";

class PythDatafeed extends UDFCompatibleDatafeedBase {
  constructor(datafeedUrl: string, headers: Headers) {
    const requester = new Requester(headers);
    super(datafeedUrl, new QuotesProvider(datafeedUrl, requester), requester);
  }
}

// An access token from POST /auth/token, created on a server.
const headers = new Headers({ Authorization: `Bearer ${accessToken}` });
const datafeed = new PythDatafeed("https://pyth.dourolabs.app/v1/real_time", headers);

// Before the token's expires_at, set a new one. The datafeed sends it from the next request.
headers.set("Authorization", `Bearer ${newAccessToken}`);
Datafeed URL
https://pyth.dourolabs.app/v1/{channel}
Browser
Requires an access token from POST /auth/token. The prebuilt dist/bundle.js sends no headers, so build the datafeed from the adapter's src folder, as in the example. Before the token's expires_at, set a new token on the kept Headers object.
Scope
Use these routes only as a chart datafeed. To look up symbols, use List symbols.