Trading View Automation
  • Introduction
  • Setting Up Local Server
    • Setting Up HashiCorp Vault + EthSigner
    • Setting Up HashiCorp Vault (dev) + EthSigner
  • Setting Up Google Cloud Run
    • Setting Up Google KMS
  • Setting Up Heroku
  • Setting Up Env Vars
  • Setting Up Trading View Alert
  • Testing With sendAlert.js
  • Setting Up Google Sheets
  • Setting Up Telegram Notifications
  • Using Tmux
  • Using Git
Powered by GitBook
On this page
  • Create a new Google sheets
  • For Local Server or Heroku Setup
  • For Google Cloud Run

Setting Up Google Sheets

PreviousTesting With sendAlert.jsNextSetting Up Telegram Notifications

Last updated 6 months ago

Create a new Google sheets

  1. Create a new Sheet and enter the following headers (in order):

    • The Quote Token is the second token in the ticker. It must be "USDT" for Binance and "USD" for Coinbase. For Matcha Aggregator, the Quote Token must be either "USDC" or "WETH". The Base Token is the first token in the ticker.

    • Amount is the amount of Base Token bought or sold

    • Cost is the amount of Quote Token bought or sold (including fees)

    • Price is the closing price of the ticker (1 minute candle)

  2. Freeze the top row

  3. Use the Google Spreadsheet ID for the

    • if your url is https://docs.google.com/spreadsheets/d/1XY-sjWPj03bw5mIbJruafasw39MBGIiHkCIrT9DVMI9U/edit#gid=0, then the GOOGLE_SHEET_ID is 1XY-sjWPj03bw5mIbJruafasw39MBGIiHkCIrT9DVMI9U. You must use the first sheet of a newly created spreadsheet, as the "gid" must equal 0.

For Local Server or Heroku Setup

  1. Sign into Google Cloud ()

  2. Enable Google Sheet API

    1. Menu (top left) > APIs & Services > Enabled APIs and Services

    2. Click + ENABLE APIS AND SERVICES button (top)

    3. Search "Google Sheets API". Click it. Then, click Enable.

  3. Create "googlekey.json" file

    1. Menu (top left) > APIs & Services > Credentials

    2. If you don't have an email under Service Accounts, create one:

      1. Click + CREATE CREDENTIALS button (top) > Service account

      2. Fill in the details. Skip Steps 2 & 3, as they are optional. Click DONE

    3. Click the email under Service Accounts

    4. Click KEYS (top) > click ADD KEY > click Create new key > select JSON > click CREATE

    5. Save file as "googlekey.json" in the "trading-view-adapter" folder you cloned from Github

      1. For Local Server setup, you may need to transfer this file to your server

    6. (For Heroku only) push new file to Heroku

      1. git add ., git commit -m "add googlekey", git push heroku main

  4. Copy the service account email and add this email as an Editor in your Google Sheet share settings

For Google Cloud Run

Add the service account email to your Google sheet Share settings (with Editor permissions):

  1. Log into Google Cloud

  2. Select your project (top dropdown menu)

  3. Click menu (top left) > Cloud Run > click the trading-view-adapter Service > Revisions > Security. Copy the email.

Note: Google Cloud Run does not need a key file, as the googleapis NPM package in your NodeJS App will retrieve "default" authentication files, which will be valid in a Cloud Run environment.

GOOGLE_SHEET_ID env var
https://console.cloud.google.com/