Skip to content

Manage access to private Tradingview indicators

Notifications You must be signed in to change notification settings

d3f4ultt/Tradingview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tradingview


Restful API access for managing tradingview indicator access.

Installation

Follow below steps to install and run the API service

Run locally, on a VPS or on Replit

Update environment variables

Only environment variables to be updated are:
  • username - Your tradingview username
  • password - Your tradingview password
(A Premium Tradingview subscription is required.)

Usage

Once up and running, you will be able to use following calls to manage Tradingview access.

GET /validate/{username}

Can be used to validate username. This can be handy operation to execute before trying to execute access management for the user. If user is not valid, we can stop the workflow then and there.

  • Payload - None
  • Headers - None
  • Returns - JSON output with following information:
    1. validUser - Can be true or false. Tells whether username passed is valid or not.
    2. verifiedUserName - returns the exact username as in Tradingview records (along with matching case). If validUser is false, this field will also have blank value.
{
    "validuser": true,
    "verifiedUserName": "ApolloAlgo"
}

GET /access/{username}

This method can be used to get the current access level of user for particular publications identified by pine_ids

  • Payload - Json Payload containing list of pine ids
    1. pine_ids - Array of pine ids. Pine ids are backend unique ids for each script. We can get these ids from browser developer console when script is loaded or when access methods are performed on the tradingview UI. Please note, only Pine Ids for scripts which belong to your account will work in this way. You will not be able to control the access to scripts which are not yours.
    2. {
          "pine_ids" : ["PUB;0fc414298ba34d61866a7817b6eec7b4", "PUB;b48044bbad454132bbcd3aa51807da96"]
      }
      
  • Headers - None
  • Returns - JSON output array with following information:
    1. pine_id - Pine publication id which is sent as input to the API request
    2. username - Username against which the operation is performed.
    3. hasAccess - true if user already has access to script. false otherwise
    4. noExpiration - true if user has non expiring access to script. false otherwise
    5. currentExpiration - applicable only if hasAccess is true and noExpiration is false. Ignore otherwise.
[
    {
        "pine_id": "PUB;0fc414298ba34d61866a7817b6eec7b4",
        "username": apolloalgo",
        "hasAccess": false,
        "noExpiration": false,
        "currentExpiration": "2023-07-17 06:27:49.067935+00:00"
    },
    {
        "pine_id": "PUB;b48044bbad454132bbcd3aa51807da96",
        "username": "apolloalgo",
        "hasAccess": false,
        "noExpiration": false,
        "currentExpiration": "2023-07-17 06:27:49.196514+00:00"
    }
]

DELETE /access/{username}

This method can be used to remove the current access level of user for particular publications identified by pine_ids

  • Payload - Json Payload containing list of pine ids
    1. pine_ids - Array of pine ids. Pine ids are backend unique ids for each script. We can get these ids from browser developer console when script is loaded or when access methods are performed on the tradingview UI. Please note, only Pine Ids for scripts which belong to your account will work in this way. You will not be able to control the access to scripts which are not yours.
    2. {
          "pine_ids" : ["PUB;0fc414298ba34d61866a7817b6eec7b4", "PUB;b48044bbad454132bbcd3aa51807da96"]
      }
      
  • Headers - None
  • Returns - JSON output array with following information:
    1. pine_id - Pine publication id which is sent as input to the API request
    2. username - Username against which the operation is performed.
    3. hasAccess - true if user had access to script before removing access. false otherwise
    4. noExpiration - true if user had non expiring access to script before removing access. false otherwise
    5. status - Status of the remove operation
[
    {
        "pine_id": "PUB;0fc414298ba34d61866a7817b6eec7b4",
        "username": "apolloalgo",
        "hasAccess": true,
        "noExpiration": true,
        "currentExpiration": "2023-07-17 06:28:49.655286+00:00",
        "status": "Success"
    },
    {
        "pine_id": "PUB;b48044bbad454132bbcd3aa51807da96",
        "username": "apolloalgo",
        "hasAccess": true,
        "noExpiration": true,
        "currentExpiration": "2023-07-17 06:28:49.923866+00:00",
        "status": "Success"
    }
]

POST /access/{username}

This method can be used to add/update current access level of user for particular publications identified by pine_ids.

  • Payload - Json Payload containing list of pine ids
    1. pine_ids - Array of pine ids. Pine ids are backend unique ids for each script. We can get these ids from browser developer console when script is loaded or when access methods are performed on the tradingview UI. Please note, only Pine Ids for scripts which belong to your account will work in this way. You will not be able to control the access to scripts which are not yours.
    2. {
          "pine_ids" : ["PUB;0fc414298ba34d61866a7817b6eec7b4", "PUB;b48044bbad454132bbcd3aa51807da96"]
      }
      
  • Headers - None
  • Returns - JSON output array with following information:
    1. pine_id - Pine publication id which is sent as input to the API request
    2. username - Username against which the operation is performed.
    3. hasAccess - true if user already has access to script. false otherwise
    4. noExpiration - true if user has non expiring access to script. false otherwise
    5. currentExpiration - applicable only if hasAccess is true and noExpiration is false. Ignore otherwise.
    6. expiration - New expiration applied after applying access update.
    7. status - Status can be Success, Failure, or Not Applied. Not Applied will be returned if user already has lifetime access to given script and no further addition is possible.
[
    {
        "pine_id": "PUB;0fc414298ba34d61866a7817b6eec7b4",
        "username": "apolloalgo",
        "hasAccess": true,
        "noExpiration": true,
        "currentExpiration": "2022-09-17T06:28:25.933303+00:00",
        "expiration": "2022-09-17T06:28:25.933303+00:00",
        "status": "Success"
    },
    {
        "pine_id": "PUB;b48044bbad454132bbcd3aa51807da96",
        "username": "apolloalgo",
        "hasAccess": true,
        "noExpiration": true,
        "currentExpiration": "2022-09-17T06:28:26.191805+00:00",
        "expiration": "2022-09-17T06:28:26.191805+00:00",
        "status": "Success"
    }
]

Contributions & Thanks

If you found this project interesting or useful, create accounts with my referral links:

Profiles

About

Manage access to private Tradingview indicators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages