A foundation for creating and maintaining MySQL database tables for historical price/liquidity information for XRPL tokens. Tracking and storing price/liquidity is useful for creating historical charts for XRPL tokens.
🐉 This is the ALPHA release of the tool. Expect dragons! 🐉
- MySQL Community Server
- Node.js and npm installed
- Clone or download the repository to your local machine.
- Open a terminal in the root directory of the project.
npm install
- In your favorite IDE open the settings.js file.
- You will be presented with several options to adjust how your tool will run:
-
DB_CREDENTIALS: The host, user and password of a MySQL server instance. The server must be running and and the user/ password must be pre-configured prior to launching entering the credentials. It is not recommended to store your DB credentials directly in here. Use environmental variables
-
XRPL_NODE: The WSS URL of the xrpl node you would like to connect to. Be sure that the node is not operating as a reporting server or the tool will not work.
-
CRON_TIME: Specifies how often the tool will pull token data utilizing crontab syntax. The default settings will pull data every minute.
-
SHOW_DATA: (true/false) Determines if the calculated data (prices/liquidity) will be displayed in the console as the data is calculated.
-
VERBOSE: (true/false) Determines if the tool will show logs of the tasks that it is working on or has recently completed.
-
MAX_SLIPPAGE: (0-1) Used for calculating slippage liquidity (How many tokens can be purchased or sold before the price change would be greater than the slippage tolerance)
-
BASE: The base currency to calculate token values against. CURRENTLY ONLY XRP IS SUPPORTED. DO NOT CHANGE
-
TOKENS: A list of tokens to track the prices and liquidity of. THE CURRENCY FIELD IS CASE SENSITVE. bTc is not the same as BTC! If unsure of the correct ticker, look up the issuing account on Bithomp and refer to the obligations of the issuer to get the appropriate ticker for the token.
/*----------------------------SETTINGS----------------------------*/
const DB_CREDENTIALS = {host:"localhost",user:process.env.DB_USER,password:process.env.DB_PASSWORD }
const XRPL_NODE="wss://xrplcluster.com/"
const CRON_TIME='* * * * *'
const SHOW_DATA=false;
const VERBOSE=false;
const MAX_SLIPPAGE=.05;
const BASE={"currency":"XRP"}
const TOKENS=[
{"currency":"BTC", "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"},
{"currency":"CSC", "issuer":"rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr"},
]
/*----------------------------------------------------------------*/
Open a terminal in the root directory of the tool and run:
node tokentracker.js
Pull requests are welcome! For major changes, please open an issue first to discuss what changes you would like to make.
Please open a discussion for any other token metrics that would be beneficial to track.
This project was put together in two days and it is very likely there will be unforeseen issues. To make this tool better, please report any errors or fatal crashes that are encountered.
In future releases, the tool will diverge from utilizing node-cron and will be executed from a bash script and scheduled utilizing crontab