curl --request POST \
--url https://api.prime.coinbase.com/v1/allocations/net \
--header 'Content-Type: application/json' \
--data '
{
"source_portfolio_id": "<string>",
"product_id": "<string>",
"order_ids": [
"<string>"
],
"allocation_legs": [
{
"allocation_leg_id": "<string>",
"destination_portfolio_id": "<string>",
"amount": "<string>"
}
],
"size_type": "BASE",
"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.
curl --request POST \
--url https://api.prime.coinbase.com/v1/allocations/net \
--header 'Content-Type: application/json' \
--data '
{
"source_portfolio_id": "<string>",
"product_id": "<string>",
"order_ids": [
"<string>"
],
"allocation_legs": [
{
"allocation_leg_id": "<string>",
"destination_portfolio_id": "<string>",
"amount": "<string>"
}
],
"size_type": "BASE",
"remainder_destination_portfolio": "<string>",
"netting_id": "<string>"
}
'{
"body": {
"success": true,
"netting_id": "<string>",
"buy_allocation_id": "<string>",
"sell_allocation_id": "<string>",
"failure_reason": "<string>"
}
}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);
var allocationsService = new AllocationsService(client);
var allocationId = Guid.NewGuid();
var allocationLegId = Guid.NewGuid();
var allocationLeg = new AllocationLeg()
{
AllocationLegId = allocationLegId.ToString(),
Amount = "100",
DestinationPortfolioId = "ADD_DESTINATION_PORTFOLIO_ID_HERE",
};
var request = new CreateNetAllocationRequest()
{
AllocationId = allocationId.ToString(),
ProductId = "ETH-USD",
SourcePortfolioId = "ADD_SOURCE_PORTFOLIO_ID_HERE",
AllocationLegs = [ allocationLeg ],
SizeType = Prime.Model.SizeType.PERCENT,
NettingId = "NETTING_ID_HERE",
};
var response = allocationsService.CreateNetAllocation(request);
allocationsService := allocations.NewAllocationsService(client)
allocationId := uuid.New().String()
allocationLegId := uuid.New().String()
allocationLeg := &model.AllocationLeg{
LegId: allocationLegId,
DestinationPortfolioId: "DESTINATION_PORTFOLIO_ID_GOES_HERE",
Amount: "100.0",
}
request := &allocations.CreatePortfolioNetAllocationsRequest{
AllocationId: allocationId,
SourcePortfolioId: "SOURCE_PORTFOLIO_ID_GOES_HERE",
ProductId: "ETH-USD",
AllocationLegs: []*model.AllocationLeg{allocationLeg},
OrderIds: []string{"ORDER_IDS_TO_BE_ALLOCATED_HERE"},
SizeType: "PERCENT",
NettingId: "NETTING_ID_HERE",
}
response, err := allocationsService.CreatePortfolioNetAllocations(context.Background(), request)
prime_client = PrimeClient(credentials)
allocation_id = uuid.uuid4()
allocation_leg_id = uuid.uuid4()
product_id = 'ETH-USD'
size_type = 'PERCENT'
allocation_leg = AllocationLeg(
leg_id=allocation_leg_id,
destination_portfolio_id='DESTINATION_PORTFOLIO_ID_GOES_HERE',
amount='100.0',
)
request = CreatePortfolioNetAllocationsRequest(
allocation_id=allocation_id,
source_portfolio_id='SOURCE_PORTFOLIO_ID_GOES_HERE',
product_id=product_id,
order_ids=['ORDER_ID_GOES_HERE'],
allocation_legs=[allocation_leg],
size_type=size_type,
netting_id='NETTING_ID_HERE',
)
response = prime_client.create_portfolio_net_allocations(request)
primectl create-net-allocation --help
const allocationService = new AllocationService(client);
allocationService.createNetAllocation({
allocationId: uuidv4(),
sourcePortfolioId: "SOURCE_PORTFOLIO_ID_GOES_HERE"
productId: "ETH-USD",
orderIds: ["ORDER_ID_GOES_HERE"],
allocationLegs: [{
legId: uuidv4(),
destinationPortfolioId: "DESTINATION_PORTFOLIO_ID_GOES_HERE",
amount: "100.0",
}]
sizeType: AllocationSizeType.Percent,
nettidId: uuidv4()
}).then(async (response) => {
console.log('Order allocated: ', response);
})
The source portfolio id for the allocation
The product for the allocation
The list of order ids in the allocation
The list of allocation_legs for the allocation
Show child attributes
BASE, QUOTE, PERCENT The portfolio where to allocate the remainder of the size
The ID to identify an in-flight net allocation.
A successful response.
Show child attributes
The success boolean for the post net allocation
The netting_id for the post net allocation
The allocation id of the buy allocation in net allocation
The allocation id of the sell allocation in net allocation
The failure reason for the post net allocation
Was this page helpful?