API

This is the list of APIs that are offered through AI Strategy Builder section of the Wisdomise app

Definitions

Open condition

  • key: a unique string to be used when editing a condition

  • condition: an object, showing the condition which could trigger the open

  • amount: a float, between 0.0 and 1.0 representing the ratio of the open order

  • order_type: a string, either market or limit

  • price: an object, showing the price if order_type is limit

Examples:

{
  "key": "da4eb04a-626c-47de-afc7-0bff99caeb85",
  "condition": {
    "type": "true"
  },
  "amount": 0.5,
  "order_type": "market"
}
{
  "key": "3111ded1-e26a-4263-af17-a042b9e763a0",
  "condition": {
    "type": "compare",
    "op": "<=",
    "left": "price",
    "right": 50000.0
  },
  "amount": 1,
  "price": {
    "value": 58078
  },
  "order_type": "limit"
}

Condition types

True condition, which triggers immediately

{
    "type": "true"
}

Compare condition, which compares two values

  • type: should be compare

  • op: operand, either <= or >=

  • left: should be price, which is equal to the current market price

  • right: a float value

{
    "type": "compare",
    "op": "<=",
    "left": "price",
    "right": 50000.0
}

Close condition

  • key: a unique string to be used when editing a condition

  • amount_ratio: a float, between 0.0 and 1.0 showing the ratio of the current position to be closed when the condition is meet

  • price_exact: a float, showing the price which triggers the close order

Example:

{
    "key": "9e425769-3a59-432f-9c3e-a60afab10d74",
    "amount_ratio": 0.5,
    "price_exact": 59313.04492
}

API

Dispatch Signal

POST https://api.wisdomise.com/v1/strategy/signal/<signaler_id>

Headers:

Authorization: Bearer <secret_key>
Content-Type: application/json

Request:

Response:

{
    "message": "ok"
}

An open signal opens a new position on the given pair with the given stop_loss list, take_profit list and open_orders

Position starts when the first open condition triggers, therefore open_orders list should always be nonempty. After that each time an open condition triggers, It increases the size of the position, And for each triggered close conditions, Position's size decreases by the amount_ratio of the triggered close condition.

For example if the current size of a position is 0.7 and a take profit with 0.5 amount_ratio triggers, position's size will decrease to 0.35 immediately, As half of the position will be closed.

Note that

  • Each condition (stop_loss, take_profit, open_order) will trigger at most once, For example if price goes higher than a 120$ stop_loss, then goes lower than 120$ and again goes higher, The stop_loss only triggers at the first time

  • Sum of amounts of open_orders should be in the range [0.0, 1.0]

  • No condition will trigger until the first open_order element triggers

  • A position may be closed by

    • A signal with close as its action

    • Position's amount goes to zero from non-zero

    • Position reaches a liquidation point

  • When a position closes, all related limit orders will be cancelled, no conditions will be checked anymore and further update or close signal actions will be ignored until another position is created with a open signal

  • An update signal can be used to edit untriggered conditions, If a condition triggeres at some point, No more edit can be done to it, It should be send in the update signals without any change, Otherwise signal will be ignored with an error in the API response.

Last updated