diff --git a/README.md b/README.md index 43fdc16d..c5352602 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Other optional arguments are: - `--order-owner`, Option to filter the subgraph query results with a specific order owner address, Will override the 'ORDER_OWNER' in env variables - `--order-interpreter`, Option to filter the subgraph query results with a specific order's interpreter address, Will override the 'ORDER_INTERPRETER' in env variables - `--monthly-ratelimit`, 0x monthly rate limit, if not specified will not respect any 0x monthly ratelimit, Will override the 'MONTHLY_RATELIMIT' in env variables +- `--sleep`, Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables - `--use-zeroex-arb`, Option to use old version of Arb contract for `0x` mode, i.e dedicated 0x Arb contract, ONLY available for `0x` mode - `-V` or `--version`, output the version number - `-h` or `--help`, output usage information @@ -112,6 +113,7 @@ which will show: --order-owner
Option to filter the subgraph query results with a specific order owner address, Will override the 'ORDER_OWNER' in env variables --order-interpreter
Option to filter the subgraph query results with a specific order's interpreter address, Will override the 'ORDER_INTERPRETER' in env variables --monthly-ratelimit 0x monthly rate limit, if not specified will not respect any 0x monthly ratelimit, Will override the 'MONTHLY_RATELIMIT' in env variables + --sleep Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables --use-zeroex-arb Option to use old version of Arb contract for `0x` mode, i.e dedicated 0x Arb contract, ONLY available for `0x` mode -V, --version output the version number -h, --help display help for command @@ -168,6 +170,9 @@ ORDER_OWNER="" # Option to filter the subgraph query results with a specific order interpreter address ORDER_INTERPRETER="" + +# Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables +SLEEP=10 ``` If both env variables and CLI argument are set, the CLI arguments will be prioritized and override the env variables. diff --git a/arb-bot.js b/arb-bot.js index b8b020d8..03ae4a4d 100755 --- a/arb-bot.js +++ b/arb-bot.js @@ -25,6 +25,7 @@ const DEFAULT_OPTIONS = { orderOwner : process?.env?.ORDER_OWNER, orderInterpreter : process?.env?.ORDER_INTERPRETER, monthlyRatelimit : process?.env?.MONTHLY_RATELIMIT, + sleep : process?.env?.SLEEP, subgraph : process?.env?.SUBGRAPH ? Array.from(process?.env?.SUBGRAPH.matchAll(/[^,\s]+/g)).map(v => v[0]) : undefined, @@ -50,6 +51,7 @@ const getOptions = async argv => { .option("--order-owner
", "Option to filter the subgraph query results with a specific order owner address, Will override the 'ORDER_OWNER' in env variables") .option("--order-interpreter
", "Option to filter the subgraph query results with a specific order's interpreter address, Will override the 'ORDER_INTERPRETER' in env variables") .option("--monthly-ratelimit ", "0x monthly rate limit, if not specified will not respect any 0x monthly ratelimit, Will override the 'MONTHLY_RATELIMIT' in env variables") + .option("--sleep ", "Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables") .option("--use-zeroex-arb", "Option to use old version of Arb contract for `0x` mode, i.e dedicated 0x Arb contract, ONLY available for `0x` mode") .description([ "A NodeJS app to find and take arbitrage trades for Rain Orderbook orders against some DeFi liquidity providers, requires NodeJS v18 or higher.", @@ -75,6 +77,7 @@ const getOptions = async argv => { cmdOptions.useZeroexArb = cmdOptions.useZeroexArb || DEFAULT_OPTIONS.useZeroexArb; cmdOptions.orderHash = cmdOptions.orderHash || DEFAULT_OPTIONS.orderHash; cmdOptions.orderOwner = cmdOptions.orderOwner || DEFAULT_OPTIONS.orderOwner; + cmdOptions.sleep = cmdOptions.sleep || DEFAULT_OPTIONS.sleep; cmdOptions.orderInterpreter = cmdOptions.orderInterpreter || DEFAULT_OPTIONS.orderInterpreter; cmdOptions.monthlyRatelimit = cmdOptions.monthlyRatelimit || DEFAULT_OPTIONS.monthlyRatelimit; @@ -127,13 +130,17 @@ const arbRound = async options => { const main = async argv => { let repetitions = -1; - const roundGap = 10000; const options = await getOptions(argv); + let roundGap = 10000; if (options.repetitions) { if (/^\d+$/.test(options.repetitions)) repetitions = Number(options.repetitions); else throw "invalid repetitions, must be an integer greater than equal 0"; } + if (options.sleep) { + if (/^\d+$/.test(options.sleep)) roundGap = Number(options.sleep) * 1000; + else throw "invalid sleep value, must be an integer greater than equal 0"; + } appGlobalLogger( true, diff --git a/docs/html/curve.js.html b/docs/html/curve.js.html index ebbc2f36..9ad5d46c 100644 --- a/docs/html/curve.js.html +++ b/docs/html/curve.js.html @@ -659,7 +659,7 @@

Home

Global

  • diff --git a/docs/html/global.html b/docs/html/global.html index 20c168f0..f6a9d5bf 100644 --- a/docs/html/global.html +++ b/docs/html/global.html @@ -6606,7 +6606,7 @@

    Home

    Global

    • diff --git a/docs/html/index.html b/docs/html/index.html index 933e47d9..2c5ab17e 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -56,7 +56,7 @@

      Home

      Global

      • diff --git a/docs/html/index.js.html b/docs/html/index.js.html index e34e552f..80bf44e1 100644 --- a/docs/html/index.js.html +++ b/docs/html/index.js.html @@ -273,7 +273,7 @@

        Home

        Global

        • diff --git a/docs/html/query.js.html b/docs/html/query.js.html index d9c70aec..23c6a41c 100644 --- a/docs/html/query.js.html +++ b/docs/html/query.js.html @@ -146,7 +146,7 @@

          Home

          Global

          • diff --git a/docs/html/router.js.html b/docs/html/router.js.html index 04789b8d..9c675821 100644 --- a/docs/html/router.js.html +++ b/docs/html/router.js.html @@ -590,7 +590,7 @@

            Home

            Global

            • diff --git a/docs/html/utils.js.html b/docs/html/utils.js.html index 4972e5fa..f19b9c77 100644 --- a/docs/html/utils.js.html +++ b/docs/html/utils.js.html @@ -1081,7 +1081,7 @@

              Home

              Global

              • diff --git a/docs/html/zeroex.js.html b/docs/html/zeroex.js.html index 50b0f416..5862872a 100644 --- a/docs/html/zeroex.js.html +++ b/docs/html/zeroex.js.html @@ -635,7 +635,7 @@

                Home

                Global

                • diff --git a/example.env b/example.env index 150d6cc4..08e820b3 100644 --- a/example.env +++ b/example.env @@ -49,4 +49,7 @@ ORDER_HASH="" ORDER_OWNER="" # Option to filter the subgraph query results with a specific order interpreter address -ORDER_INTERPRETER="" \ No newline at end of file +ORDER_INTERPRETER="" + +# Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables +SLEEP=10 \ No newline at end of file