Positions API
Last updated
Last updated
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
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
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 POST /api/v1/quick-task/positions/remove endpoint
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
remove
This endpoint is used to remove positions by ids
both from memory
and db
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.
position-strategy-activate
This endpoint is used to enable position strategies
by ids
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 POST /api/v1/quick-task/positions/strategies/activate
/api/v1/quick-task/positions/sell
/api/v1/quick-task/positions/reactivate
/api/v1/quick-task/positions/deactivate
/api/v1/quick-task/positions/remove
/api/v1/quick-task/positions
/api/v1/quick-task/positions/strategies/deactivate
/api/v1/quick-task/positions/strategies/activate
/api/v1/quick-task/positions/strategy