C-Mizar Manual
Search
K

TRADINGVIEW WEBHOOK

Manage your positions and bot from TradingView
Before starting to send signals, ensure you have generated a Mizar API Key. Learn how to do this by reading the instructions here.
Set your TradingView Webhook endpoint to: https://api.mizar.com/api/v1/dca-bots/trading-view/execute-command
Refer to the following tutorial to learn how to configure your TradingView Webhook.
Each DCA bot has its own unique ID. You can find the IDs in your DCA bot management dashboard here.

Open a new position

Simple Open Signal

This command will initiate the opening of a new BTC/USDT position.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
}

Open a new position and override take-profit settings

This command will trigger the opening of a new position where its take-profit deviation is set at +5% compared to the average entry price.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"take_profit_pct": "0.05",
"api_key": "<API KEY>"
}

Open a new position and override stop-loss settings

This command will trigger the opening of a new position where its stop-loss deviation is set at +5% compared to the average entry price.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"stop_loss_pct": "0.05",
"api_key": "<API KEY>"
}

Open a LONG position (for LONG/SHORT bots)

This command will open a LONG position, BTC/USDT.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long"
}

Open a SHORT position (for LONG/SHORT bots)

This command will open a SHORT position, BTC/USDT.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "short"
}

Open a position with target price

This command will open a BTC/USDT position, with base order price set at $42,000. If the order is not completely filled within the expiration time, it will be canceled. If the expiration time is not set, then the default value of 600 seconds will be used.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"open_order_price": "10000",
"open_position_expiration": "10"
}

Open a position with a reduced size

This command initiates a BTC/USDT position with a base order size that is half of the default size.
  • position_size specifies the relative size of the position compared to the default settings. It accepts values ranging from 0 to 1, where 1 represents 100% of the default size.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"position_size": "0.5"
}

Close Positions

This commands will allow you to close your DCA bot positions.

Close Position

This commands will close the BTC/USDT position. In this case, it'll execute a sell order.
{
"bot_id": "1",
"action": "close-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
"side": "long"
}

Close LONG Position (for LONG/SHORT bots)

This commands will close the BTC/USDT LONG position.
{
"bot_id": "1",
"action": "close-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
"side": "long"
}

Close SHORT Position (for LONG/SHORT bots)

This commands will close the BTC/USDT SHORT position.
{
"bot_id": "1",
"action": "close-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
"side": "short"
}

Close All Positions

This command will close all the bot open positions.
{
"bot_id": "1",
"action": "close-all-positions",
"api_key": "<API KEY>"
}

Stop Bot and Close All Positions

This command will close all the bot open positions and stop the bot.
{
"bot_id": "1",
"action": "stop-bot-and-close-all-positions",
"api_key": "<API KEY>"
}

Add funds

With the add funds function, you can add more orders to your currently open position. The size is a percentage of the base order size and can be larger than 1 (e.g. if size is 1 and base order size of the subscription is 10 USDT then the add funds will be of 10 USDT).

Add funds to a LONG position

If the base order is set a 10 USDT, this will open an additional order of 20 USDT to the current open BTC/USDT position.
{
"bot_id": "1",
"action": "add-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"size": "2",
"api_key": "<API KEY>",
"side": "long"
}

Add Funds with limit order

If the base order is set a 10 USDT, this will open an additional limit order (at $42,000 price) of 20 USDT to the current open BTC/USDT position.
{
"bot_id": "1",
"action": "add-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"size": "2",
"price": "42000",
"api_key": "<API KEY>",
"side": "long"
}

Add Funds with client id

If you want to add an order identifier, you can add client_id to the request. The client_idis a string of max length 36 that can be used in case you want to cancel specific add funds orders.
{
"bot_id": "1",
"action": "add-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"size": "2",
"price": "42000",
"api_key": "<API KEY>",
"side": "long",
"client_id": "my order identifier"
}

Cancel add funds orders

You can cancel all the open add funds orders associated with an open position.
{
"bot_id": "1",
"action": "cancel-all-api-add-funds-orders",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long"
}

Cancel add funds orders with client order ids

You can select up to 10 specific add funds orders to cancel with the argument client_ids
{
"bot_id": "1",
"action": "cancel-all-api-add-funds-orders",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long",
"client_ids": ["my client order id 1", "my client order id 2"]
}

Remove funds

With the remove funds function, you can remove funds to your currently open position, by partially closing the position. The size can be expressed as a percentage of the base order size, or as a percentage of the total position size.

Remove funds based on base order size

This command will open a sell order of 100% the base order size.
{
"bot_id": "1",
"action": "remove-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"size": "1",
"api_key": "<API KEY>",
"side": "long"
}

Remove funds based on the position size

This command will open a sell order of 20% of the position size.
{
"bot_id": "1",
"action": "remove-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"position_size": "0.2",
"api_key": "<API KEY>",
"side": "long"
}

Remove funds based on the position size with limit order

This command will open a sell order (at $42,000 price) of 20% of the position size.
{
"bot_id": "1",
"action": "remove-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"position_size": "0.2",
"price": "42000",
"api_key": "<API KEY>",
"side": "long"
}

Remove Funds with client id

If you want to add an order identifier, you can add client_id to the request. The client_idis a string of max length 36 that can be used in case you want to cancel specific add funds orders.
{
"bot_id": "1",
"action": "remove-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"size": "2",
"price": "42000",
"api_key": "<API KEY>",
"side": "long",
"client_id": "my order identifier"
}

Cancel remove funds orders

You can cancel all the open add funds orders associated with an open position.
{
"bot_id": "1",
"action": "cancel-all-api-remove-funds-orders",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long"
}

Cancel remove funds orders with client order ids

You can select up to 10 specific remove funds orders to cancel with the argument client_ids
{
"bot_id": "1",
"action": "cancel-all-api-remove-funds-orders",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long",
"client_ids": ["my client order id 1", "my client order id 2"]
}

Edit Take Profit

This allows you to edit the take profit settings of open positions.

Override deviation

This command will set the take profit of the BTC/USDT position to 5%.
{
"bot_id": "1",
"action": "edit-take-profit-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"take_profit_pct": "0.05",
"api_key": "<API KEY>"
}

Override deviation for LONG position (LONG/SHORT bots)

This command will set the take profit of the BTC/USDT LONG position to 5%.
{
"bot_id": "1",
"action": "edit-take-profit-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"take_profit_pct": "0.05",
"api_key": "<API KEY>",
"side": "long"
}

Override deviation for SHORT position (LONG/SHORT bots)

This command will set the take profit of the BTC/USDT SHORT position to 5%.
{
"bot_id": "1",
"action": "edit-take-profit-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"take_profit_pct": "0.05",
"api_key": "<API KEY>",
"side": "short"
}

Edit Take Profit with absolute target price

With this command, you'll set the take profit target price to a defined price ($42,000). If a safety order is hit after the take profit is edited, the take profit will be updated based on the position settings (taking the initial take profit deviation).
{
"bot_id": "1",
"action": "edit-take-profit",
"base_asset": "BTC",
"quote_asset": "USDT",
"take_profit_price": "42000",
"api_key": "<API KEY>",
}

Edit Stop Loss

This allows you to edit the stop loss settings of open positions.

Override deviation

This command will set the stop loss of the BTC/USDT position to -5%.
{
"bot_id": "1",
"action": "edit-stop-loss-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"stop_loss_pct": "0.05",
"api_key": "<API KEY>"
}

Override deviation for LONG position (LONG/SHORT bots)

This command will set the stop loss of the BTC/USDT LONG position to -5%.
{
"bot_id": "1",
"action": "edit-stop-loss-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"stop_loss_pct": "0.05",
"api_key": "<API KEY>",
"side": "long"
}

Override deviation for SHORT position (LONG/SHORT bots)

This command will set the stop loss of the BTC/USDT SHORT position to -5%.
{
"bot_id": "1",
"action": "edit-stop-loss-pct",
"base_asset": "BTC",
"quote_asset": "USDT",
"stop_loss_pct": "0.05",
"api_key": "<API KEY>",
"side": "short"
}

Edit Safety Orders

This allows you to edit the safety order settings of open positions.

Shift Safety Order Price

This command will set the next safety order price of the BTC/USDT position to $42,000.
{
"bot_id": "1",
"action": "shift-safety-orders",
"safety_orders_start_price": "42000",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
}

Shift Safety Order Price for LONG Position (LONG/SHORT bot)

This command will set the next safety order price of the BTC/USDT LONG position to $42,000.
{
"bot_id": "1",
"action": "shift-safety-orders",
"safety_orders_start_price": "42000",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long"
}

Shift Safety Order Price for SHORT Position (LONG/SHORT bot)

This command will set the next safety order price of the BTC/USDT SHORT position to $42,000.
{
"bot_id": "1",
"action": "shift-safety-orders",
"safety_orders_start_price": "42000",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"side": "long"
}

Execute the First Available Safety Order as a Market Order

This command will override the safety order deviation settings and execute the first safety order available as a market order.
{
"bot_id": "1",
"action": "shift-safety-orders",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>"
}

Delay

You can add a delay to every command by simply adding the argument delay. The is is expressed in seconds and the max allowed is 10 sec.
{
"bot_id": "1",
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"api_key": "<API KEY>",
"open_order_price": "10000",
"delay": "10"
}

Multiple commands

Our webhook allows you to efficiently execute multiple commands in a single operation. This is particularly useful for scenarios where you need to perform several actions in a sequence without initiating multiple requests.

Endpoint

To utilize this feature, send your requests to the following endpoint:
  • URL: https://api.mizar.com/api/v1/dca-bots/trading-view/execute-commands

Features

  • Batch Operations: Execute up to 10 commands in a single webhook request.
  • Sequential Execution: Commands are processed in the order they are listed, ensuring a smooth and predictable execution flow.
  • Break on Failure: If enabled, the execution process will halt upon encountering any failure, preventing subsequent commands from being executed.
Example
Below is an example payload that demonstrates chaining two commands: open-position and remove-funds.
{"commands": [
{
"action": "open-position",
"base_asset": "BTC",
"quote_asset": "USDT",
"open_order_price": "10000"
},
{
"action": "remove-funds",
"base_asset": "BTC",
"quote_asset": "USDT",
"position_size": "0.2",
"price": "42000"
}
],
"break_on_failure": true,
"api_key": "<API KEY>",
"bot_id": "1"
}

Break on failure

If there is any failure in executing