advanced_trade library

Classes

Account
Account information.
AvailableBalance
The available balance for an account.
Candle
A candle for a product.
Credential
A credential for accessing the Coinbase API.
CurrencyPair
A representation of a currency pair.
FeeTier
A fee tier for a user.
Fill
A fill for an order.
FuturesPosition
A representation of a futures position.
GoodsAndServicesTax
A goods and services tax.
Hold
The hold value for an account.
KeyPermissions
The permissions for an API key.
LimitGTC
A limit order that is good until canceled.
LimitGTD
A limit order that is good until a specific time.
MarketIOC
A market order that is immediate or cancel.
Money
A representation of money.
Order
An order.
OrderConfiguration
The configuration for an order.
PerpPosition
A representation of a perpetual position.
Portfolio
A portfolio.
PortfolioBalances
A representation of portfolio balances.
PortfolioBreakdown
A representation of a portfolio breakdown.
PriceLevel
A representation of a price level.
Product
A representation of a product.
ProductBook
A representation of a product book.
ServerTime
A representation of the server time.
Signature
A representation of a signature.
SpotPosition
A representation of a spot position.
StopLimitGTC
A stop-limit order that is good until canceled.
StopLimitGTD
A stop-limit order that is good until a certain time.
Ticker
A representation of a ticker.
Trade
A representation of a trade.
TransactionSummary
A representation of a transaction summary.
VolumeBreakdown
A representation of a volume breakdown.
VolumeTypesAndRange
A volume type and range.
Vwap
A representation of the volume-weighted average price.

Enums

OrderSide
The side of the order.
OrderStatus
The status of an order.
OrderType
The type of an order.
ProductType
The type of a product.
RejectReason
The reason an order was rejected.
TimeInForce
The time in force of an order.
TriggerStatus
The status of a trigger.

Constants

coinbaseApiProduction → const String
The production API host for Coinbase.
coinbaseApiSandbox → const String
The sandbox API host for Coinbase.

Functions

cancelOrders({required List<String> orderIds, required Credential credential, bool isSandbox = false, Client? client}) Future<CanceledOrders?>
Cancels a list of orders.
closePosition({required String productId, required Credential credential, bool isSandbox = false, Client? client}) Future<Map<String, dynamic>?>
Closes a position for a given product ID.
convertParamsToString(Map<String, dynamic> queryParameters) String?
Converts a map of query parameters to a string.
createLimitOrder({required String clientOrderId, required String productId, required OrderSide side, required String baseSize, required String limitPrice, bool postOnly = false, required Credential credential, bool isSandbox = false, Client? client}) Future<Map<String, dynamic>?>
Creates a limit order. GTC: Good Till Cancelled. Buy or sell a specified quantity of an Asset at a specified price. If posted, the Order will remain on the Order Book until canceled.
createMarketOrder({required String clientOrderId, required String productId, required OrderSide side, String? quoteSize, String? baseSize, required Credential credential, bool isSandbox = false, Client? client}) Future<Map<String, dynamic>?>
Creates a market order. IOC: Immediate or Cancel. Buy or sell a specified quantity of an Asset at the current best available market price.
createPortfolio({required String name, Client? client, required Credential credential, bool isSandbox = false}) Future<Portfolio?>
Creates a new portfolio.
createStopLimitOrderGTC({required String clientOrderId, required String productId, required OrderSide side, required String baseSize, required String limitPrice, required String stopPrice, required StopDirection stopDirection, required Credential credential, bool isSandbox = false, Client? client}) Future<Map<String, dynamic>?>
Creates a stop limit order. GTC: Good Till Cancelled. An order that triggers a limit order when the last trade price hits a specified stop price.
createStopLimitOrderGTD({required String clientOrderId, required String productId, required OrderSide side, required String baseSize, required String limitPrice, required String stopPrice, required StopDirection stopDirection, required DateTime endTime, required Credential credential, bool isSandbox = false, Client? client}) Future<Map<String, dynamic>?>
Creates a stop limit order. GTD: Good Till Date. An order that triggers a limit order when the last trade price hits a specified stop price. The order will be cancelled if it is not filled by the specified end time.
deleteAuthorized(String endpoint, {Client? client, required Credential credential, bool isSandbox = false}) Future<Response>
Makes an authorized DELETE request to the Coinbase Advanced Trade API.
deletePortfolio({required String uuid, Client? client, required Credential credential, bool isSandbox = false}) Future<bool>
Deletes a portfolio.
editPortfolio({required String uuid, required String name, Client? client, required Credential credential, bool isSandbox = false}) Future<Portfolio?>
Edits a portfolio.
generateCoinbaseJwt(String keyName, String privateKeyPem, String uri) Future<String>
Generates a JWT for authenticating with the Coinbase API.
get(String endpoint, {Map<String, dynamic>? queryParameters, Client? client, bool isSandbox = false}) Future<Response>
Makes a GET request to the Coinbase Advanced Trade API.
getAccount({required String? uuid, Client? client, required Credential credential, bool isSandbox = false}) Future<Account?>
Gets a single account for the current user by UUID.
getAccountBalance({String? uuid, String? currency, Client? client, required Credential credential, bool isSandbox = false}) Future<double?>
Gets the balance of a single account for the current user.
getAccountByCurrency(String currency, {Client? client, required Credential credential, bool isSandbox = false}) Future<Account?>
Gets a single account for the current user by currency.
getAccounts({int? limit = 250, String? cursor, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Account>>
Gets a list of accounts for the current user.
getAuthorized(String endpoint, {Map<String, dynamic>? queryParameters, Client? client, required Credential credential, bool isSandbox = false}) Future<Response>
Makes an authorized GET request to the Coinbase Advanced Trade API.
getBestBidAsk({required List<String> productIds, Client? client, required Credential credential, bool isSandbox = false}) Future<List<ProductBook>>
Gets the best bid and ask for a list of products.
getFills({int? limit = 1000, String? orderId, String? productId, String? cursor, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Fill>>
Gets a list of fills for the current user.
getKeyPermissions({Client? client, required Credential credential, bool isSandbox = false}) Future<KeyPermissions?>
Gets the key permissions.
getMarketTrades({required String productId, int? limit, Client? client, bool isSandbox = false}) Future<Ticker?>
Gets public market trades for a given product ID.
getOrder({required String orderId, Client? client, required Credential credential, bool isSandbox = false}) Future<Order?>
Gets a single historical order for the current user by order ID.
getOrders({int? limit = 1000, String? cursor, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Order>>
Gets a list of historical orders for the current user.
getPortfolioBreakdown({required String uuid, Client? client, required Credential credential, bool isSandbox = false}) Future<PortfolioBreakdown?>
Gets the breakdown of a portfolio.
getProduct({required String productId, Client? client, bool isSandbox = false}) Future<Product?>
Gets a single product by product ID.
getProductAuthorized({required String? productId, bool? getTradabilityStatus, Client? client, required Credential credential, bool isSandbox = false}) Future<Product?>
Gets a single product by product ID.
getProductBook({required String productId, int? limit, Client? client, bool isSandbox = false}) Future<ProductBook?>
Gets a public product book.
getProductBookAuthorized({required String productId, int? limit, Client? client, required Credential credential, bool isSandbox = false}) Future<ProductBook?>
Gets a product book.
getProductCandles({required String productId, required String start, required String end, required String granularity, Client? client, bool isSandbox = false}) Future<List<Candle>>
Gets public product candles.
getProductCandlesAuthorized({required String productId, required String start, required String end, required String granularity, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Candle>>
Gets product candles.
getProducts({int? limit, int? offset, String? productType, List<String>? productIds, String? contractExpiryType, Client? client, bool isSandbox = false}) Future<List<Product>>
Gets a list of products.
getProductsAuthorized({int? offset, String? productType, String? contractExpiryType, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Product>>
Gets a list of products.
getServerTime({Client? client, bool isSandbox = false}) Future<ServerTime?>
Gets the current time from the Coinbase Advanced API.
getTrades({required String? productId, int? limit = 10, Client? client, required Credential credential, bool isSandbox = false}) Future<List<Trade>>
Gets a list of recent market trades for a single product.
getTransactionSummary({String? productType, String? contractExpiryType, String? productVenue, Client? client, required Credential credential, bool isSandbox = false}) Future<TransactionSummary?>
Gets the transaction summary.
listPortfolios({Client? client, required Credential credential, bool isSandbox = false}) Future<List<Portfolio>>
Gets a list of portfolios for the current user.
movePortfolioFunds({required Map<String, String> funds, required String sourcePortfolioUuid, required String targetPortfolioUuid, Client? client, required Credential credential, bool isSandbox = false}) Future<bool>
Moves funds between portfolios.
nullableDouble(Map<String, dynamic> jsonObject, String key, {bool? notNullable = false}) double?
Parses a double from a JSON object, returning null if the value is null or an empty string.
nullableNumber(Map<String, dynamic> jsonObject, String key, {bool? notNullable = false}) num?
Parses a number from a JSON object, returning null if the value is null or an empty string.
postAuthorized(String endpoint, {String? body, Client? client, required Credential credential, bool isSandbox = false}) Future<Response>
Makes an authorized POST request to the Coinbase Advanced Trade API.
putAuthorized(String endpoint, {String? body, Client? client, required Credential credential, bool isSandbox = false}) Future<Response>
Makes an authorized PUT request to the Coinbase Advanced Trade API.