Setting Up Google Cloud Run
Download files from the Github repository to your computer
Sign up for a Github account
Install Git (https://www.git-scm.com/downloads)
Establish authentication to Github API
Windows
download VSCode
download the Github Pull Requests Extension
Click Accounts (bottom left) > sign in with Github
All Git commands need to be done in VSCode's in-built terminal
MacOS
Use VSCode, as above
Alternatively, use a Personal Access Token
Log into Github > Profile photo (top right) > Settings > Developer Settings (left menu, scroll down) > Personal access tokens > Tokens (classic) > Generate new token (top right) > Generate a new token (classic)
Give name, expiration date, and scopes (for scopes, click "repo")
Click Generate token
When you run
git clone(Step 2), it will ask for username and password. Use your Github username. For password, use the generated token.Cache token with
git config --global credential.helper osxkeychainview cached credentials with
echo url=https://github.com/git/git.git | git credential fill
In your CLI, cd into where you want the “trading-view-automation” folder downloaded, then run
git clone https://github.com/brianonchain/trading-view-automation.gitPrompt will pop up > login with browser
After the credentials are confirmed, the folder containing the files will downloaded
Repo is only downloadable if you are invited as a collaborator to the private repo
Upload files to Google Cloud Run
Sign up an account on Google Cloud Platform
Create a billing account
Create a project
Install the Google Cloud CLI, takes ~10 minutes (https://cloud.google.com/sdk/docs/install)
In your CLI:
cd into the “trading-view-automation” folder you created in Step 1.3.4
gcloud initEnter
1for "Re-initialize this configuration [default] with new settings"Login with your Google username/password
Select the project you created in Step 2.3
gcloud run deploy --source .For the Service name, press
Enterto use the default name ("trading-view-automation")enter
yto enable APIsChoose region
Enter
yto allow unauthenticated invocationsWait ~5 minutes for files to build & upload
Enter your environment variables
Select your project in Google Cloud
Click the menu (top left) > Cloud Run > click the trading-view-automation Service
Click EDIT & DEPLOY NEW REVISION (top)
Under Edit Container, click VARIABLES & SECRETS and enter environment variables (see Setting Up Env Vars)
For better security, you can use Google Secrets Manager. For the best security, you can use Google Key Management Service (see Setting Up Google KMS)
Copy the app URL and use it as the webhook URL in your Trading View alert or sendAlert.js
URL is located in menu (top left) > Cloud Run > click the trading-view-automation Service > see top-middle of page (it looks like https://dev-b3gfgsdfs3a-de.a.run.app)
If you need to update the Cloud Run code
cd into "trading-view-automation folder", ensure you are on "main" branch, run
git pullFollow Step 2.5.3
Set up Google Sheets to see successful or failed trades (see Setting Up Google Sheets)
Set up Telegram to see successful or failed trades (see Setting up Telegram)
Test Setup
Send a Trading View alert or mimic one using sendAlert.js. Use the provided Heroku HTTPS URL (see Step 1.4) as the webhook URL.
Last updated