A Tampermonkey userscript for rugplay.com that automatically tracks how much you owe your investors. It listens to live trades via the site's WebSocket, identifies tracked investors, and updates a Google Sheet with the amount owed in real time.
When an investor buys, the amount is added to what is owed. When they sell, it is subtracted. The sheet is re-read every 15 minutes by default to pick up any new investors you have added.
- Tampermonkey installed in your browser
- A Google account
- A Google Cloud project with the Sheets API enabled
- A Google Sheet with at least two columns: one for usernames and one for amounts owed
Go to console.cloud.google.com, create a new project and give it any name.
In the left sidebar go to APIs and Services > Library, search for "Google Sheets API" and enable it.
In the left sidebar go to APIs and Services > OAuth consent screen.
- Set the user type to External
- Fill in an app name and your email address
- On the Audience section, scroll down to Test users and add the Google account you will be signing in with
Google will show a warning when you sign in saying the app is unverified. This is expected because the app is in test mode. Click "Continue" to proceed.
In the left sidebar go to APIs and Services > Credentials.
At the top click Create credentials > OAuth client ID.
- Set the application type to Web application
- Under Authorised JavaScript origins add
https://rugplay.com - Click Create and copy the Client ID that is shown
On the same Credentials page click Create credentials > API key.
Copy the key that is generated. You can optionally restrict it to the Sheets API under the key settings.
Your sheet needs two columns. By default the script expects:
- Column A: UserIGN (the rugplay username)
- Column B: Amount Due
Row 1 is treated as the header row. Data starts from row 2. Ensure only usernames are in column A.
Open your Google Sheet in the browser. The URL will look like this:
https://docs.google.com/spreadsheets/d/SHEET_ID_IS_HERE/edit
The long string of characters between /d/ and /edit is your Sheet ID.
Type the rugplay username exactly into column A. Leave column B as 0.
Important: the cell in column B must exist (even if it contains 0) for the write to register correctly. An entirely blank cell in a row that has never been touched may not accept the value. Put a 0 in column B for each investor row.
Install the script through Tampermonkey and in the CONFIG block at the top of the file. Fill in the following values:
| Variable | Description |
|---|---|
COIN_SYMBOL |
The symbol of the coin you want to track. |
SHEET_ID |
The ID from your Google Sheet URL (see above) |
API_KEY |
The API key you created in Google Cloud |
CLIENT_ID |
The OAuth Client ID you created in Google Cloud |
SHEET_NAME |
The name of the tab in your sheet, default is Sheet1 |
USERNAME_COL |
The column letter that holds usernames, default is A |
AMOUNT_COL |
The column letter that holds amounts owed, default is B |
DATA_START_ROW |
The first row that contains data (not headers), default is 2 |
INVESTOR_REFRESH_MS |
How often the sheet is re-read for new investors in milliseconds, default is 900000 (15 minutes) |
WRITE_QUEUE_DRAIN_MS |
How often the write queue flushes in milliseconds, default is 2000 |
EVENT_CACHE_MAX |
Maximum number of trade events held in memory, default is 500 |
SHEET_READ_CACHE_MS |
Minimum gap between sheet reads in milliseconds, default is 30000 |
LOG_MAX |
Maximum number of lines shown in the on-screen log, default is 150 |
- Navigate to rugplay.com
- The RIT panel will appear in the bottom right corner
- Click Sign In and authenticate with the Google account that has access to your sheet
- Google will show an unverified app warning, click Continue
- Once authenticated, the status dot turns green and the script begins listening for trades
- Use Refresh Sheet at any time to manually pull in new investors without waiting for the interval
- The script hooks into rugplay's WebSocket connection and listens for live trade events
- When a trade comes in for the configured coin, it checks whether the username is in the investor cache
- If the user is tracked, the trade value is queued as a positive delta (buy) or negative delta (sell)
- The write queue drains on an interval and updates the corresponding row in column B
- Deltas that arrive while a write is in progress are accumulated and applied on the next drain cycle
- The investor list is refreshed from the sheet on a configurable interval so any new rows you add are picked up automatically