Subscribe to vol
Subscribe to vol
Share Dialog
Share Dialog
Exchanges need liquidity, and they’ll pay token-holders to provide it — but the relationship isn’t exactly symbiotic. Until recently, becoming a “liquidity provider” meant giving up control of your coins to a pool, or writing sophisticated market-making software on your own. Is there a better way to crowdsource market depth?
Enter the ZigZag Market Maker: a simple pre-rolled library for anyone who wants to run a small market on their own — with no intermediaries and no complexity. And while this library might require you to host your own VPS, anyone with some command line experience can get it up and running quickly.
In this post, we’ll talk about the design rationale behind the Market Maker, and how to deploy it.
What You’ll Need
The code for the Market Maker can be found in Github here; the direct download link is here. Begin by downloading this repo, and remember: the ZigZag team and community is always available to help you get your bot running. If you get stuck, head over to to the designated channels in Discord.
You will also need the following:
Activated zkSync account
Ethereum private key of that account
Funds in that account corresponding to the pairs you want to market make
Cryptowatch API key (free for limited time)
Node.js v.16
Optionally, a VPS in the US (ZigZag runs on AWS US East)
Note: In order to provide liquidity for a market, there must be an existing market on another exchange with greater liquidity, and it must be listed on Cryptowatch. It is crucial that the oracle market has several sources of liquidity, to prevent the opportunity for oracle attacks. The ability to run standalone markets, without listings elsewhere, is in the ZigZag roadmap.
Installation (macOS, Windows, and Linux)
This library works on both Mainnet and Rinkeby testnet.
Open Terminal on macOS or Linux. If on Windows, open the command prompt or install the Terminal application from the Windows App Store
Use the “cd” command to enter the directory of the Github repo you downloaded
Run
Duplicate the config.json.EXAMPLE file from the Market Maker folder and rename it to <config.json>
Open <config.json> with a text editor such as Nano or Vim
Paste in the CryptoWatch API key to its designated field
Paste in the Ethereum private key to its designated field
Set the pairs to true (active) if you want to market make them, or set them to false (inactive) if you don’t want to run them
Adjust sizing in the base asset and spread (expressed as a percentage)
Save and close the config file
Open the Terminal and run the bot by typing
As with any command line application, simply hit CTRL-C to stop the bot and return to the prompt.
Consider Your Goals
Before you load up your wallets, consider what you hope to achieve by running the bot. One of the most important considerations will be positioning and sizing.
If your goal is to provide two-sided market depth for a new project, then you may need to rebalance each day to counteract the net effects of that day’s buyers and sellers.
On days where your token is in high demand, there’s a chance a whale comes in and buys the entire ask side. On days where your token is crashing, the same might happen in reverse, wiping out your bid side. Size your positions large enough that other traders can’t easily manipulate your bot. You may consider hedging several times per day on another exchange, to retain control of your financial exposures.
Note: It is possible to set one-sided markets. By default, the side setting is set to d, which stands for double-sided liquidity. To toggle single-sided liquidity, the value can be set to “b” or “s” for “buy-side only” or “sell-side only.” This setting is useful if you have a large bag of coins you’d like to liquidate or accumulate by dollar-cost-averaging.
Exchanges need liquidity, and they’ll pay token-holders to provide it — but the relationship isn’t exactly symbiotic. Until recently, becoming a “liquidity provider” meant giving up control of your coins to a pool, or writing sophisticated market-making software on your own. Is there a better way to crowdsource market depth?
Enter the ZigZag Market Maker: a simple pre-rolled library for anyone who wants to run a small market on their own — with no intermediaries and no complexity. And while this library might require you to host your own VPS, anyone with some command line experience can get it up and running quickly.
In this post, we’ll talk about the design rationale behind the Market Maker, and how to deploy it.
What You’ll Need
The code for the Market Maker can be found in Github here; the direct download link is here. Begin by downloading this repo, and remember: the ZigZag team and community is always available to help you get your bot running. If you get stuck, head over to to the designated channels in Discord.
You will also need the following:
Activated zkSync account
Ethereum private key of that account
Funds in that account corresponding to the pairs you want to market make
Cryptowatch API key (free for limited time)
Node.js v.16
Optionally, a VPS in the US (ZigZag runs on AWS US East)
Note: In order to provide liquidity for a market, there must be an existing market on another exchange with greater liquidity, and it must be listed on Cryptowatch. It is crucial that the oracle market has several sources of liquidity, to prevent the opportunity for oracle attacks. The ability to run standalone markets, without listings elsewhere, is in the ZigZag roadmap.
Installation (macOS, Windows, and Linux)
This library works on both Mainnet and Rinkeby testnet.
Open Terminal on macOS or Linux. If on Windows, open the command prompt or install the Terminal application from the Windows App Store
Use the “cd” command to enter the directory of the Github repo you downloaded
Run
Duplicate the config.json.EXAMPLE file from the Market Maker folder and rename it to <config.json>
Open <config.json> with a text editor such as Nano or Vim
Paste in the CryptoWatch API key to its designated field
Paste in the Ethereum private key to its designated field
Set the pairs to true (active) if you want to market make them, or set them to false (inactive) if you don’t want to run them
Adjust sizing in the base asset and spread (expressed as a percentage)
Save and close the config file
Open the Terminal and run the bot by typing
As with any command line application, simply hit CTRL-C to stop the bot and return to the prompt.
Consider Your Goals
Before you load up your wallets, consider what you hope to achieve by running the bot. One of the most important considerations will be positioning and sizing.
If your goal is to provide two-sided market depth for a new project, then you may need to rebalance each day to counteract the net effects of that day’s buyers and sellers.
On days where your token is in high demand, there’s a chance a whale comes in and buys the entire ask side. On days where your token is crashing, the same might happen in reverse, wiping out your bid side. Size your positions large enough that other traders can’t easily manipulate your bot. You may consider hedging several times per day on another exchange, to retain control of your financial exposures.
Note: It is possible to set one-sided markets. By default, the side setting is set to d, which stands for double-sided liquidity. To toggle single-sided liquidity, the value can be set to “b” or “s” for “buy-side only” or “sell-side only.” This setting is useful if you have a large bag of coins you’d like to liquidate or accumulate by dollar-cost-averaging.
To learn more about pair settings, view the ReadMe.
Design Goals
One of the challenges for new projects is bootstrapping liquidity on exchanges. And while ZigZag has disintermediated the listing process, a listing is no good without some liquidity — in fact, it won’t even appear until there are some lots available on the ask side.
But for many projects, writing market-making bots is a foreign skillset, and the path towards earning one is mined with expensive trading losses. There are few bugs as expensive as market-making bugs.
With the Zig Zag Market Maker, providing liquidity is reduced to a series of copy-pastes — and depending on the demand for the pair you’re trading, it can be quite profitable.
Security Notes
By default, the bot doesn’t expose any open ports; thus there is no point of entry for an attacker. Do not open unnecessary ports. For a longer guide on setting up a VPS securely, see this tutorial.
Questions about running the Market Maker bot? Comments on this tutorial? Join our Discord to get help from the community.
To learn more about pair settings, view the ReadMe.
Design Goals
One of the challenges for new projects is bootstrapping liquidity on exchanges. And while ZigZag has disintermediated the listing process, a listing is no good without some liquidity — in fact, it won’t even appear until there are some lots available on the ask side.
But for many projects, writing market-making bots is a foreign skillset, and the path towards earning one is mined with expensive trading losses. There are few bugs as expensive as market-making bugs.
With the Zig Zag Market Maker, providing liquidity is reduced to a series of copy-pastes — and depending on the demand for the pair you’re trading, it can be quite profitable.
Security Notes
By default, the bot doesn’t expose any open ports; thus there is no point of entry for an attacker. Do not open unnecessary ports. For a longer guide on setting up a VPS securely, see this tutorial.
Questions about running the Market Maker bot? Comments on this tutorial? Join our Discord to get help from the community.
<100 subscribers
<100 subscribers
No activity yet