mirror of
https://github.com/ZigZagExchange/zksync-lite-market-maker.git
synced 2025-12-17 07:04:23 +01:00
Merge pull request #93 from ZigZagExchange/dev
stage master - add Invert price feed
This commit is contained in:
14
README.md
14
README.md
@@ -193,6 +193,20 @@ With constant mode, you can set a fixed price to market make. The bot will not c
|
||||
}
|
||||
```
|
||||
|
||||
###### Invert price feed
|
||||
For some pairs, you might just find a price feed for the inverse of the pair. If you want to mm for ZZ-USDC and only find a USDC-ZZ price feed. In those cases, you need to invert the fee. This will only work if the secondary price feed is inverted as well or set to null.
|
||||
Example:
|
||||
```
|
||||
"ETH-USDC": {
|
||||
"side": "d",
|
||||
"priceFeedPrimary": "uniswapv3:0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
|
||||
"priceFeedSecondary": null,
|
||||
"invert": true,
|
||||
....
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Pair Options
|
||||
|
||||
These pair options can be set for each pair individual. You can even use more then on option per pair (though they might cancel each other out).
|
||||
|
||||
@@ -301,7 +301,9 @@ function genQuote(chainId, marketId, side, baseQuantity) {
|
||||
if (mmSide !== 'd' && mmSide === side) {
|
||||
throw new Error("badside");
|
||||
}
|
||||
const primaryPrice = PRICE_FEEDS[mmConfig.priceFeedPrimary];
|
||||
const primaryPrice = (mmConfig.invert)
|
||||
? (1 / PRICE_FEEDS[mmConfig.priceFeedPrimary])
|
||||
: PRICE_FEEDS[mmConfig.priceFeedPrimary];
|
||||
if (!primaryPrice) throw new Error("badprice");
|
||||
const SPREAD = mmConfig.minSpread + (baseQuantity * mmConfig.slippageRate);
|
||||
let quoteQuantity;
|
||||
@@ -721,8 +723,10 @@ function indicateLiquidity (pairs = MM_CONFIG.pairs) {
|
||||
|
||||
const marketInfo = MARKETS[marketId];
|
||||
if (!marketInfo) continue;
|
||||
|
||||
const midPrice = PRICE_FEEDS[mmConfig.priceFeedPrimary];
|
||||
|
||||
const midPrice = (mmConfig.invert)
|
||||
? (1 / PRICE_FEEDS[mmConfig.priceFeedPrimary])
|
||||
: PRICE_FEEDS[mmConfig.priceFeedPrimary];
|
||||
if (!midPrice) continue;
|
||||
|
||||
const expires = (Date.now() / 1000 | 0) + 10; // 10s expiry
|
||||
|
||||
Reference in New Issue
Block a user