
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@coinbase-sample/exchange-sdk-ts
Advanced tools
Welcome to the Coinbase Exchange API TypeScript SDK. This TypeScript project was created to allow developers to easily plug into the [Coinbase Exchange API](https://docs.cdp.coinbase.com/exchange/docs/welcome).
Welcome to the Coinbase Exchange API TypeScript SDK. This TypeScript project was created to allow developers to easily plug into the Coinbase Exchange API.
npm install @coinbase-sample/exchange-sdk-ts
The Exchange Typescript SDK sample library is free and open source and released under the Apache License, Version 2.0.
The application and code are only available for demonstration purposes.
Here are a few examples requests:
Configure Credentials
const creds = JSON.parse(process.env.EXCHANGE_CREDENTIALS);
const credentials = new CoinbaseExchangeCredentials(
creds.AccessKey,
creds.SecretKey,
creds.Passphrase
);
const client = new CoinbaseExchangeClient(credentials);
[List Orders]https://docs.cdp.coinbase.com/exchange/reference/exchangerestapi_getorders)
const service = new OrdersService(client);
service
.listOrders()
.then((orders) => {
console.log(orders);
})
.catch(console.error);
const service = new ProductsService(client);
service
.listTradingPairs({entityId: "somePortfolioId"})
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error.message);
});
$10 Market Buy on BTC-USD
client
.createOrder({
portfolioId: "somePortfolioId",
productId: "BTC-USD",
side: OrderSide.BUY,
type: OrderType.Market,
baseQuantity: "0.0001"
})
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error.message);
});
npm install
To build the project, run the following command:
npm run build
Note: To avoid potential issues, do not forget to build your project again after making any changes to it.
After building the project, each .ts
file will have its .js
counterpart generated.
To run a file, use the following command:
node dist/{INSERT-FILENAME}.js
For example, a main.ts
file would be run like:
node dist/main.js
FAQs
Welcome to the Coinbase Exchange API TypeScript SDK. This TypeScript project was created to allow developers to easily plug into the [Coinbase Exchange API](https://docs.cdp.coinbase.com/exchange/docs/welcome).
We found that @coinbase-sample/exchange-sdk-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.