- import all the rest submodule or a specific submodule
// The entire rest submodule
import { restClient } from "@polygon.io/client-js";
// A specific submodule, in this instance the reference client
import { referenceClient } from "@polygon.io/client-js";
// Headers required to use the Launchpad product.
const edgeHeaders = {
// X-Polygon-Edge-ID is a required Launchpad header. It identifies the Edge User requesting data.
'X-Polygon-Edge-ID': sampleEdgeID,
// X-Polygon-Edge-IP-Address is a required Launchpad header. It denotes the originating IP Address of the Edge User requesting data.
'X-Polygon-Edge-IP-Address': 192.0.2.1,
// X-Polygon-Edge-User-Agent is an optional Launchpad header. It denotes the originating UserAgent of the Edge User requesting data.
'X-Polygon-Edge-User-Agent': useragent
}
const rest = restClient(process.env.POLY_API_KEY);
rest.forex.previousClose("C:EURUSD", {}, { headers: edgeHeaders }).then(/* your success handler */);
const reference = referenceClient(process.env.POLY_API_KEY);
reference.tickers({}, { headers: edgeHeaders }).then(/* your success handler */);