@uma/bot-strategy-runner
This package contains a generalized bot runner enabling simple execution of multiple concurrent UMA bots on one machine.
Installing the package
yarn add @uma/bot-strategy-runner
yarn build
Or, if you cloned from the mono repo simply run the following from the root of the mono repo:
yarn
yarn qbuild
Quick start
This package requires a simple JSON config to parameterize the strategy runner. A simple config that enables a liquidator and disputer on 3 contracts would look like this:
{
"globalAddressWhitelist": [
"0x0f4e2a456aAfc0068a0718E3107B88d2e8f2bfEF",
"0xd9af2d7E4cF86aAfBCf688a47Bd6b95Da9F7c838",
"0xd60139B287De1408f8388f5f57fC114Fb4B03328"
],
"commonConfig": {
"priceFeedConfig": {
"cryptowatchApiKey": "YOUR-CRYPTO-WATCH-API-KEY"
}
},
"liquidatorSettings": { "enableBotType": true },
"disputerSettings": { "enableBotType": true },
"monitorSettings": { "enableBotType": false }
}
Add this contents to a BotRunnerConfig.json
file within this package.
Then, to start the strategy runner run:
node ./dist/src/index.js --fileConfig ./BotRunnerConfig.json
This will spin up liquidators and monitors on these three contract addresses.
All config options
The strategy runner is design to support a wide range of execution configurations with the goal of being as configurable as standalone UMA bots, while enabling paralization. Some of these configs are discussed below.
Reading in configs from remote github
Bot runners might want to store their config files within a github repo. This can be read in as follows:
node ./dist/src/index.js --urlConfig https://api.github.com/repos/<your-organization>/<your-repo-name>/contents/<path-to-your-json-file> -accessToken <github-access-token>
Be sure to replace the <your-x>
content with your actual values. This kind of config can be used in conjunction with the --fileConfig
flag, wherein the configs will be joined.
Config file structure and custimization
The config file can be customized with a bunch of extra params and settings. The snippet below showcases each section and what can be placed in it for a fully custom setup.
interface strategyRunnerConfig {
botNetwork?: string;
pollingDelay?: number;
botConcurrency?: number;
strategyTimeout?: number;
verboseLogs?: boolean;
emitDebugLogs?: boolean;
globalAddressWhitelistUrls?: Array<string>;
globalAddressWhitelist?: Array<string>;
globalAddressBlacklist?: Array<string>;
commonConfig?: { [key: string]: any };
liquidatorSettings?: botSettings;
disputerSettings?: botSettings;
monitorSettings?: botSettings;
}
Each bot type can be configured with specific settings for that bot as well as additional overrides and settings. The example below is of type botSettings
and would be placed within the previous config under the botSettings
section for each bot type.
interface botSettings {
enableBotType: boolean;
addressWhitelist?: Array<string>;
addressBlacklist?: Array<string>;
commonConfig?: { [key: string]: any };
addressConfigOverride?: { [key: string]: { [key: string]: any } };
}