Function uncrossL2

  • The purpose of this function is uncross the L2 orderbook by modifying the bid/ask price at the top of the book This will make the liquidity look worse but more intuitive (users familiar with clob get confused w temporarily crossing book)

    Things to note about how it works:

    • it will not uncross the user's liquidity
    • it does the uncrossing by "shifting" the crossing liquidity to the nearest uncrossed levels. Thus the output liquidity maintains the same total size.

    Parameters

    • bids: L2Level[]
    • asks: L2Level[]
    • oraclePrice: BN
    • oracleTwap5Min: BN
    • markTwap5Min: BN
    • grouping: BN
    • userBids: Set<string>
    • userAsks: Set<string>

    Returns {
        asks: L2Level[];
        bids: L2Level[];
    }

Generated using TypeDoc