Positions API

positions

This endpoint is used to return current info about your positions in BLOOD All positions in BLOOD are stored locally on your machine in memory (instance) and in db file (to reactivate / sell / remove on the next startup) Active positions are the one that were opened in the active blood instance (they can be active or inactive). Instances do not share active positions between them Active position is the one that is being updated once a while (depends on your position update delay) and can be sold / removed automatically by bot (strategies and remove rules) Inactive position is the one that are just stored in memory, its not being updated but you can activate it again Positions in memory are fast access, we don't need to spend time to fetch additional info, only update the existing position Positions in db are slow access, each time we want to do any action with those positions we need to refetch info (if anything changes) and then update it There are 3 possible variants to fetch positions

  • set fetchMemory to true and fetchDb to false so the bot will return all positions that are currently stored in memory (they can be active or inactive)

  • set fetchMemory to false and fetchDb to true so the bot will return all positions that are stored in memory (it won't activate it - just refetch and update)

  • set fetchMemory to true and fetchDb to true so the bot will do both things above

post
Body
fetchMemorybooleanOptional
fetchDbbooleanOptional
Responses
200
OK
application/json
post
POST /api/v1/quick-task/positions HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 35

{
  "fetchMemory": true,
  "fetchDb": true
}
{
  "positions": [
    {
      "id": "text",
      "walletName": "text",
      "walletAddress": "text",
      "initialAmountIn": "text",
      "left": "text",
      "value": "text",
      "profit": "text",
      "profitTotal": "text",
      "mcap": "text",
      "extended": {
        "tokenIn": {
          "tokenAddress": "text",
          "tokenName": "text",
          "tokenSymbol": "text",
          "tokenDecimals": 1,
          "uri": "text",
          "mintAuthorityEnabled": true,
          "freezeAuthorityEnabled": true
        },
        "tokenOut": {
          "tokenAddress": "text",
          "tokenName": "text",
          "tokenSymbol": "text",
          "tokenDecimals": 1,
          "uri": "text",
          "mintAuthorityEnabled": true,
          "freezeAuthorityEnabled": true
        },
        "pool": {
          "poolId": "text",
          "platform": "text",
          "formattedLiquidityA": "text",
          "formattedLiquidityB": "text"
        },
        "shitcoinIsA": true,
        "strategy": "text",
        "strategyDisabled": true,
        "usefulLinks": {
          "ANY_ADDITIONAL_PROPERTY": "text"
        }
      },
      "active": true
    }
  ]
}

sell

This endpoint is used to sell provided position by id and percentageToSell If the position is not found in memory the bot will automatically try to find it in db. If position is not found in both memory and db it will return an error If position token balance after refetching is 0 the bot will automatically remove it and return successful response ATTENTION - percentageToSell should be an integer in bps format 100% = 10000 10% = 1000 1% = 100

post
Body
idstringOptional
percentageToSellstringOptional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/sell HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 39

{
  "id": "text",
  "percentageToSell": "text"
}
{}

position-reactivate

This endpoint is used to activate position by id If the position is not found in memory the bot will automatically try to find it in db. If position is not found in both memory and db it will return an error If position token balance after refetching is 0 the bot will return error - so you should remove it by calling Positions API endpoint

post
Body
idstringOptional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/reactivate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 13

{
  "id": "text"
}
{}

position-deactivate

This endpoint is used to activate position by id

Deactivate is only affecting positions in that are stored in memory. If position is not found the bot will still return successful response

post
Body
idstringOptional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/deactivate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 13

{
  "id": "text"
}
{}

remove

This endpoint is used to remove positions by ids both from memory and db

post
Body
idsstring[]Optional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/remove HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "ids": [
    "text"
  ]
}
{}

position-strategy-deactivate

This endpoint is used to disable position strategies by ids. The bot won't check for any sell triggers based on strategies but still will keep updating positions.

post
Body
idsstring[]Optional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/strategies/deactivate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "ids": [
    "text"
  ]
}
{}

position-strategy-activate

This endpoint is used to enable position strategies by ids

post
Body
idsstring[]Optional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/strategies/activate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "ids": [
    "text"
  ]
}
{}

position-strategy-set

This endpoint is used to set or replace the existing position strategy by id. strategy input should match string format as in task file. The bot won't automatically enable position strategies if disabled by default so you need to externally call Positions API

post
Body
idstringOptional
strategystringOptional
Responses
200
OK
application/json
Responseobject
post
POST /api/v1/quick-task/positions/strategy HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 31

{
  "id": "text",
  "strategy": "text"
}
{}

Last updated