This Go application automatically fetches balance information from your Luno account and exports it to Google Sheets.
Before running this application, you need to have:
- Go installed on your system
- A Luno account with API credentials. Setup here
- A Google Cloud Project with the Google Sheets API enabled. Setup here
- A service account with appropriate permissions for Google Sheets
- Initialize your Go module (if not already done):
go mod init your-project-name
- Install dependencies
go get github.com/luno/luno-go
go get golang.org/x/oauth2/google
go get google.golang.org/api/option
go get google.golang.org/api/sheets/v4
- Prepare environment and files:
- Place your Google Sheets credentials JSON file in the project root (do not upload to GitHub)
- Set up your Google Sheet and note the spreadsheet ID
- Have your Luno API credentials ready
-
Replace placeholders in the code:
LUNO_API_KEY
andLUNO_API_SECRET
with your Luno API credentialsJSON_CREDENTIALS
with your JSON Google service account credentialsSPREADSHEET_ID
with your Google Sheet IDspreadsheetName!A:E
with your desired sheet name and range
-
Ensure your Google Sheet:
- Is shared with the service account email
- Has the correct sheet name (default is "spreadsheetName")
go run main.go
The application writes the following columns to Google Sheets:
- Timestamp (YYYY-MM-DD HH:MM:SS)
- Asset (e.g., XBT, ETH)
- Account ID
- Balance
- Reserved
- Never commit API credentials to version control
- Store credentials securely
- Use environment variables for sensitive data
- Restrict Google Sheet access appropriately
- CRON job and automation
- ??