DCA Bot - TradingView

TradingView webhook commands

Endpoint: https://api.mizar.com/api/v1/dca-bots/trading-view/execute-command

Open position

Open position with take profits and stop loss set with the bot values

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"
}

Open position with take profit set to 5%

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "take_profit_pct": "0.05",
   "api_key": "<API KEY>"
}

Open position with stop loss set to 5%

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "stop_loss_pct": "0.05",
   "api_key": "<API KEY>"
}

Open long position for a bidirectional bot

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "stop_loss_pct": "0.05",
   "api_key": "<API KEY>",
   "side": "long"
}

Open short position for a bidirectional bot

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "stop_loss_pct": "0.05",
   "api_key": "<API KEY>",
   "side": "short"
}

Open position at fixed price with an expiration expressed in seconds

{
   "bot_id": "1",
   "action": "open-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "stop_loss_pct": "0.05",
   "api_key": "<API KEY>",
   "open_order_price": "10000",
   "open_position_expiration": "10" 
}

Add funds

The size is relative to 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).

{
   "bot_id": "1",
   "action": "add-funds",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "size": "1",
   "api_key": "<API KEY>",
   "side": "long"
}

Add funds with limit order

{
   "bot_id": "1",
   "action": "add-funds",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "size": "1",
   "price": "10000",
   "api_key": "<API KEY>",
   "side": "long"
}

Cancel add funds orders

Cancel all the active add funds orders

{
   "bot_id": "1",
   "action": "cancel-all-api-add-funds-orders",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>",
   "side": "long"
}

Remove funds

Remove funds will reduce the position size The size can be expressed with: size: relative to base order order size position_size: relative to the total position size

{
   "bot_id": "1",
   "action": "remove-funds",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "size": "1",
   "api_key": "<API KEY>",
   "side": "long"
}

Remove funds with limit order

{
   "bot_id": "1",
   "action": "remove-funds",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "size": "1",
   "price": "10000",
   "api_key": "<API KEY>",
   "side": "long"
}

Remove 20% of the total position size

{
   "bot_id": "1",
   "action": "remove-funds",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "position_size": "0.2",
   "price": "10000",
   "api_key": "<API KEY>",
   "side": "long"
}

Cancel remove funds orders

Cancel all the active remove funds orders

{
   "bot_id": "1",
   "action": "cancel-all-api-remove-funds-orders",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>",
   "side": "long"
}

Edit take profit relative

Edit take profit for existing 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>"
}

Edit take profit for existing 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"
}

Edit take profit for existing 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 absolute

Edit take profit using absolute value. If a safety order is hit after the take profit is edited, the take profit will be updated based on the position settings.

{
   "bot_id": "1",
   "action": "edit-take-profit",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "take_profit_price": "120000",
   "api_key": "<API KEY>",
   "side": "long"
}

Edit stop loss

Edit stop loss for existing 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>"
}

Edit stop loss for existing 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": "side"
}

Edit stop loss for existing 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"
}

Close position

{
   "bot_id": "1",
   "action": "close-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"
}

Close long position

{
   "bot_id": "1",
   "action": "close-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"
   "side": "long"
}

Close short position

{
   "bot_id": "1",
   "action": "close-position",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"
   "side": "short"
}

Shift safety orders

Shift first safety order to be at 2500

{
   "bot_id": "1",
   "action": "shift-safety-orders",
   "safety_orders_start_price": "25000",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"
}

Execute the first available safety order as a market order

{
   "bot_id": "1",
   "action": "shift-safety-orders",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>"

For a long/short DCA bot (bidirectional) the argument side must be included as in the example below

{   
   "bot_id": "1",
   "action": "shift-safety-orders",
   "safety_orders_start_price": "25000",
   "base_asset": "BTC",
   "quote_asset": "USDT",
   "api_key": "<API KEY>",
   "side": "long"
}

Close all positions

{
   "bot_id": "1",
   "action": "close-all-positions",
   "api_key": "<API KEY>"
}

Stop bot and close all positions

{
   "bot_id": "1",
   "action":  "stop-bot-and-close-all-positions",
   "api_key": "<API KEY>"
}

Last updated