confessore / CoinbaseAT

The unofficial .NET/C# client library for the Coinbase Advanced Trade API
MIT License
2 stars 1 forks source link

Any code samples? #4

Open pjsgsy opened 6 months ago

pjsgsy commented 6 months ago

Hi, Thanks for this. Are there any simple code examples demonstrating the use of the library available, to get people started? I don't see anything in the source distribution and no Wiki. I guess people may already be familiar with the API, but, my first dabble!

Thanks.

confessore commented 6 months ago

hi I will post some in just a moment

confessore commented 6 months ago

here is an example of a quartz job that observes and stores a trading pair. some custom models are being used here.

we can register the configuration and service into a net di container like so

var configuration = new CoinbaseATConfiguration(
    Environment.GetEnvironmentVariable("COINBASE_API_KEY") ?? "",
    Environment.GetEnvironmentVariable("COINBASE_API_SECRET") ?? ""
);
builder.Services.AddSingleton<ICoinbaseATConfiguration>(configuration);
builder.Services.AddSingleton<ICoinbaseATClient, CoinbaseATClient>();

https://gist.github.com/confessore/fa30403dedd9e795952f88e26db476e5