Skip to content

Commit

Permalink
Fixed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Oct 7, 2024
1 parent 620e2a2 commit ae28a93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Examples/Coinbase.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Coinbase.Net.Interfaces.Clients;
using Microsoft.AspNetCore.Mvc;

var builder = WebApplication.CreateBuilder(args);
Expand Down Expand Up @@ -28,15 +29,15 @@
// Map the endpoint and inject the rest client
app.MapGet("/{Symbol}", async ([FromServices] ICoinbaseRestClient client, string symbol) =>
{
var result = await client.SpotApi.ExchangeData.GetTickersAsync(symbol);
return result.Data.List.First().LastPrice;
var result = await client.AdvancedTradeApi.ExchangeData.GetSymbolAsync(symbol);
return result.Data.LastPrice;
})
.WithOpenApi();


app.MapGet("/Balances", async ([FromServices] ICoinbaseRestClient client) =>
{
var result = await client.SpotApi.Account.GetBalancesAsync();
var result = await client.AdvancedTradeApi.Account.GetAccountsAsync();
return (object)(result.Success ? result.Data : result.Error!);
})
.WithOpenApi();
Expand Down
4 changes: 2 additions & 2 deletions Examples/Coinbase.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// REST
var restClient = new CoinbaseRestClient();
var ticker = await restClient.AdvancedTradeApi.ExchangeData.GetSpotTickersAsync("ETH-USDT");
Console.WriteLine($"Rest client ticker price for ETH-USDT: {ticker.Data.List.First().LastPrice}");
var ticker = await restClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("ETH-USDT");
Console.WriteLine($"Rest client ticker price for ETH-USDT: {ticker.Data.LastPrice}");

Console.WriteLine();
Console.WriteLine("Press enter to start websocket subscription");
Expand Down

0 comments on commit ae28a93

Please sign in to comment.