Go to file
Riordan Panayides 30ac0c703d Add sequence enforcer devnet id 2022-07-06 20:35:19 +01:00
.github/workflows New feature: dependency vuln scanning 2022-01-09 12:49:59 +00:00
params Update devnet config 2022-07-06 19:13:08 +01:00
src Add sequence enforcer devnet id 2022-07-06 20:35:19 +01:00
.gitignore first 2021-11-28 12:39:07 -05:00
LICENSE Initial commit 2021-11-26 11:21:06 -05:00
Procfile Update devnet config 2022-07-06 19:13:08 +01:00
README.md Fix a couple of config variable names in README 2022-02-25 13:24:55 -06:00
package.json Update mango-client, add testnet configs 2022-07-06 19:05:34 +01:00
run.sh update run.sh 2021-11-28 14:36:15 -05:00
tsconfig.json first 2021-11-28 12:39:07 -05:00
yarn.lock Update mango-client, add testnet configs 2022-07-06 19:05:34 +01:00

README.md

Mango Markets Market Maker

Setup

To run the market maker you will need:

  • A Solana account with some SOL deposited to cover transaction fees
  • A Mango Account with some collateral deposited and a name (tip: use the UI)
  • Your wallet keypair saved as a JSON file
  • node and yarn
mkdir blockworks-foundation
cd blockworks-foundation
git clone https://github.com/blockworks-foundation/market-maker-ts.git
cd market-maker-ts
yarn install

## Open .env file and set env vars like this example ##
export KEYPAIR=~/.config/solana/id.json
export ENDPOINT_URL="https://mango.rpcpool.com/946ef7337da3f5b8d3e4a34e7f88"
export PARAMS=default.json

## Set mangoAccountName in params file to reflect the name of your MangoAccount

Run via terminal

. run.sh

Run via systemd

If you're running the market maker on a server, you might want to run it via systemd to have auto restarts

chmod 755 run.sh
cd /etc/systemd/system
sudo nano mm.service

## Set the systemd service file like this and replace the *** lines with your own
***ExecStart=/home/dd/blockworks-foundation/market-maker-ts/run.sh
***WorkingDirectory=/home/dd/blockworks-foundation/market-maker-ts/
Restart=always
RuntimeMaxSec=1800
RestartSec=5s
LimitNOFILE=4096
IgnoreSIGPIPE=false
KillMode=control-group
***User=dd

sudo systemctl daemon-reload
sudo systemctl start mm.service

You can watch the log output with:

journalctl -f -u mm.service

And stop the mm:

sudo systemctl stop mm.service

Environment Variables

Variable Default Description
ENDPOINT_URL https://mango.rpcpool.com Your RPC node endpoint
KEYPAIR ${HOME}/.config/solana/id.json The location of your wallet keypair
PARAMS default.json params file

Market Maker Params

See params/default.json for an example

Variable Default Description
group mainnet.1 Name of the group in ids.json
interval 10000 Milliseconds to wait before updating quotes
mangoAccountName N/A The MangoAccount name you input when initializing the MangoAccount via UI
mangoAccountPubkey N/A If no MangoAccount name, just pass in the pubkey
assets N/A Mapping of symbols to trade and their specific params
sizePerc 0.1 The size of each order as a percentage of equity
charge 0.0010 How much to increase quote width from centralized exchange
leanCoeff 0.0005 How much to move the quotes per unit size of inventory
bias 0 Fixed amount to bias. Negative values bias downward. e.g. -0.0005 biases down 5bps
requoteThresh 0 How much new bid/ask price must change to requote; e.g. 0.0002 implies 2bps
ftxSize 100000 How much to look up spread on centralized exchange
tif N/A Time in force in seconds for maker orders
processes [] List of lists of assets specifying MD streams to put in separate processes (e.g. in params/devnet_multiproc.json)