Distributed hedging

Author: AresQuant, Created: 2023-09-06 18:34:05, Updated: 2024-04-01 15:18:37

Other information

Many of the content can not be presented face to face, only the key content can be selected for a simplified description, some basic content and details are not described, there are questions that can be consulted, there are problems that can be corrected, and there are problems that can be corrected. The strategy uses only the best way to solve problems, except for processes and norms that cannot be defined at this stage, which can be proposed if it is considered that there is a better way to solve the problem.

The reaction of the gains is the change in the quantity of the coin, which is not related to the price. The data does not include commissions, and the return on commissions is considerable. Different account conditions vary in terms of different rates of return, such as: level of fees, number of exchanges accessed, amount of funds, size of leverage, use of a third-party brokerage account (LTP, etc.); Use of cross-ocean dedicated lines, use of colocation services, collateral allocation speed, main/passive placement, participation in testing of new features, etc.; Hedging models, the use of neutral leverage, market making and other quantitative strategies for trading, risk threshold 0, very low retraction, large strategic capacity, correct mathematical expectations, can achieve stable growth of assets. Factors affecting the rate of return (weighting from high to low):

  1. The lower the exchange rate, the higher the return.
  2. The more volatile the market, the higher the yield, and the higher the volume.
  3. Whether to use exchange colocation services and low-latency dedicated networks.
  4. The algorithm is updated, which in theory increases the yield.
  5. The number of exchanges accessed, the more exchanges accessed, the higher theoretical returns and the lower the risk.
  6. The size of the leverage, theoretically the larger the leverage, the higher the return, in fact there is a mathematical maximum value depending on the industry, exceeding the maximum value will trigger more frequent stop losses to reduce the return, in addition, the higher the leverage, the lower the risk resistance.
  7. The faster the exchange rates, the higher the returns.

The strategy is flexible and can be customized if there are special needs, such as using LTP, using private dedicated lines, etc. Funds can be freely added and withdrawn without affecting the statistics and curve. After the initialization of the exchange account, the account, trading, positions, etc. can not be changed. Funds are weighted and allocated to the respective exchanges, and the amount of funds in different exchanges will become imbalanced over time, which can be handled manually or optionally processed automatically. Self-management strategies: As the capacity is constantly being upgraded and the existing funds are not enough, share to FMZ. In a deep bear market, there is no significant decrease in the yield from historical data and estimates of the size of the existing funds to increase the total capital to $10 million. Main risks: inherent risks of centralized exchanges, cloud server failures, procedural bugs, unsecured funds, please use dormant funds. Some risky events may require manual intervention, such as a crash or partial failure of an exchange, a cloud server equipment or network failure, or other unknown issues that the robot cannot handle. When an event occurs, the unanticipated probability of profit or loss is only 50% and the controllability is reduced. All exchange failures are unresolvable (almost impossible to happen) and some exchange failures are divided into the following situations (self-balancing according to the market):

  1. Non-fault exchanges continue to be profitable, and it is recommended that non-fault exchanges gradually level off after a certain amount of additional profit growth when the failure exchange reaches the price of the breakout.
  2. Faulty exchanges continue to be profitable, and it is recommended that non-faulty exchanges stop a certain number of losses based on the position's risk of settlement (the system automatically stops losses when the system is running normally).

The principle of profitability

The basic principle is simple, the same trading pair, A exchange low price, B exchange high price, A is more, B equals empty, so you get a spread, the spread is reversed and then the reverse again, and again the spread, and then you get the difference. At the moment, aerodynamics is a little bit out of place, and the effort to perform miracles is a little bit too much, which is followed by a bottleneck to rework the mathematical problems, there are solutions but not at the current stage of work.

The principle is simple details are complicated and not described in detail for two reasons:

  1. For example, how do you deal with the price difference without reversing it? How many different currencies do you have for each drop? How do you deal with the capital fee? How does a currency's price fluctuation affect the price of all holdings? Each detail has N solutions, and the description of the N-square case is enormous.
  2. Most of the details are classified as trade secrets, for example, some key formulas require inspiration, confirmation of guesses or access to some non-public information from the exchange, some key formulas require long phone conversations with the exchange commissioner. It takes a month to finally determine that the accuracy of some key formulas in the local offline calculation is exactly 16 bits after the exchange returns the data decimal point, the chip can be used, the chip design material and manufacturing tools can be given to you?

FMZ does not require the release of policy implementation details and source code, so please do not consult such questions, save each other time and create a win-win situation.

Updated by

The strategy is constantly upgraded, and the existing features have been stable for a long time, but there are still a lot of new features that need to be verified and there are a lot of other supporting work to be done, so it may be necessary to upgrade incompatibly. If you need to restart the hard drive or update the policy, you will be notified in the most accessible way possible. The hard drive's running state is not likely to be a problem, but the policy is not 100% guaranteed. After the launch, they no longer have to worry about the problems that arise in the real world, they are responsible for themselves, and their funds are only responsible for themselves. Upgrades may include modifying the exchange account model, upgrading the exchange API, upgrading incompatibilities such as access to new exchanges, algorithms, parameters, project restructuring, custodian upgrades, etc.

Chart

The most important chart is the unit net worth and the annualized rate of return, since the size of the funds and the outflows do not affect these two figures, the unit net worth and the share can be referenced to the fund section on Alipay or the Tencent Finance Communications Fund section on WeChat. Some of the data are not clear enough to ask questions and then add to it. Absolute earnings are only an auxiliary reference and do not reflect actual profitability, such as $300 in absolute earnings for running $1W a month, $2000 in absolute earnings for running $10W a month, and $300 in absolute earnings for running $1W a month. The rise in absolute returns is a sign that the strategic profitability has deteriorated.

The graph is not affected by inflows.

The total daily trading volume graph can be used to evaluate commission earnings.

For example, the 30-day annualized rate of return on a node on the curve represents the 30-day forward rate of return on that node converted to the corresponding annualized rate of return.

The logbook

The logs are mostly order logs, important logs are moved to the hierarchical tables in the status information bar, logs are cleaned on a regular basis and 65536 items are saved for each cleanup. Some users suspected that the hanging orders and positions were false, which is a low end, so here's a summary of the most common patterns of hanging orders and positions, with the number of contracts traded and the number of exchanges. The order log records in detail the entire life cycle of all orders, creation, modification, transaction, cancellation, and also records the limit price, market price information, and the complete sign-up operation! The order log corresponds to an exchange account listing, a physical disk with multiple nodes in a distributed system that simultaneously operate one account. The order log uses exchange.Log to record orders and transactions from other physical disks. Note that the okx sublist uses ws, so only exchange.Log can be used to record. The resulting order logs such as exchange.Buy (), exchange.Sell (), exchange.CancelOrder (), etc. only show the order operation, without modifying the price, quantity, transaction information, etc. So the unified use of exchange.Log (((), can record all the details. Subsequent increases in funding, increased distributed nodes, strategy upgrades, and increased exchanges lead to faster order log frequencies and more single-exchange positions. The consultant administrator can issue real coins, so the FMZ real disk records the real coins, there are doubts even to compare themselves, some real disk transaction frequency is too high and no longer capture the transaction record, some may still be seen.

I'm not going anywhere.

For the sake of simplicity, it does not mean that the strategy is exactly running as an example, but that the actual situation is far more complex than the example. Overlapping N variables will cause some differences in the actual operation.

The strategy operates normally without the risk of a hard flat, and has never happened in history, because there are perfect multi-level stop losses, the same currency A exchange does more, the same currency B exchange is empty, if the price of the currency continues to rise, the B exchange will have a hard flat risk. After the threshold is reached, exchange A and exchange B are both in the same position for the same number of contracts. The stop loss price is the difference between the two exchanges' potential gains or losses compared to the opening price, regardless of the handling fee for positive contracts. The price of BTC on both A and B exchanges is the same at 40000 USDT when BTC is opened, and the price of 1 BTC at stop loss is equal to 1 USDT when BTC is closed, and the stop loss is equal to 1 USDT if A is 4500 and B is 45000. Stop loss is 1 USDT if exchange A is priced at 45,000 and exchange B is priced at 4,5001.

The risk arises when an exchange crashes or partially fails, a cloud server equipment or network fails, or other unknown issues cause the robot to fail to process, resulting in either of two scenarios, unanticipated profit or loss.

I'm not going to lie. In the same currency A exchange has more, B exchange is empty, B exchange crashes, the price of the currency rises, B exchange is booming, has achieved a loss amount of 1000, because A exchange has more equity, when the boom A exchange is floating is about 1000, The price of the currency continued to rise, so that when exchange B resumed, exchange A floated at 1500, and after the recovery, the strategy would be equalised at exchange A, where the crash unexpectedly achieved a profit of 500 ((A profit minus B loss, 1500-1000)).

The B exchange can grade stop-loss (default strategy logic), stop-loss part of the strong par price moves some distance away, continue to rise and continue to stop loss, so the probability of a breakout is low, if after a few stops the A exchange recovers. The strategy is a one-time breakeven on the A exchange, which will earn an additional unexpected gain, because the stop loss is made early, but the stop loss is not made early, and the float is full.

Losses: In this case, the profitability is the other way round.

There are several other situations in which the market moves after an uncontrollable event, and the corresponding unanticipated profit or loss is automatically deduced, the principle is the same.

When there is a risk that cannot be handled by a robot, it may be possible to intervene manually and, after understanding the above principles, to handle it manually.

If conditional large capital can be added to support arbitration, monopoly systems, such as supporting system takeover in case of customization anomalies, API control is only in your own hands, which is fully achievable through FMZ extension API.

Safety and security

The policy uses an FMZ-bound exchange API, API SECRET only you know (including read-only API), non-read-only API must set IP whitelist binding host server IP, host is your own server, and the server is your own server. So the control of the API is entirely in your own hands, the API leakage or theft is your own responsibility, it has nothing to do with strategy, the FMZ extension API allows you to write your own monitoring monopoly scripts at milliseconds of self-isolating risk, and you can use the FMZ extension to create your own monitoring monopoly scripts. The script has no technical content and no unified standards, so the strategy itself does not provide this service and needs to be handled on its own. For example, there has been a large-scale API theft in Binance, which is not related to the policy, and it is recommended that Binance use the Ed25519 API type, which has the best performance and security, even if the Binance API is stolen, there is no risk.

There have never been any historical security problems and financial losses, the strategy is only responsible for the output of hedging and supporting logic, not collateral, not responsible for any form of financial loss, the strategy provides as much detailed true data as possible, reliability, security self-judgment.

In order to avoid anyone intentionally or unintentionally interfering, please do not use this strategy if you do not understand or agree with the above principles, processes, and disclaimers.

The policy itself cannot be handled safely and can be copied at will, because after logging in, it is impossible to prevent the user from viewing all records in real time, such as details of orders, transactions, flows, etc. I'm not sure if this is a problem for the government, but I'm sure there will be a confidential way to deal with it later. Based on the historical context and the underlying common sense, it is more likely that the cost benefits of copying are far less than the cost benefits of using it directly, as if you were going from point A to point B by getting into a car and driving it yourself. It is not always possible to flip the car several times, a large number of underlying details can be folded one or two times if they are not handled properly, but not necessarily to make money, this has happened to more than one person.

Automated withdrawals

For example, exchange A holds 200 positions, exchange B holds 200 positions, as the market develops, the collateral of exchange A gradually decreases, the corresponding equivalent leverage gradually increases, exchange B's collateral gradually increases, the corresponding equivalent leverage gradually decreases. This is when a balance needs to be drawn from exchange B to exchange A, otherwise exchange A will break even after the stop-loss threshold, with a higher probability of making a loss (see the section on the "Tough Panic").

There are several ways to do this, such as manually viewing the notification, writing the script yourself, or using a policy to automatically process it.

Trading all whitelists is restricted without any security risk, and whitelists must be added within the exchange if the policy is used.

When a large market (such as 312/519/LUNA/FTX) occurs, there is a huge difference in the same trading pair on different exchanges, and this is the time when the interest rate explodes. In this period, short-term small funds have gained an average of 20%, while large funds generally have gained 4%, and some accounts that do not use automatic withdrawals instead suffered losses, because the unilateral guarantee funds are insufficient to eat the positive difference. For example, a small BTC can be used as a passive-negative spread stop loss. The smaller the spread, the simpler the principle is. At the same time, the strategy will be extremely complicated in the case of a large number of transactions in all trades during the market, and the strategy may have access to N exchanges, for example two of them): Exchange A holds multiple positions, Exchange B holds empty positions, currency prices start to plummet A exchange price 37800, Exchange B price 38000, A exchange collateral starts to decrease gradually (possibly due to BTC positions, but also possibly other reasons) In addition, the B exchange's collateral began to increase gradually, which led to a sharp decline in the value of the B exchange. After the withdrawal threshold is reached, exchange B automatically withdraws the collateral to exchange A, at which point exchange A is priced at 34500, exchange B is priced at 36000, exchange A can be flat or open, exchange B can be flat or open. The profit of each BTC 1500USDT, although the exchange A UPNL or PNL negative, but with sufficient collateral after automatic withdrawal can continue to trade to earn more profit of each BTC 1500USDT. Because the main market is short-lived and can occur at any time in 24 hours, and only after the market is almost over or wakes up to see that the notice of withdrawal may cause a loss, the A exchange's losses increase gradually. Gradually triggering a stop loss (see the stop loss section below), this type of stop loss is less than normal, and will result in a larger difference in losses, with the A exchange and B exchange collateral each amounting to 50% before the market starts, and after the market ends, it may be possible. A shares accounted for 5%, B shares accounted for 95%, and the utilization rate dropped from 100% to 10%.

Note: USDT withdrawals are very fast most of the time.

The allocation of capital is somewhat random, and even if all exchanges weigh the same amount of capital, the allocation of capital may be large because the holdings are uncertain, such as three exchanges A, B, C with the same weights. A is empty, B is too much, the lever is open to stop 8 times, then A is empty, C is empty, so that A is 0, B is 8 times more, C is 8 times more, and so on. At this point, the hedge has nothing to do with A, and A is a total waste if he takes 1/3 of the money.

The size of the case varies from case to case, and the data in each case are different.

Conditions

Minimum: 20 W USD equivalent of assets Highest: Unlimited

Rate: Must have a high VIP rate or market rate

Returning to work

I'm not going to say that I'm not a fan of this, but I'm not a fan of this. She'll be able to do it herself and hang it here.https://t.me/Lentil_cocoI have a very high commission rate, I have a problem with her directly, my commission is hanging on her. If it doesn't work out, you don't have to pay back the commission.

OKX submits the order time tag parameter 93eb51db275cBCDE to automatically get 30% broker commission back to your own account (default policy). The broker's commission rate is 10% when the node returns the commission. Do not run this strategy and it will automatically return the commission to your own account, as the broker's rank increases, the commission rate will also increase.

OKX register a new account or activate an old one. I have a node that currently returns 30% of the ranking, returns all the commission to you, returns directly to your account 20% (maximum can only be set to 20%), and then sends you a refund. The remaining 10% will be transferred to you manually. The remaining 10% will be transferred to you manually.https://www.okx.com/cn/join/aresquant

Costs

The strategy itself is free and divided by net income (including commission income) at a rate of 30%. Users who are already logged in can invite new users and get 20% of the new user's revenue share, which requires them to handle all transactions such as pairing and settlement themselves. There is no prepayment, check in manually. Losses such as exchange bankruptcies, third-party commission settlements and strategic losses are not included.

The real thing

Distributed hedging - Tokyo Distributed hedging - Singapore

A distributed system has multiple nodes, and the strategy is not to run all nodes, but only the high-weighted nodes.

The telegram

https://t.me/Aresx333I'm going to start by looking at the documentation, and I'm going to write as much as I can.

FAQ

  • Why is the data not including commission? Since the default account return cannot reflect all account returns, different account conditions have a large return gap:

    1. The percentage of return varies
    2. There is a large gap in volume between how exchanges are combined, resulting in a large gap in commissions.
    3. Transaction processing fees have a large gap between different trading volumes, resulting in a large return commission gap
    4. No commissions for being a market trader
    5. There is no standard method of calculation for accurate calculation, for example: OKX, BYBIT unify USDT, currency return transaction for settlement currency, if there is a BNB offset, return BNB

    The commission can be estimated by volume of transactions, which in most cases is about one-tenth of the total volume.

  • Why does the yield curve only contain positive contracts? Since the yield curve can only represent one pricing currency, using positive contract yields is most appropriate, the strategy operates simultaneously in multi-category markets, and converting unstable currency yields into stable currency yields does not have a uniform standard of calculation. For more detailed data, see the chart below.

  • Why does the earnings curve start earlier than real time and have less data? The time is earlier than the real time because the automated strategy starts early, and the same proportion of imported historical data is easy to observe. The data is less because the gain snapshot is aggregated by time period, which allows you to see the entire curve on one page for easy observation. Look back at 1-2 years of data for suspected curve problems, three months of full-time development, finding and helping to fix N host bugs (including major memory leak bugs), and not doing these things to create fake data to be with you.

  • Why are the strategic parameters so complicated? The policy parameter is actually one, the parameter type is very single, just more configuration items, to maximize security and performance. If you understand the basics, you know that these complexities are not necessities of the strategy itself, because they are the only way to solve the problem.

  • Why aren't there other common exchanges? The first priority of the strategy is security, so prioritize access to the ranking based on the exchanges with a history, the returns will be low but the security of the asset will be higher, even if the user suggests never to access the FTX, because the history is too short. Different users have different risk preferences, and in order to increase returns, the strategy is to freely choose whether or not to access the ranked exchanges that will subsequently support them.

  • Why is it only a telegram? Since most of the consultations are merely consultations, using the telegram is the most convenient, there are no extra steps to start communicating directly, no need to add WeChat friends and verify or QQ friends or other extra operations.

  • MORE The comments may also contain some useful information.

Access to

When you need to run, find me in the FMZ background to generate the registration code, and then give you the manual binding exchange to start the real thing. The host must deploy to the corresponding node, as the latency is minimal. The access exchange shall not be less than two, and at least one of the nodes where the custodian is located shall be accessed. The number of exchanges supported will increase as development progresses.

Nodes and exchanges

Nodes The Exchange Cloud service providers Geographical area Available area ID
Singapore BYBIT AWS Asia Pacific (Singapore) ap-southeast-1 apse1-az3
Japanese BINANCE态COINEX AWS Asia-Pacific (Tokyo) ap-northeast-1 apne1-az4
Ireland BITMEX AWS Europe (Ireland) eu-west-1 euw1-az3

Please note: The policy parameter cannot delete an exchange after accessing an exchange and opening a position, otherwise the policy will assume that the total number of positions is missing after launching, and the missing number is the number of holdings on the exchange that are removed. The strategy will make up for missing positions on other exchanges.

Exchange weightings (taking into account only the yield):

  1. BYBIT
  2. OKX
  3. COINEX
  4. BINANCE
  5. BITMEX

OKX API version is V5. BYBIT API version is V5 OKX account model: single currency collateral model BYBIT account mode: Classic account, currently not supported unified account

Lower limit of server configuration

Memory: The policy itself requires no more than 128 MB of memory (excluding the memory of the robot fork subprocess itself)

Bandwidth: In most cases it is not more than 10M, the traffic uncertainty is too much ((and the market relationship is large, the strategy is also constantly being updated) so it is not necessarily accurate, it is necessary to observe the server bandwidth usage and the packet loss rate limit to adjust the situation.Network performance of AWS common instancesGenerally, no ENA is required, and some special customizations may require ENA support.

The CPU: Unlimited, with an average single-core CPU load of no more than 0.6

The disc: Available space greater than 64MB

Recommended configuration: AWS t4g.nano Unlimited mode (self-monitoring whether CPU points need to be upgraded in the EC2 instance), prices vary from region to region, at the time of posting Singapore $0.0053/hour, equivalent to $3.816/month. The price is $0.0028/hour in other parts of the world. You can also get a discount of up to 72% with Savings Plans.Amazon EC2 cloud server priced on demand Amazon Savings Plans


More