CoinbaseSdk.Intx
0.1.0
dotnet add package CoinbaseSdk.Intx --version 0.1.0
NuGet\Install-Package CoinbaseSdk.Intx -Version 0.1.0
<PackageReference Include="CoinbaseSdk.Intx" Version="0.1.0" />
paket add CoinbaseSdk.Intx --version 0.1.0
#r "nuget: CoinbaseSdk.Intx, 0.1.0"
// Install CoinbaseSdk.Intx as a Cake Addin #addin nuget:?package=CoinbaseSdk.Intx&version=0.1.0 // Install CoinbaseSdk.Intx as a Cake Tool #tool nuget:?package=CoinbaseSdk.Intx&version=0.1.0
Coinbase International Exchange (INTX) .NET SDK
Overview
The INTX .NET SDK is a sample library that demonstrates the structure of a Coinbase International Exchange (INTX) driver for the REST APIs.
It is compatible with the .NET Standard 2.0 and .NET Core 3.1 frameworks. It is tested and targeted .NET 5.0+ but is intended for .NET 8.0+.
License
The INTX .NET SDK is a free and open source sample library released under the Apache License, Version 2.0.
The application and code are only available for demonstration purposes.
Installation
The Coinbase INTX .NET SDK is vended through NuGet and available for installation via the dotnet
CLI.
dotnet add package CoinbaseSdk.Intx --version x.y.z
or if using paket:
paket add CoinbaseSdk.Intx --version x.y.z
Usage
To use the Coinbase INTX .NET SDK, initialize the Credentials class and create a new client. The Credentials struct is JSON enabled. Ensure that INTX API credentials are stored in a secure manner.
using CoinbaseSdk.Core.Credentials;
using CoinbaseSdk.Core.Error;
using CoinbaseSdk.Core.Serialization;
using CoinbaseSdk.Intx.Client;
using CoinbaseSdk.Intx.Portfolios;
class Example
{
static async Task Main()
{
string? credentialsBlob = Environment.GetEnvironmentVariable("COINBASE_INTX_CREDENTIALS");
if (credentialsBlob == null)
{
Console.WriteLine("COINBASE_INTX_CREDENTIALS environment variable not set");
return;
}
var serializer = new JsonUtility();
var credentials = serializer.Deserialize<CoinbaseCredentials>(credentialsBlob);
var client = new CoinbaseIntxClient(credentials!, "api-n5e1.coinbase.com/api/v1");
var portfolioService = new PortfoliosService(client);
try {
ListPortfoliosResponse listPortfoliosResponse = portfolioService.ListPortfolios();
foreach (Portfolio portfolio in listPortfoliosResponse.Portfolios)
{
Console.WriteLine($"Portfolio: {serializer.Serialize(portfolio.PortfolioId)}");
}
}
catch (CoinbaseException e)
{
Console.WriteLine($"Error: {e.ToString()}");
return;
}
}
}
}
The JSON format expected for COINBASE_INTX_CREDENTIALS
is:
{
"accessKey": "",
"passphrase": "",
"signingKey": ""
}
For an example of how to use the client, see the Example
class under the CoinbaseSdk.IntxExample.Example namespace.
Warning: this does place a limit order for a very small amount of ETH-USDC. Please ensure that you have the necessary funds in your account before running this code. If you do have the necessary funds, you may need to track the order incase network errors result in an inability to automatically cancel the order.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- CoinbaseSdk.Core (>= 0.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.0 | 144 | 8/19/2024 |