Coinbase Prime API
cURL
curl --request POST \ --url https://api.prime.coinbase.com/v1/allocations/net \ --header 'Content-Type: application/json' \ --data '{ "allocation_id": "<string>", "source_portfolio_id": "<string>", "product_id": "<string>", "order_ids": [ "<string>" ], "allocation_legs": [ { "allocation_leg_id": "<string>", "destination_portfolio_id": "<string>", "amount": "<string>" } ], "size_type": "ALLOCATION_SIZE_TYPE_UNKNOWN", "remainder_destination_portfolio": "<string>", "netting_id": "<string>" }'
{ "body": { "success": true, "netting_id": "<string>", "buy_allocation_id": "<string>", "sell_allocation_id": "<string>", "failure_reason": "<string>" } }
Create net allocation for a given portfolio.
AllocationsService allocationsService = PrimeServiceFactory.createAllocationsService(client); String allocationId = UUID.randomUUID().toString(); String allocationLegId = UUID.randomUUID().toString(); AllocationLeg allocationLeg = new AllocationLeg.Builder() .allocationLegId(allocationLegId) .amount("100") .destinationPortfolioId("DESTINATION_PORTFOLIO_ID_HERE") .build(); CreateNetAllocationRequest request = new CreateNetAllocationRequest.Builder() .sourcePortfolioId("SOURCE_PORTFOLIO_ID_HERE") .allocationId(allocationId) .allocationLegs(new AllocationLeg[]{allocationLeg}) .productId("ETH-USD") .nettingId("NETTING_ID_HERE") .build(); CreateNetAllocationResponse response = allocationsService.createNetAllocation(request);
A successful response.
The response is of type object.
object
Was this page helpful?