A simple maker strategy for perpetual protocol v2. Please note that it uses a basic strategy and serves as a template for developers to create their own maker strategy. Use it at your own risk!
npm >=7 <=7.24.1nodejs >= 16- Since maker strategy will adjust your order, please make sure there's only 0 or 1 order in the account.
Warning Check your npm version by using
npm -v. It must be within the range ofv7.0.0~v7.24.1.v7.24.1is recommended. Using the versions >7.24.1to install packages will get stuck. To install or reinstall npm, runnpm install -g npm@7.x.x
$ git clone https://github.com/perpetual-protocol/perp-maker.git
$ cd perp-maker
$ npm install
$ npm run buildEdit the trading parameters in src/configs/config.json:
{// the frequency to check price in second"PRICE_CHECK_INTERVAL_SEC": 10,// the maximum gas fee in Gwei to adjust liquidity. If gas price exceeds this number, the liquidity won't be adjusted"ADJUST_MAX_GAS_PRICE_GWEI": 100,// Maximum 5 markets"MARKET_MAP": {"vBTC": {// set to `true` to enable this market"IS_ENABLED": true,// how many amount of USD (after leverage) to provide in the liquidity"LIQUIDITY_AMOUNT": 0,// the offset to upper price and lower price of the liquidity range.// e.g. if set to 0.5, it will provide liquidity with range [current price / 1.5, current price * 1.5]"LIQUIDITY_RANGE_OFFSET": 0.5,// the offset to adjust range liquidity.// e.g. if set to 0.1, it will adjust liquidity when the current price goes out of the range [market price / 1.1, market price * 1.1]"LIQUIDITY_ADJUST_THRESHOLD": 0.1},}}Provide your endpoint(s) and wallet private key in .env:
# endpoint(s)
L2_WEB3_ENDPOINTS={ENDPOINT1,ENDPOINT2,...}
# secrets
PRIVATE_KEY={WALLET_PRIVATE_KEY}
# stage
STAGE=["production"|"staging"]
# network
NETWORK=["optimism"|"optimism-goerli"]We have different markets between optimism and optimism-goerli.
Please check the market metadata in the following links:
$ env $(cat .env | grep -v '#'| xargs) npm run start$ docker build -f maker.Dockerfile -t perp-maker .
$ docker run --env-file ./.env perp-makerPrerequisite
~/.aws/credentialsshould have default profile withaws_access_key_idandaws_secret_access_key- copy
.env.exampleto.env - Fill in envs in
.env
Deploy
npm run build
npm run sls:deployIf any features/functionalities described in the Perpetual Protocol documentation, code comments, marketing, community discussion or announcements, pre-production or testing code, or other non-production-code sources, vary or differ from the code used in production, in case of any dispute, the code used in production shall prevail.
