coinbase_cloud_advanced_trade_client 0.4.0 copy "coinbase_cloud_advanced_trade_client: ^0.4.0" to clipboard
coinbase_cloud_advanced_trade_client: ^0.4.0 copied to clipboard

Dart Client for building applications that interact with the Coinbase Cloud Advanced Trade & Pro Crypto Exchange APIs for automated trading and managing accounts.

Coinbase Advanced Trade API Client #

pub version

A Dart client for the Coinbase Advanced Trade API. This package provides an easy-to-use interface for interacting with the Coinbase Advanced Trade API, allowing you to manage your account, place orders, and get market data.

Features #

  • Accounts: Get a list of your accounts and a single account's details.
  • Orders: Create and cancel orders, and get a list of your orders.
  • Products: Get a list of available products, a single product's details, and recent trades for a product.
  • Fills: Get a list of your fills.

Getting started #

Installation #

To use this package, add coinbase_cloud_advanced_trade_client as a dependency in your pubspec.yaml file.

dependencies:
  coinbase_cloud_advanced_trade_client: ^1.0.0 # Replace with the latest version

Then, run dart pub get or flutter pub get.

API Keys #

You will need to generate API keys from your Coinbase account. You can find instructions on how to do this in the Coinbase documentation.

Note: Secret Keys are used as provided by Coinbase with the '\n' new line character breaks within the string.

Credentials Object #

All authenticated functions require a Credentials Object Passed in. This allows for your code using the client to handle multiple accounts.

Usage #

Here is a simple example of how to use the client to get a list of products:

import 'package:coinbase_cloud_advanced_trade_client/coinbase_cloud_advanced_trade_client.dart';

void main() async {
  // Create a credential object with your API key and private key.
  // It is recommended to store these securely, for example, using environment variables.
  final credential = Credential(
    apiKeyName: 'YOUR_API_KEY_NAME',
    privateKeyPEM: 'YOUR_PRIVATE_KEY',
  );

  // Get a list of products.
  try {
    List<Product> products = await getProducts(credential: credential);
    for (var product in products) {
      print('Product: ${product.productId}, Price: ${product.price}');
    }
  } catch (e) {
    print('Error getting products: $e');
  }

  // Get a single product.
  try {
    Product? product = await getProduct(productId: 'BTC-USD', credential: credential);
    if (product != null) {
      print('Product: ${product.productId}, Price: ${product.price}');
    }
  } catch (e) {
    print('Error getting product: $e');
  }
}

For more detailed examples, please see the example/ directory.

Additional information #

Coinbase Advanced Trade API Documentation #

For more information about the Coinbase Advanced Trade API, please see the official Coinbase documentation.

Contributing #

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License #

This package is licensed under the Apache License 2.0.

0
likes
0
points
54
downloads

Publisher

verified publisherhairstonsolutions.com

Weekly Downloads

Dart Client for building applications that interact with the Coinbase Cloud Advanced Trade & Pro Crypto Exchange APIs for automated trading and managing accounts.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto, http, jose

More

Packages that depend on coinbase_cloud_advanced_trade_client