The Portfolio Automation endpoints allow you to start, pause, resume, and manage automated rebalancing of portfolios.
Start Portfolio Automation
Starts automated rebalancing for a portfolio.
The unique identifier of the portfolio
Whether to run an initial rebalance immediately after starting
initializeScheduleAutomatically
Set to false for manual-only rebalancing without a schedule
Rebalance interval in milliseconds (default: 6 hours)
curl --request POST \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/start' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: your_api_key_here' \
--data '{
"runRebalanceImmediately": true,
"initializeScheduleAutomatically": true,
"interval": 21600000
}'
const portfolioId = "port_abc123";
const startResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/schedule/start`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key_here",
},
body: JSON.stringify({
runRebalanceImmediately: true, // Run initial rebalance immediately
initializeScheduleAutomatically: true, // Set to false for manual-only rebalancing
interval: 21600000, // 6 hours in milliseconds
}),
}
);
const startResult = await startResponse.json();
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"rebalanceScheduleId": "sched_abc123",
"status": "started",
"message": "Portfolio automation started successfully",
"runRebalanceImmediately": true,
"isAutomated": true,
"intervalMs": 21600000
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Pause Portfolio Automation
Pauses automated rebalancing for a portfolio.
The unique identifier of the portfolio
Optional reason for pausing
curl --request POST \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/pause' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: your_api_key_here' \
--data '{
"reason": "Pausing for market volatility"
}'
const portfolioId = "port_abc123";
const pauseResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/schedule/pause`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key_here",
},
body: JSON.stringify({
reason: "Pausing for market volatility", // Optional reason
}),
}
);
const pauseResult = await pauseResponse.json();
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"scheduleId": "sched_abc123",
"status": "paused",
"message": "Portfolio automation paused successfully",
"paused": true,
"pausedAt": "2023-05-21T13:45:12.345Z",
"reason": "Paused via API: Pausing for market volatility"
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Resume Portfolio Automation
Resumes previously paused automated rebalancing for a portfolio.
The unique identifier of the portfolio
Optional reason for resuming
curl --request POST \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/resume' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: your_api_key_here' \
--data '{
"reason": "Market stabilized"
}'
const portfolioId = "port_abc123";
const resumeResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/schedule/resume`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key_here",
},
body: JSON.stringify({
reason: "Market stabilized", // Optional reason
}),
}
);
const resumeResult = await resumeResponse.json();
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"scheduleId": "sched_abc123",
"status": "active",
"message": "Portfolio automation resumed successfully",
"paused": false,
"resumedAt": "2023-05-21T13:45:12.345Z",
"reason": "Resumed via API: Market stabilized"
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Manually Trigger Rebalance
Manually triggers a portfolio rebalance.
The unique identifier of the portfolio
Set to true to trigger a rebalance even if no schedule exists
curl --request POST \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/trigger' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: your_api_key_here' \
--data '{
"skipScheduleValidation": false
}'
const portfolioId = "port_abc123";
const triggerResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/schedule/trigger`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key_here",
},
body: JSON.stringify({
skipScheduleValidation: false, // Set to true to auto-create schedules if needed
}),
}
);
const triggerResult = await triggerResponse.json();
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"scheduleId": "sched_abc123",
"rebalanceId": "rebal_def456",
"status": "triggered",
"message": "Portfolio rebalance triggered successfully",
"triggerTime": 1684734312
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Check Automation Status
Checks the status of portfolio automation.
The unique identifier of the portfolio
curl --request GET \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/automation/status' \
--header 'X-API-KEY: your_api_key_here'
const portfolioId = "port_abc123";
const statusResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/automation/status`,
{
method: "GET",
headers: {
"X-API-KEY": "your_api_key_here",
},
}
);
const status = await statusResponse.json();
console.log(`Automation status: ${status.data.status}`);
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"status": "active", // or "paused", "inactive", "archived", "error"
"hasAutomation": true,
"message": "Portfolio automation is active",
"rebalanceScheduleId": "sched_abc123",
"details": {
"totalExecutions": 5,
"paused": false,
"pauseReason": null,
"recentActions": [
{
"workflowId": "rebal_def456",
"takenAt": "2023-05-21T13:30:00.000Z",
"scheduledAt": "2023-05-21T13:30:00.000Z"
},
{
"workflowId": "rebal_ghi789",
"takenAt": "2023-05-21T07:30:00.000Z",
"scheduledAt": "2023-05-21T07:30:00.000Z"
}
],
"nextScheduledExecution": "2023-05-21T19:30:00.000Z"
}
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Check Rebalance Status
Checks the status of portfolio rebalancing.
The unique identifier of the portfolio
Number of recent workflows to return
curl --request GET \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/status?limit=5' \
--header 'X-API-KEY: your_api_key_here'
const portfolioId = "port_abc123";
const rebalanceStatusResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/status?limit=5`,
{
method: "GET",
headers: {
"X-API-KEY": "your_api_key_here",
},
}
);
const rebalanceStatus = await rebalanceStatusResponse.json();
console.log(`Rebalance status: ${rebalanceStatus.data.status}`);
console.log(`Recent workflows: ${rebalanceStatus.data.recentWorkflows.length}`);
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"status": "active", // or "paused", "inactive", "error"
"message": "Rebalance schedule is active",
"rebalanceScheduleId": "sched_abc123",
"details": {
"totalExecutions": 5,
"paused": false,
"pauseReason": null,
"nextScheduledExecution": "2023-05-21T19:30:00.000Z"
},
"recentWorkflows": [
{
"workflowId": "rebal_def456",
"runId": "run_jkl012",
"scheduledAt": "2023-05-21T13:30:00.000Z",
"startedAt": "2023-05-21T13:30:00.123Z",
"status": "triggered"
},
{
"workflowId": "rebal_ghi789",
"runId": "run_mno345",
"scheduledAt": "2023-05-21T07:30:00.000Z",
"startedAt": "2023-05-21T07:30:00.456Z",
"status": "triggered"
}
]
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Check Specific Rebalance Execution
Gets detailed information about a specific rebalance execution.
The unique identifier of the portfolio
The ID of the rebalance workflow execution
curl --request GET \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/status/rebal_def456' \
--header 'X-API-KEY: your_api_key_here'
const portfolioId = "port_abc123";
const workflowId = "rebal_def456";
const rebalanceDetailsResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/rebalance/status/${workflowId}`,
{
method: "GET",
headers: {
"X-API-KEY": "your_api_key_here",
},
}
);
const rebalanceDetails = await rebalanceDetailsResponse.json();
console.log(`Rebalance execution status: ${rebalanceDetails.data.status}`);
// status will be one of: "running", "completed", "failed", "canceled", or "terminated"
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"workflowId": "rebal_def456",
"runId": "run_jkl012",
"status": "completed",
"startTime": "2023-05-21T13:30:00.123Z",
"closeTime": "2023-05-21T13:32:45.678Z",
"executionTime": "2023-05-21T13:30:00.123Z",
"taskQueue": "rebalance-queue",
"result": {
"transactionHash": "0xTransactionHash789",
"blockNumber": 12345680,
"gasUsed": "125000",
"effectiveGasPrice": "1000000000",
"status": "success"
},
"error": null,
"historyLength": 32
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}
Update Schedule Interval
Updates the rebalance schedule interval for a portfolio.
The unique identifier of the portfolio
The new interval settings
Interval in milliseconds (min: 1 hour, max: 1 year)
Offset from start time in milliseconds
curl --request POST \
--url 'https://api.glider.fi/v1/portfolio/port_abc123/update-schedule-interval' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: your_api_key_here' \
--data '{
"interval": {
"every": 43200000,
"offset": 0
}
}'
const portfolioId = "port_abc123";
const updateIntervalResponse = await fetch(
`https://api.glider.fi/v1/portfolio/${portfolioId}/update-schedule-interval`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key_here",
},
body: JSON.stringify({
interval: {
every: 43200000, // 12 hours in milliseconds
offset: 0, // Optional: Offset from the start time in milliseconds
},
}),
}
);
const updateIntervalResult = await updateIntervalResponse.json();
{
"success": true,
"data": {
"portfolioId": "port_abc123",
"scheduleId": "sched_abc123",
"previousInterval": {
"every": 21600000,
"offset": 0
},
"newInterval": {
"every": 43200000,
"offset": 0,
"humanReadable": "12 hours"
},
"message": "Portfolio rebalance schedule updated to run every 12 hours",
"nextScheduledRun": "2023-05-22T01:30:00.000Z"
},
"correlationId": "corr_abc123",
"requestId": "req_xyz789",
"timestamp": "2023-05-21T13:45:12.345Z"
}