
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@zufans/coinbase-advanced-trade
Advanced tools
A comprehensive Node.js SDK for Coinbase Advanced Trade API
A comprehensive Node.js SDK for the Coinbase Advanced Trade API, providing easy-to-use methods for trading, account management, and market data retrieval.
npm install @zufans/coinbase-advanced-trade
import CoinbaseAdvancedTrade from '@zufans/coinbase-advanced-trade';
// Initialize the client
const client = new CoinbaseAdvancedTrade(
'your-api-key-name',
'your-api-secret'
);
// List accounts
const accounts = await client.listAccounts();
console.log(accounts);
// Get product information
const product = await client.getProduct('BTC-USD');
console.log(product);
// Create a market order
const order = await client.createOrder(
'unique-client-order-id',
'BTC-USD',
'BUY',
{
market_market_ioc: {
quote_size: '100.00'
}
}
);
console.log(order);
You'll need to obtain API credentials from Coinbase:
const client = new CoinbaseAdvancedTrade(apiKeyName, apiSecret);
listAccounts(params?)
List trading accounts.
const accounts = await client.listAccounts({
limit: 250,
cursor: 'optional-cursor'
});
getAccount(accountUUID)
Get details of a specific account.
const account = await client.getAccount('account-uuid-here');
createOrder(clientOrderId, productId, side, orderConfiguration, options?)
Create a new order.
// Market order
const marketOrder = await client.createOrder(
'client-order-id',
'BTC-USD',
'BUY',
{
market_market_ioc: {
quote_size: '100.00'
}
}
);
// Limit order
const limitOrder = await client.createOrder(
'client-order-id',
'BTC-USD',
'BUY',
{
limit_limit_gtc: {
base_size: '0.001',
limit_price: '50000.00',
post_only: false
}
}
);
cancelOrders(orderIds)
Cancel one or more orders.
const result = await client.cancelOrders(['order-id-1', 'order-id-2']);
listOrders(filters?)
List historical orders with optional filters.
const orders = await client.listOrders({
product_ids: ['BTC-USD'],
order_status: ['FILLED'],
limit: 100
});
getOrder(orderId, clientOrderId?)
Get details of a specific order.
const order = await client.getOrder('order-id');
editOrder(orderId, price, size, clientOrderId?)
Edit an existing order.
const result = await client.editOrder('order-id', '51000.00', '0.002');
listProducts(queryParams?)
List available trading products.
const products = await client.listProducts({
limit: 100,
offset: 0
});
getProduct(productId)
Get details of a specific product.
const product = await client.getProduct('BTC-USD');
getBestBidAsk(productId?, params?)
Get best bid/ask for products.
const bidAsk = await client.getBestBidAsk('BTC-USD');
getCandles(productId, queryParams)
Get historical candle data.
const candles = await client.getCandles('BTC-USD', {
start: Math.floor(Date.now() / 1000) - 86400, // 24 hours ago
end: Math.floor(Date.now() / 1000),
granularity: 'ONE_HOUR',
limit: 24
});
Available granularities: ONE_MINUTE
, FIVE_MINUTE
, FIFTEEN_MINUTE
, THIRTY_MINUTE
, ONE_HOUR
, TWO_HOUR
, SIX_HOUR
, ONE_DAY
getMarketTrades(productId, queryParams)
Get recent market trades.
const trades = await client.getMarketTrades('BTC-USD', {
limit: 100
});
getKeyPermissions()
Check API key permissions.
const permissions = await client.getKeyPermissions();
getCurrency(base)
Get currency information.
const currency = await client.getCurrency('BTC');
The SDK supports all Coinbase Advanced Trade order types:
market_market_ioc
limit_limit_gtc
, limit_limit_gtd
, limit_limit_fok
stop_limit_stop_limit_gtc
, stop_limit_stop_limit_gtd
trigger_bracket_gtc
, trigger_bracket_gtd
try {
const order = await client.createOrder(/* ... */);
} catch (error) {
console.error('Order creation failed:', error.message);
// Handle error appropriately
}
You can also import individual functions:
import {
listAccounts,
createOrder,
getProduct,
cbToken
} from '@zufans/coinbase-advanced-trade';
// Use with your own credentials
const accounts = await listAccounts('api-key', 'api-secret');
MIT License - see LICENSE file for details.
For API-related questions, refer to the Coinbase Advanced Trade API Documentation.
For SDK issues, please open an issue on GitHub.
FAQs
A comprehensive Node.js SDK for Coinbase Advanced Trade API
The npm package @zufans/coinbase-advanced-trade receives a total of 2 weekly downloads. As such, @zufans/coinbase-advanced-trade popularity was classified as not popular.
We found that @zufans/coinbase-advanced-trade demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.