Skip to content

coinbase-samples/intx-sdk-ts

Repository files navigation

Coinbase International Exchange API TypeScript SDK

Overview

Welcome to the Coinbase International Exchange (INTX) API TypeScript SDK. This TypeScript project was created to allow developers to easily plug into the Coinbase INTX API.


License

The Intx 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.

Usage

Here are a few examples requests:

List Portfolios

const portfoliosService = new PortfoliosService(client);

portfoliosService
  .listPortfolios()
  .then((portfolios) => {
    console.log(portfolios);
  })
  .catch((err) => console.log(err));

Get Assets

const assetService = new AssetsService(client);

assetService
  .listAssets()
  .then((assets) => {
    console.log(assets);
  })
  .catch((err) => console.log(err));

Create Order

$10 Market Buy on BTC-USD

client
    .createOrder({
        portfolio: "somePortfolioId",
        clientOrderId: "someClientOrderId",
        instrument: "BTC-USD",
        side: OrderSide.BUY,
        type: OrderType.Market,
        size: "0.0001"
    })
    .then((result) => {
        console.log(result);
    })
    .catch((error) => {
        console.error(error.message);
    });

Development Installation

npm install

Build and Use

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published