Closed ronin225 closed 3 years ago
Complete code:
using CoinbasePro.Network.Authentication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
//create an authenticator with your apiKey, apiSecret and passphrase
var authenticator = new Authenticator("xxx", "xxx", "xxx");
//create the CoinbasePro client
var coinbaseProClient = new CoinbasePro.CoinbaseProClient(authenticator);
//use one of the services
var allAccounts = await coinbaseProClient.AccountsService.GetAllAccountsAsync();
foreach (var myscore in allAccounts)
{
string myresult = allAccounts.ToString();
Console.WriteLine(myresult);
}
}
}
}
Output:
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. ConsoleApp1 C:\Users\xxx\source\repos\ConsoleApp1\ConsoleApp1\Program.cs 24 Active
This can now be closed, the correct code which worked for me was:
var allAccounts = coinbaseProClient.AccountsService.GetAllAccountsAsync().Result;
Also if you have trouble with invalid API key, it should infact be the random letters generated by CoinBase and shown ABOVE nickname, NOT the name you give it.
Hi.
I have installed the GDAX libary, and created my CoinBase API key.
I tried to run the first code example:
However it does not compile in Visual Studio 2019, and I recieve this error:
I would very much appreciate any help with this. Many thanks.