TL;DR

🔥 Python Demo Script

⚠️ Note that this only works if the strategy is created with TradingView & API template that implements on_tradingview_signal which uses our Python library to place orders based on the received signal (see below)


POST API endpoint

Post JSON message to https://api.crypto-arsenal.io/trading-signal/webhook

Example Python Script

import requests

# you can copy URL and PAYLOAD straight from the webhook messages box on the platform (see below)
URL = 'https://crypto-arsenal.io/trading-signal/webhook'
PAYLOAD ={"log":"Buy","action":"buy","percent":"100","connectorName":"YOUR_CONNECTOR","connectorToken":"YOUR_TOKEN"}

# ⚠️ start a simulation/live trade to see trades in real time
response = requests.post(URL, json=PAYLOAD)
print(response.text) # ok

Place Order JSON Spec:

🔥 JSON messages can be generated automatically and copied via the UI - the process is similar to connecting to TradingView (follow up to Step 4)

Step 1: Lets' make sure the mode is QUANT

Step 2: Navigate to Strategy and Create a TradingView Strategy

Step 3: Pick USDT Future and your currency

Step 4: Copy Webhook URL & Message to TradingView Alert Box

Name

Type

Mandatory

Description

connectorName

STRING

YES

connectorToken

STRING

YES

action

STRING

YES

For USDⓈ-M Futures, used with openLong, closeLong, openShort, or closeShort.

For SPOT, used with buy or sell.

For both, cancel action will cancel by client order ID (clientOrderId will be a required field)

For both, cancellAll will cancel all orders.

fixed

STRING

NO

Amount to place an order with.

⚠️ fixed will take precedence over percent if both are present.

percent

STRING

NO

Percentage of the available base asset to place an order with. E.g. "90" will be 90% of the base asset.

⚠️ fixed will take precedence if both are present.

limit

STRING

NO

LIMIT price of the order.

⚠️ If it is not sent, will place an order by MARKET price by default

profit

STRING

NO

Price for the take profit order

⚠️ Only for USDⓈ-M Futures actions

loss

STRING

NO

Price for the stop loss order

⚠️ Only for USDⓈ-M Futures actions

log

STRING

NO

Message to print in the log

clientOrderId

STRING

NO

Client Order Id to place or cancel orders.

⚠️ cancel will cancel by this clientOrderId.

delaySeconds

NUMBER

NO

Delay this order by seconds

delaySecondsFilter

STRING

NO

Only delay this order by seconds if the log contain this filter word


Did this answer your question?