Monitor is a tool that displays your cryptocurrency balances in a formatted table with customizable colors and optional integration with Google Sheets.
Follow these steps to get the Monitor tool up and running on your local machine.
Open your terminal and run the following command:
git clone https://github.com/unyeco/monitor.gitNavigate to the project directory:
cd monitorCopy the example keys file:
cp keys-example.json keys.jsonOpen keys.json in your preferred text editor and replace the placeholder values with your own API keys.
Copy the example configuration file:
cp config-example.json config.jsonOpen config.json and update the configuration as needed.
Execute the following command to run the application:
node mon.jsIf you want to log your balances to Google Sheets, follow these steps:
-
Set Up Google Cloud Credentials
-
Create a Google Cloud Project and Service Account
- Go to the Google Cloud Console.
- Create a new project or select an existing project.
- Navigate to IAM & Admin > Service Accounts and click + CREATE SERVICE ACCOUNT.
- Provide a name for the service account and click CREATE AND CONTINUE.
- Assign the role Editor and click DONE.
-
Generate a Key for the Service Account
- In the Service Accounts list, click on your newly created service account.
- Go to the Keys tab and click ADD KEY > Create New Key.
- Select JSON and download the key file.
- Save the key file to your project directory or a secure location.
-
Enable APIs for Your Project
- Navigate to APIs & Services > Library in the Google Cloud Console.
- Enable the following APIs:
- Google Sheets API
- Google Drive API
-
-
Share Your Google Sheet with the Service Account
- Create a new Google Sheet or use an existing one.
- Share the sheet with the service account email (found in the JSON credentials file) and give it Editor permissions.
-
Update config.json
- Set
"enabled": trueunder thegoogleAPIsection. - Replace
"credentialsPath"with the path to your Google service account credentials file. - Replace
"accountEmail"with the email of the Google account to share the sheet with.
- Set
To enable PNL calculations, edit your config.json file, use local times:
"pnl": {
"enabled": true,
"Coinbase 1": {
"start": "2024-11-15 12:34:00",
"balance": 5000
},
"Gateio 2": {
"start": "2024-11-14 07:00:00",
"balance": 1000
}
}You can customize the colors used in the terminal output by editing the "colors" section in your config.json file. Note that chalk also allows hex values as seen below.
Example Configuration:
"colors": {
"leftMarginSize": 0,
"borderColor": "dim.gray",
"accountNameColor": "cyan",
"spotSymbolColor": "green",
"futuresSymbolColor": "red",
"defaultSymbolColor": "white",
"amountColor": "green",
"accountTotalColor": "cyanBright",
"grandTotalColor": "white",
"baseCurrencySymbolStyle": "bold",
"futurePos": "green",
"futureNeg": "red",
"pnlPositive": "dim.green",
"pnlNegative": "dim.red",
"pnlLabelColor": "#0f0f0f"
}Notes:
- Chalk Color Names: You can use any of Chalk’s predefined color names (e.g.,
red,greenBright,dim.blue). - Hex Colors: Prefix hex codes with
#and combine them with modifiers using dots (e.g.,bold.#FF5733).
— The unity.dev team