Setting Up Google Sheets
Last updated
Last updated
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)
Freeze the top row
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.
Sign into Google Cloud ()
Enable Google Sheet API
Menu (top left) > APIs & Services > Enabled APIs and Services
Click + ENABLE APIS AND SERVICES button (top)
Search "Google Sheets API". Click it. Then, click Enable.
Create "googlekey.json" file
Menu (top left) > APIs & Services > Credentials
If you don't have an email under Service Accounts, create one:
Click + CREATE CREDENTIALS button (top) > Service account
Fill in the details. Skip Steps 2 & 3, as they are optional. Click DONE
Click the email under Service Accounts
Click KEYS (top) > click ADD KEY > click Create new key > select JSON > click CREATE
Save file as "googlekey.json" in the "trading-view-adapter" folder you cloned from Github
For Local Server setup, you may need to transfer this file to your server
(For Heroku only) push new file to Heroku
git add .
, git commit -m "add googlekey"
, git push heroku main
Copy the service account email and add this email as an Editor in your Google Sheet share settings
Add the service account email to your Google sheet Share settings (with Editor permissions):
Log into Google Cloud
Select your project (top dropdown menu)
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.