bitcain docs
API Reference

Rules

Trading rules and automation configuration

List Rules

GET
/api/rules

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Query Parameters

enabled_only?boolean

Only return enabled rules

Defaultfalse

Response Body

application/json

application/json

curl -X GET "https://loading/api/rules"
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Create Rule

POST
/api/rules

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

name*string

Rule name

Length1 <= length <= 255
description?|

Rule description

rule_type*string

Type of rule

Value in"price_alert" | "portfolio_rebalance" | "stop_loss" | "take_profit" | "custom"
conditions*

Rule conditions/triggers

actions*

Actions to execute when rule triggers

enabled?boolean

Whether rule is active

Defaulttrue

Response Body

application/json

application/json

curl -X POST "https://loading/api/rules" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "rule_type": "price_alert",    "conditions": {},    "actions": {}  }'
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Delete Rule

DELETE
/api/rules/{rule_id}

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

rule_id*string

Response Body

application/json

application/json

curl -X DELETE "https://loading/api/rules/string"
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Update Rule

PUT
/api/rules/{rule_id}

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

rule_id*string

Request Body

application/json

name?|

Rule name

description?|

Rule description

conditions?|

Rule conditions/triggers

actions?|

Actions to execute

enabled?|

Whether rule is active

Response Body

application/json

application/json

curl -X PUT "https://loading/api/rules/string" \  -H "Content-Type: application/json" \  -d '{}'
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Execute Rule

POST
/api/rules/{rule_id}/execute

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

rule_id*string

Response Body

application/json

application/json

curl -X POST "https://loading/api/rules/string/execute"
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}