# Strategies

Automation strategy management. Require Privy JWT. Pro subscription required to create strategies.

## List automation strategies

> Returns all automation strategies for the authenticated user, ordered by\
> creation date descending.\
> \
> Strategies are rule-based automation: currently only \`auto\_close\` is supported,\
> which closes a position when the funding rate crosses a threshold.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Strategies","description":"Automation strategy management. Require Privy JWT. Pro subscription required to create strategies."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"StrategiesResponse":{"type":"object","required":["strategies"],"properties":{"strategies":{"type":"array","items":{"$ref":"#/components/schemas/Strategy"}}}},"Strategy":{"type":"object","required":["id","coin","type","condition","threshold","active","created_at"],"properties":{"id":{"type":"string","format":"uuid","description":"Strategy UUID."},"coin":{"type":"string","description":"Asset symbol this strategy monitors."},"type":{"type":"string","enum":["auto_close"],"description":"Strategy type. Currently only auto_close is supported."},"condition":{"type":"string","enum":["above","below"],"description":"Trigger condition relative to the threshold."},"threshold":{"type":"number","format":"double","description":"1-hour funding rate threshold (decimal, not percent) that triggers the strategy."},"active":{"type":"boolean","description":"Whether the strategy is currently running."},"triggered_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the last trigger event. Null if never triggered."},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/strategies":{"get":{"operationId":"getStrategies","summary":"List automation strategies","description":"Returns all automation strategies for the authenticated user, ordered by\ncreation date descending.\n\nStrategies are rule-based automation: currently only `auto_close` is supported,\nwhich closes a position when the funding rate crosses a threshold.\n","tags":["Strategies"],"responses":{"200":{"description":"List of automation strategies.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategiesResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Create automation strategy

> Creates a new automation strategy. Requires an active Pro subscription.\
> \
> Currently only \`auto\_close\` strategy type is supported. The scheduler runs every\
> 60 seconds and closes matching positions when the live funding rate crosses the\
> configured threshold.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Strategies","description":"Automation strategy management. Require Privy JWT. Pro subscription required to create strategies."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"schemas":{"CreateStrategyRequest":{"type":"object","required":["coin","type","condition","threshold"],"properties":{"coin":{"type":"string","description":"Asset symbol to monitor (uppercase)."},"type":{"type":"string","enum":["auto_close"],"description":"Strategy type. Only auto_close is currently supported."},"condition":{"type":"string","enum":["above","below"],"description":"Trigger condition. above = trigger when rate exceeds threshold; below = trigger when rate falls below threshold."},"threshold":{"type":"number","format":"double","description":"1-hour funding rate threshold as a decimal (e.g. 0.000005 = 0.0005% per hour)."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"responses":{"BadRequest":{"description":"Invalid request parameters or body.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Authenticated but insufficient permissions (e.g. Pro subscription required).","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/strategies":{"post":{"operationId":"createStrategy","summary":"Create automation strategy","description":"Creates a new automation strategy. Requires an active Pro subscription.\n\nCurrently only `auto_close` strategy type is supported. The scheduler runs every\n60 seconds and closes matching positions when the live funding rate crosses the\nconfigured threshold.\n","tags":["Strategies"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStrategyRequest"}}}},"responses":{"200":{"description":"Strategy created.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid","description":"ID of the newly created strategy."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Delete a strategy

> Permanently deletes an automation strategy. The strategy must belong to the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Strategies","description":"Automation strategy management. Require Privy JWT. Pro subscription required to create strategies."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Requested resource not found.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}}},"paths":{"/api/strategies/{id}":{"delete":{"operationId":"deleteStrategy","summary":"Delete a strategy","description":"Permanently deletes an automation strategy. The strategy must belong to the authenticated user.","tags":["Strategies"],"parameters":[{"name":"id","in":"path","required":true,"description":"Strategy UUID.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Strategy deleted.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"string","description":"ID of the deleted strategy."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Toggle strategy active state

> Toggles the active/paused state of a strategy. Returns the new active state.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Strategies","description":"Automation strategy management. Require Privy JWT. Pro subscription required to create strategies."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Requested resource not found.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}}},"paths":{"/api/strategies/{id}":{"patch":{"operationId":"toggleStrategy","summary":"Toggle strategy active state","description":"Toggles the active/paused state of a strategy. Returns the new active state.\n","tags":["Strategies"],"parameters":[{"name":"id","in":"path","required":true,"description":"Strategy UUID.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Strategy state toggled.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["active"],"properties":{"active":{"type":"boolean","description":"New active state after the toggle."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zirodelta.com/api-reference/strategies.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
