Access Tradovate API using Tradingview Webhooks

Hello @Pablo_Gonzalez,

I just briefly looked at the Webhooks API Tradingview provides, and it appears that you can send JSON data via the post request. It looks like it is possible to do this if you can figure out how to get the initial access token. First check out this post to make sure you can get access to the API. Once you’ve got that all set, you can start trying to make requests.

Don’t forget, you can click the link next to your API key to test it on our documentation site.

To acquire an access token, send a request to 'https://demo.tradovateapi.com/auth/accessTokenRequest' for our demo environment, and 'https://live.tradovateapi.com/auth/accessTokenRequest' for our live environment. Here’s what your JSON body should look like for an authentication request:

{
  "name": "your username",
  "password": "your password",
  "appId": "generated with your API key",
  "appVersion": "1.0",
  "cid": 8, //generated with your API key
  "sec": "12345-abcdef-67890-abcd..." //the API key you generated
}

You receive a response from that request:

{
    "accessToken": "<your access token response here>",
    "mdAccessToken": "<your md access token response here>",
    "expirationTime": "2021-06-15T15:40:30.056Z",
    "userStatus": "Active",
    "userId": 15460,
    "name": "alennert02",
    "hasLive": true,
    "outdatedTaC": false,
    "hasFunded": true,
    "hasMarketData": true,
    "outdatedLiquidationPolicy": false
}

When you send future requests, such as placeOrder or startOrderStrategy you’ll need to provide the accessToken field from the JSON above in the Bearer authorization schema of the headers:

{
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer <your access token (no brackets)>"
  }
}

You’ll need to figure out how to store that token and inject it into your webhooks requests. But it definitely seems possible. I hope this has helped out, and best of luck to you!

2 Likes