Original author: Jackson
Original source: CoFiX Fans
CoFiX , as a computable financial transaction model, requires market maker role to provide capital liquidity. It must be pointed out that the act of adding liquidity to CoFiX's fund pool is not "saving", but participating in "market making"! Liquidity providers should fully understand the risks involved.
In short, liquidity is added to CoFiX’s capital pool, which means that market makers obtain income during the transaction by assuming a certain risk of price fluctuations the behavior of. The market-making, redemption, and exchange transactions defined in CoFiX may affect the capital structure of the CoFiX capital pool, which is the source of price fluctuation risk.
It is not terrible to have risks. The biggest advantage of CoFiX design is that these risks can be calculated, so that participants can effectively manage and perfectly hedge these risks according to their own risk preferences. risk.
In simple terms, market makers can eliminate the risk of price fluctuations by hedging off-site reverse transactions. The basic idea is: according to the structure of the funds in the fund pool and the proportion of your share, calculate the part you can share in real time, compare it with the reference point you selected, and eliminate the negative increment, so as to ensure that at any price, the total Assets are in a state of growth.
Because different people have different knowledge backgrounds, it is difficult to understand the hedging logic of CoFiX. This article assumes that readers have a comprehensive understanding of the basic logic of CoFiX, have a basic understanding of Ethereum and Ethereum-based DeFi, and gradually derive the hedging logic of CoFiX from the simplest model.
Suppose Alice has total assets of 200ETH and 2000USDT, and thinks this is her ideal asset allocation, we call it "reference state". Later, Alice hopes to increase the value of assets by participating in certain activities (such as DeFi).
Suppose Alice participates in a certain DeFi, The assets have become as follows:
Obviously, the above three situations are better than the reference state (200ETH, 2000USDT), no matter how the price of ETH/USDT changes. We call this "absolute growth."
Assume now The price is 400, that is, 1ETH=400USDT. At this time, it is obvious that Alice's asset situation is also better than the reference state (200ETH, 2000USDT). However, this optimization depends on the price of ETH/USDT: - When the price of ETH falls below 1USDT, 201ETH, 1999USDT will suffer losses relative to the reference state. - When ETH rises above 1000USDT, 199ETH, 3000USDT will lose compared to the reference state.
It can be seen that the profit and loss in this situation depends on the price. When the price changes, the profit and loss state may change, which we call "relative growth".
Assuming now The price is 400, that is, 1ETH=400USDT. At this time, it is obvious that Alice's asset situation is worse than the reference state (200ETH, 2000USDT). Of course, this worsening also depends on the price of ETH/USDT. We call this "relative loss".
If this happens, it means that Alice’s participation in DeFi caused her to lose money.
As for the absolute growth, it means that Alice directly gains profits in the process of participating in DeFi, without any uncertainty.
For relative growth, it means that Alice may Profitable, but dependent on price. In order to eliminate the uncertainty caused by price changes, Alice can change the state into an absolute growth state by doing an equivalent exchange.
201ETH, 1999USDT For this state, Alice can sell 1ETH in exchange for 400USDT; or sell 1/400ETH in exchange for 1USDT (or is any state between these two points), to reach the absolute growth state. 199ETH, 3000USDT For this state, Alice can use 400USDT to buy 1ETH, or use 1000USDT to buy 2.5ETH (it can also be any state between these two points), so as to achieve an absolute growth state. We call the two operations above Alice "hedging".
For relative loss, loss It has already occurred, and the loss situation cannot be changed through the hedging operation described in 2. In this case, there are two possibilities:
- Alice’s participation in DeFi directly brings losses to Alice
- Alice does not Timely hedging, price fluctuations cause losses
For absolute losses, losses It has already happened, and there is no way to change the loss situation through hedging. In this case, there are two possibilities:
- The DeFi that Alice participates in directly brings losses to Alice
- Alice did not hedge in time, and price fluctuations caused losses
As a person who invests in DeFi, Alice hopes to make a profit and ignores the risks brought by price fluctuations. The state of absolute growth can achieve this goal. That is, Alice's goal is the 1 state.
For state 2, Alice can convert the state to state 1 by timely hedging.
For states 3 and 4, there are two possible causes:
One of them is DeFi brings losses to Alice, and Alice can avoid this situation by adjusting her strategy (the participation strategy is incorrect) or not participating in this DeFi (DeFi itself may be arbitraged). Another possibility is that it did not hedge from state 2 in time, causing it to evolve into state 3 or 4. The importance of hedging can be seen.
Conclusion: Hedging is the operation of changing the relative growth state to an absolute growth state and avoiding its evolution into a relative loss state or an absolute loss state. To hedge, a reference state must first be selected as a basis. To maintain certain returns, hedging is inevitable.
Assume that Alice participates DeFi is market-making on CoFiX, and it provides liquidity for the “ETH/USDT” fund pool. Let’s take a look at some of the choices she will face.
Assuming Alice’s total assets are 200ETH and 2000USDT, she puts 100ETH and 1000USDT in CoFiX for market making, and another 100ETH and 1000USDT are placed off-site for hedging.
In order to simplify the problem, first consider that only Alice is the market maker in CoFiX. At this time, Alice's share accounts for 100%, and the following simulates the operation process (the following calculations ignore transaction fees).
Bob buys 1ETH from CoFiX with USDT. At this time, the price of ETH/USDT is 400. Considering the K value of CoFiX and theta handling fee, Bob actually uses 410USDT In exchange for 1ETH. At this time, there are 99ETH and 1410USDT in the CoFiX fund pool.
Since Alice's share accounts for 100%, all the funds in the CoFiX fund pool belong to Alice, so Alice's total assets at this time become 199ETH and 2410USDT, which is Corresponding to the relative growth state described in the previous section, there is a risk of price fluctuations, and hedging operations are required.
According to the previous description, Alice needs to do a hedging operation at this time. The specific operation method is to take out 400USDT from the assets used for hedging and exchange it for 1ETH at the exchange , after the exchange, Alice's external hedging assets are 101ETH, 600USDT, and the total assets are 200ETH, 2010USDT, which is in a state of absolute growth.
Afterwards, CoFiX exchanged transactions one after another, with different exchange directions. Alice needs to keep repeating the hedging operation described in 2 according to the status of transactions in the transaction pool to ensure that the assets are always in a state of absolute growth. If CoFiX has multiple forward and reverse transactions in a short period of time, the changes in the asset ratio between these transactions will offset part of it. Given the continuity of market prices, Alice can hedge against the total change brought about by these transactions.
The above description is the situation where only Alice makes the market, but the reality is usually not like this. Next, let's evolve and analyze more complex situations step by step. Going back to the original state, consider that before Alice, Carol was already making the market, and after Alice joined, the shares accounted for 50% each.
Bob buys 1ETH from CoFiX with USDT. At this time, the price of ETH/USDT is 400. Considering the K value of CoFiX and theta handling fee, Bob actually uses 410USDT In exchange for 1ETH. At this time, the CoFiX fund pool has decreased by 1ETH and increased by 410USDT.
Since Alice's shares accounted for 50%, Alice's assets at this time decreased by 0.5ETH, increased by 205USDT, and the total assets were 199.5ETH and 2205USDT. According to the previous description, Alice needs to do a hedging operation at this time. The specific operation method is to take out 200USDT from the assets used for hedging and exchange it for 0.5ETH at the exchange. After the exchange, Alice’s external hedging assets are 100.5ETH and 800USDT. The total assets are 200ETH and 2005USDT, which are in a state of absolute growth.
Considering that people join CoFiX one after another, the total share of the CoFiX capital pool will increase, and the corresponding proportion of each market maker will decrease. Consider market making first All market makers enter in equal proportions of funds, that is, it will not affect the capital structure of other market makers. At this time, when the CoFiX capital pool changes through transactions, each market maker only needs to hedge its own proportion of the increment according to its own proportion.
Reconsider that market makers do not join in the same way as market makers. This will bring about two effects:
1. The share of the fund pool will increase, and at the same time the proportion of funds in the fund pool will change. This can be split into a proportional market making and an exchange transaction.
2. The capital structure of the new market maker changes before and after market making. In this case, market makers need to deal with it themselves.
There are two strategies: A) accept the change of capital structure, use this state as a reference state B) do not accept the change of capital structure, after market making, immediately Initiate a hedging transaction.
Reference status: to judge For profit and loss, a reference state must be selected. This reference state is the standard for users to judge profit and loss, and it is also the goal and basis of hedging operations.
Three basic operations of market making, redemption and exchange are defined in CoFiX, among which market making and redemption are For market makers, transactions are for ordinary users.
For exchange transactions, no matter which direction they occur from, they can be hedged according to the strategy described in the "CoFiX Market Making" section above. For market making and redemption, it can be divided into "equal ratio market making/redemption" and "unequal ratio market making/redemption".
For equal ratio market making/redemption This is equivalent to only changing the share ratio of each market maker, without changing the asset structure, so other market makers only need to recalculate their own shares in the subsequent hedging.
For unequal market making / Redemption, which can be split into an equal ratio of market making / redemption, and an exchange transaction for processing.
According to the above description, for the three operations of market making, redemption, and exchange, market makers do not need to handle them separately, but can treat them uniformly, that is, according to the CoFiX capital pool The total amount of ETH, the total amount of USDT, the total share of the fund pool, and the share of the market maker in each state in each state are used to calculate the amount of ETH and USDT that you can obtain, compare it with the reference state, and then follow the above Hedge in the manner described.
According to the previous description, there are many specific hedging strategies. In order to make it easier for users to participate in CoFiX market making, we have chosen a strategy to realize the automatic hedging function through coding. According to the basic idea described above, this hedging program implements a strategy for automatic hedging. The specific logic is as follows:
The program defines an asset structure reference state , and then poll to detect state changes, and get state change increments. When the increment of an asset is less than 0 and the absolute value exceeds a set threshold, another asset is sold to make up for the negative growth asset (due to the CoFiX trading mechanism, it can ensure that market makers need to sell The amount of assets out is less than its increment, so as to achieve profit) After completing the hedging operation described in 2, update the new state to the reference state.
When the program is running, the state obtained for the first time is used as the reference state.
For more information about this hedging program, please refer to: https://github.com/Computable-Finance/CoFiX-hedger
Answer: Since the market-making process is the fusion of market maker funds and CoFiX capital pool funds, as long as the ratio of the two is inconsistent, the market-making action will lead to The ratio of market makers and capital pools changes before and after market making. For market makers who initiate market-making operations. The following coping strategies can be adopted:
A) According to the proportion of funds in the fund pool, make the market in equal proportions. Before and after the market is done, the fund structure on both sides will not change.
B) Accept the change of capital structure, and use this state as a reference state
C) Not accept the change of capital structure, initiate a hedging transaction immediately after market making.
Answer: The allocation of hedging assets is essentially to fill in the incremental changes in the capital structure of market makers in CoFiX. Since transactions can be carried out in both directions, transactions on both sides The amount will not be strictly matched, resulting in an unbalanced capital ratio. This possible unbalanced ratio determines the allocation ratio of hedging assets. There is no absolute suggestion for this ratio. In the previous example, it is 1:1, which is a safer method. practice, but the capital utilization rate is not high.
The actual ratio depends on the user's expectation of the unbalanced ratio of assets in the CoFiX capital pool. CoFiX has designed a mining balance coefficient To try to promote the balance of the CoFiX capital pool, but this is not an absolute guarantee. For pessimists, the proportion of hedging funds can be increased, and for optimists, the proportion can be adjusted lower.
However, regardless of pessimism or optimism, when there is an imbalance of funds and one type of hedging funds is about to be exhausted, you must take action and consider stopping market, or readjust the asset structure.
Is it possible to only hedge once when entering and when exiting? Answer: No. Hedging is to avoid the risks brought about by price fluctuations that exist all the time. If hedging is only done once when entering and exiting, then during the market making period, it is assumed that assets that are about to increase in price are exchanged and assets that are about to depreciate are exchanged in, so that each exchange will make the CoFiX capital pool depreciation of assets.
Of course, the actual situation may not be the case, and it may even be reversed, but we cannot make assumptions about price changes, because The purpose of hedging is to eliminate the risks brought about by price fluctuations and achieve certain growth.
Answer: The hedging funds need to be divided into ETH and USDT. There are two cases of insufficient funds:
p>
A) Generally, when there is not enough hedging funds, one asset is not enough (usually because CoFiX is traded in one direction, resulting in one hedging asset being replaced by another).
B) In the CoFiX fund pool, due to changes in transaction timing and market trends, assets that are always about to depreciate are exchanged, so that the CoFiX fund pool has been realizing appreciation through transactions. At this time, due to hedging, it may As a result, both hedging assets are slowly depleted. ( It should be noted that this does not represent a loss, because the essence of hedging is to eliminate the uncertainty of price fluctuations. This uncertainty may be beneficial or harmful, but whether it is beneficial or harmful, it has already It has been hedged, it is difficult to understand this logic, and you need to think carefully)
At this time, there may be a situation where hedging cannot continue. In order to avoid the risk of price fluctuations and ensure the safety of funds, you need to stop doing it immediately market, or readjust capital allocation.
Can hedging be done by initiating a transaction in CoFiX? Answer: No. The essence of CoFiX is to allow market makers to exchange for profits in the transaction process by assuming a certain risk of price fluctuations. The basic assumption is that the transaction cost of CoFiX is higher than that of over-the-counter transactions, so that market makers can achieve relatively certain profits through hedging.
Due to the high transaction cost of CoFiX, if the market maker completes hedging by trading in CoFiX, there will be a larger hedging cost, resulting in unprofitability or even loss. This approach is tantamount to trying to step on the right foot with the left foot.
Answer: It is possible. Market makers obtain profits during the trading process by assuming a certain risk of price fluctuations, which can be minimized through hedging. However, some objective factors may still cause market makers to lose money, which is mainly reflected in two aspects:
A) Market making If the dealer does not hedge this situation, the risk of price fluctuations will always affect the market maker, and losses are very likely to occur.
B) Hedging is not timely. Due to the untimely hedging, or the price fluctuation is too violent, and the hedging program is executed at a long interval, it may lead to losses.
Answer: At this time, although USDT can only be redeemed in the fund pool, a large amount of ETH has been bought in the hedging funds, and the total amount of ETH will not reduce.
Original link blockquote>
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia