Coinbase Exchange | Coderz Product

coinbase_exchange

Last updated:

0 purchases

coinbase_exchange Image
coinbase_exchange Images

Free

Languages

Categories

Add to Cart

Description:

coinbase exchange

coinbase_exchange #
An unofficial sdk for the coinbase cloud exchange.

Getting Started #
This project is a Dart sdk the
coinbase exchange api.
This sdk allows for the retrieval of real time pricing data using the coinbase websocket feed and information about
individual profiles on coinbase and coinbase pro. It also allows for the trading of
cryptocurrencies on the coinbase pro platform. This package uses api keys which must be generated
from coinbase pro or the coinbase pro sandbox.
To test to make sure you have generated your keys correctly, create a file test/secrets.dart with the contents:
class Secrets {
static const String apiKey = '';
static const String secretKey = '';
static const String passphrase = '';
}
copied to clipboard
Put in your apiKey, secretKey and passphrase.
In the coinbase_exchange_test.dart file. Then run:
pub run test --chain-stack-traces test/coinbase_exchange_test.dart
copied to clipboard
This will by default execute the tests in the coinbase pro sandbox so make sure you have used the appropriate keys. The tests are currently incomplete and only test Accounts, Coinbase Accounts, Conversions and Currencies.
Websocket Feed #
// Make sure to import the package as something so you dont polute your environment.
import 'package:coinbase_exchange/coinbase_exchange.dart' as cb;

cb.WebsocketClient wsClient = cb.WebsocketClient(sandbox: false);

var stream = wsClient.subscribe(
productIds: ['BTC-USD'],
channels: [
cb.ChannelEnum.heartBeat,
],
);

// The first event is always a subscriptions event which tells you which channels you
// have subscribed to. After the first event it is up to you to manually sort events
// from the stream.
stream.listen((event) {
print(event.toJson().toString());
wsClient.close();
});
copied to clipboard
API #
// Make sure to import the package as something so you dont polute your environment.
import 'package:coinbase_exchange/coinbase_exchange.dart' as cb;

var accounts = await cb.accountsClient.listAccounts();

for (cb.Account account in accounts) {
print(account.currency);
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.