I'm having problems doing the simplest tasks such as displaying balance. I'm no pro at node.js but I think I should know enough to do this. Is anyoine familiar with the coinbase node.js API?
Their website contains some basic code for listing accounts but this always returns NULL when I run it:
var Client = require('coinbase').Client;
var client = new Client({'apiKey': 'myApiKeyHere',
'apiSecret': 'myApiSecretHere'});
client.getAccounts({}, function(err, accounts) {
console.log(accounts);
});
->Make an account at coinbase,did you ?
-> Open the following link once logged in :
https://www.coinbase.com/settings/api->Click + New Api Key ->Enter your password ->Select all API wallets for which you suppose to write the code.
->Under Permissions : Tick whatever that applies for your application:
wallet:accounts:create wallet:accounts:delete
wallet:accounts:read wallet:accounts:update
wallet:addresses:create wallet:addresses:read
wallet:buys:create wallet:buys:read
wallet:checkouts:create wallet:checkouts:read
wallet:contacts:read wallet:deposits:create
wallet:deposits:read wallet:notifications:read
wallet:orders:create wallet:orders:read
wallet:orders:refund wallet:payment-methods:delete
Depending on your selection the API would get the details.After clicking create,you will be have a pop-up which displays your API key and API secret.Something like,
API Key details
NOTE: Please store these credentials in a safe place. For your protection, we will not show them again. If you misplace your API key, you should delete this API key and generate a new one.
API Key: DqpXhGBhLAbXdW40y
API Secret: YWPcmKSbKtqgS7do49t5kBiSyA0D397C
In your code,replace the values with the keys like
var Client = require('coinbase').Client;
var client = new Client({'apiKey': DqpXhGBhLAbXdW40y, 'apiSecret': YWPcmKSbKtqgS7do49t5kBiSyA0D397C});
You need an account Id for displaying balance and passing that id as a parameter.You need to write code for that,
//Should return accounts along with the ID
var coinbase = require('coinbase');
var client = new coinbase.Client({'apiKey': DqpXhGBhLAbXdW40y, 'apiSecret': YWPcmKSbKtqgS7do49t5kBiSyA0D397C});
client.getAccounts({}, function(err, accounts) {
accounts.forEach(function(acct) {
console.log('my bal: ' + acct.balance.amount + ' for ' + acct.name);
});
});
Displaying Balance from an account :
//Use the ID returned from above function and pass in that <Account ID> parameter
var coinbase = require('coinbase');
var client = new coinbase.Client({'apiKey': DqpXhGBhLAbXdW40y, 'apiSecret': YWPcmKSbKtqgS7do49t5kBiSyA0D397C});
client.getAccount('<ACCOUNT ID>', function(err, account) {
console.log('bal: ' + account.balance.amount + ' currency: ' + account.balance.currency);
});
That should be enough to display an account balance.
My Bitcoin address : 17HyAaFmjECaAsQJjWvevqtxb8GA44nxmd
Does anyone have any experience with using this API? I'm willing to offer a $15 tip or more in btc if someone can help me with this API and some of the other node.js APIs. If you are willing to teach me this stuff for a higher fee then feel free to PM me about it. But I'm running on a low budget so I'm not in a position to pay the price of hiring a professional node.js developer.
Send me a message .I'll be more than happy to teach you things.