CoinbaseSdk.Prime
0.2.0
See the version list below for details.
dotnet add package CoinbaseSdk.Prime --version 0.2.0
NuGet\Install-Package CoinbaseSdk.Prime -Version 0.2.0
<PackageReference Include="CoinbaseSdk.Prime" Version="0.2.0" />
<PackageVersion Include="CoinbaseSdk.Prime" Version="0.2.0" />
<PackageReference Include="CoinbaseSdk.Prime" />
paket add CoinbaseSdk.Prime --version 0.2.0
#r "nuget: CoinbaseSdk.Prime, 0.2.0"
#:package CoinbaseSdk.Prime@0.2.0
#addin nuget:?package=CoinbaseSdk.Prime&version=0.2.0
#tool nuget:?package=CoinbaseSdk.Prime&version=0.2.0
Coinbase Prime .NET SDK
Overview
The Coinbase Prime .NET SDK is a sample library that demonstrates the structure of a Coinbase Prime driver for the REST APIs.
License
The Coinbase Prime .NET 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
The Coinbase Prime .NET SDK is vended through NuGet and available for installation via the dotnet
CLI.
dotnet add package CoinbaseSdk.Prime --version x.y.z
or if using paket:
paket add CoinbaseSdk.Prime --version x.y.z
Usage
To use the Coinbase Prime .NET SDK, initialize the Credentials class and create a new client. The Credentials struct is JSON enabled. Ensure that Prime API credentials are stored in a secure manner.
namespace CoinbaseSdk.PrimeExample.Example
{
using CoinbaseSdk.Core.Credentials;
using CoinbaseSdk.Core.Serialization;
using CoinbaseSdk.Prime.Client;
using CoinbaseSdk.Prime.Model;
using CoinbaseSdk.Prime.Orders;
using CoinbaseSdk.Prime.Portfolios;
class Example
{
static void Main()
{
string? credentialsBlob = Environment.GetEnvironmentVariable("COINBASE_PRIME_CREDENTIALS");
if (credentialsBlob == null)
{
Console.WriteLine("COINBASE_PRIME_CREDENTIALS environment variable not set");
return;
}
string? portfolioId = Environment.GetEnvironmentVariable("COINBASE_PRIME_PORTFOLIO_ID");
if (portfolioId == null)
{
Console.WriteLine("COINBASE_PRIME_PORTFOLIO_ID environment variable not set");
return;
}
var serializer = new JsonUtility();
var credentials = serializer.Deserialize<CoinbaseCredentials>(credentialsBlob);
if (credentials == null)
{
Console.WriteLine("Failed to parse COINBASE_PRIME_CREDENTIALS environment variable");
return;
}
var client = new CoinbasePrimeClient(credentials!);
var portfoliosService = new PortfoliosService(client);
var portfolio = portfoliosService.GetPortfolioById(
new GetPortfolioByIdRequest(portfolioId)).Portfolio!;
Console.WriteLine($"Portfolio: {serializer.Serialize(portfolio)}");
}
}
}
The JSON format expected for COINBASE_PRIME_CREDENTIALS
is:
{
"accessKey": "",
"passphrase": "",
"signingKey": ""
}
For an example of how to use the client, see the Example
file. To execute the example, run the following command:
dotnet run --project src/CoinbaseSdk.PrimeExample/CoinbaseSdk.PrimeExample.csproj
Warning: this does place a limit order for a very small amount of ADA. Please ensure that you have the necessary funds in your account before running this code. The example code should cancel the order, however if something breaks you may need to go manually 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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.