Skip to content

coinbase-samples/intx-sdk-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coinbase International Exchange (INTX) Python SDK

Overview

The INTX Python SDK is a sample library that demonstrates the usage of the Coinbase International Exchange (INTX) API via its REST APIs. This SDK provides a structured way to integrate Coinbase INTX functionalities into your Python applications.

License

The INTX Python 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.

Installation

pip install intx-sdk-py

Or install from source:

git clone https://github.com/coinbase-samples/intx-sdk-py.git
cd intx-sdk-py
pip install -e .

Authentication

To use the INTX Python SDK, you will need to create API credentials in the INTX web console under Settings -> API.

Credentials can be stored as environment variables or passed directly. The SDK supports two initialization patterns:

Using .env.example (Recommended)

Copy the example file to .env and then fill in your credentials:

cp .env.example .env
# then edit .env and set your values

Initialize the client:

from intx_sdk import IntxServicesClient

client = IntxServicesClient.from_env()

Using Credentials Object

from intx_sdk import IntxServicesClient
from intx_sdk.credentials import Credentials

credentials = Credentials(
    access_key="your-access-key",
    passphrase="your-passphrase",
    signing_key="your-signing-key"
)

client = IntxServicesClient(credentials)

Environment Configuration

By default, the SDK uses the production environment. To use a different environment, set the INTX_BASE_URL environment variable:

# Use sandbox environment
export INTX_BASE_URL=https://api-n5e1.coinbase.com/api/v1

# Or use production (default)
export INTX_BASE_URL=https://api.international.coinbase.com/api/v1

Alternatively, you can use the exported constants:

from intx_sdk import IntxServicesClient, SANDBOX_BASE_URL, PRODUCTION_BASE_URL

# Use sandbox
client = IntxServicesClient.from_env(base_url=SANDBOX_BASE_URL)

# Use production (or omit base_url parameter for default)
client = IntxServicesClient.from_env(base_url=PRODUCTION_BASE_URL)

# Use custom URL
client = IntxServicesClient.from_env(base_url="https://custom.api.com/v1")

Usage

from intx_sdk import IntxServicesClient
from intx_sdk.services.portfolios import ListPortfoliosRequest

client = IntxServicesClient.from_env()

# List portfolios
request = ListPortfoliosRequest()
response = client.portfolios.list_portfolios(request)
print(response)

For more examples, see the examples directory.

About

Sample Python SDK for the Coinbase International Exchange REST APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages