Loading ...

币安资金费率套利策略正式版 Ver 0.2.8

Author: 张超, Date: 2021-04-02 10:36:00
Tags: Hedge Binance swap

Video tutorials

Introduction to FMZ Quant Trading Platform: https://www.bilibili.com/video/BV1eZ4y1c73v?share_source=copy_web Binance funding rate arbitrage strategy (1): https://www.bilibili.com/video/BV1qK4y1K71D?share_source=copy_web Binance funding rate arbitrage strategy (2): https://www.bilibili.com/video/BV16B4y1w7cJ?share_source=copy_web

Updated content

Ver 0.2.8 2021.05.11 10:20:00

    1. Optimize the order ordering of the strategy, and place the order with the largest current rate+opening position premium first to avoid missing the opportunity when the position is first established
    1. Fixed the bug of auto-balance

Ver 0.2.7 2021.04.30 12:16:00

    1. Updated the fault tolerance
    1. Changed the minimum order quantity of the check function
    1. Added the order direction
    1. Added the reacquire precision function

Ver 0.2.6 2021.04.22 11:16:00

    1. Changed the mechanism of automatic position reduction without setting the automatic rebalancing ratio, changed the algorithm of automatic position reduction, refer to the manual for details
  • 2.Added the information of order and position closing
    1. Added automatic closing of excess futures positions to avoid imbalance
    1. All market positions are obtained asynchronously, reducing the period time and improving the success rate of the order grabbing
    1. Avoid repeated opening and closing of positions caused by the delay of spot positions
    1. Increased the prompt of spot position change
    1. Updated the problems caused by the change of the accuracy of Binance
    1. Increased the verification of spot position and futures position to avoid the bug and delay of data returned by Binance

Ver 0.2.5 2021.04.08 13:16:00

    1. Added the function of profit adjustment
    1. Updated account information more frequently
    1. Record log for each position change
    1. Updated the imbalance of premium closing positions

Ver 0.2.4 2021.04.08 13:16:00

    1. Added the custom leverage multiplier
    1. Fixed the bug that extreme cases cannot be balanced
    1. Options for opening and closing position premium rate
    1. Added the display of position reduction queue

Ver 0.2.3 2021.04.06 16:16:00

    1. Alarm leverage
    1. Automatic position reduction
    1. Automatic rebalancing
    1. Automatic transfer of funds
    1. Display the used amount of the current version
    1. Show used leverage multiplier
    1. Change strategy limit to total opening position value limit

Strategy launch

  • In April, great upgrade, more efficient access to the market and order placement
  • In March, great upgrade of closing position logic and warning
  • On February 18th, fixed the problem that iceberg commission orders may be smaller than the minimum order quantity
  • On February 2nd, upgraded status information and order placement method
  • On January 26th, modified the minimum order quantity
  • On January 25th, status information was modified
  • On January 5th, modified the problem that there may be more small amounts left in the spot closing position
  • On January 4th, the bug of closing positions was modified
  • On December 30th, updated the accuracy issue to avoid too much difference between futures and spot accuracy. Updated the revenue calculation and fixed the error of revenue calculation in the status bar caused by non-simultaneous access

Perpetual contracts and funding rates

At the earliest time, there was only delivery contract in the digital currency market contract. Later, BitMEX introduced the perpetual contract innovatively, which is very popular. At present, alomost all the mainstream exchanges support the perpetual contract. The further the delivery date of the delivery contract is, the greater the price fluctuation is, the greater the deviation between the contract price and the spot price will be. But on the delivery date, the settlement will be forced according to the spot price, so the price will always return. Unlike the regular delivery of the delivery contract, the perpetual contract can be held all the time. A mechanism is needed to ensure that the contract price is consistent with the spot price, which is the fund rate mechanism. If the price is bullish for a period of time, many people will go long, which will lead to the perpetual price higher than the spot price. At this time, the funding rate is generally positive, that is, the long position side will pay the short position side according to the position. The larger the market deviation is, the higher the rate will be, making the price difference tend to fall. Going long the trading perpetual contract is equivalent to borrowing money and adding leverage, and funding has a cost of use, so most of the time it is a positive rate of 0.01%. The funding rate is charged every 8 hours, so the perpetual price is often very close to the spot price.

Analysis of arbitrage returns

The funding rate is positive most of the time. If we go short the perpetual contract, go long the spot, and hold it for a long time, we can theoretically obtain a positive funding rate income for a long time without the rise and fall of the currency price. Now we will analyze the feasibility in details.

The funding rate history is provided by Binance: https://www.binance.com/cn/futures/funding-history/1 Here are some examples:

The funding rate of BTC has not been lower than 0.01%, and among several times of increase, the highest rate is more than 0.07%. The minimum rate of LTC is 0.01%, and the maximum rate of LTC is more than 0.1%. XRP has been as low as -0.21% due to the recent going short, but it is positive most of the time. For some popular new currencies, such as 1INCH, the fundinng rate will be as low as -0.64%.

img img img img

Of course, the specific situation still needs to be counted. The average rate of the latest 100 periods is obtained by crawling. The results are as follows:

SXP : 0.044, BZRX : 0.036, DEFI : 0.03, BNB : 0.03, SRM : 0.028, ETH : 0.027, BCH : 0.027, YFII : 0.027, TRB : 0.027, FTM : 0.027, OCEAN : 0.026, ENJ : 0.025, KSM : 0.025, RLC : 0.025, AAVE : 0.025, ADA : 0.025, LINK : 0.023, LTC : 0.023, XLM : 0.023, EOS : 0.022, BAND : 0.022, YFI : 0.022, STORJ : 0.022, LRC : 0.022, FLM : 0.021, UNI : 0.021, REN : 0.021, IOTA : 0.021, QTUM : 0.02, VET : 0.02, KNC : 0.019, BTC : 0.019, MATIC : 0.019, BLZ : 0.019, MKR : 0.018, BEL : 0.018, TRX : 0.017, ZRX : 0.017, ONT : 0.017, TOMO : 0.016, ATOM : 0.016, NEO : 0.016, NEAR : 0.015, KAVA : 0.015, BAT : 0.015, ICX : 0.015, DOT : 0.015, XTZ : 0.015, ZEC : 0.014, IOST : 0.014, DOGE : 0.014, ALGO : 0.014, CVC : 0.014, ETC : 0.013, HNT : 0.013, DASH : 0.012, RUNE : 0.01, XMR : 0.009, AVAX : 0.007, SUSHI : 0.005, SNX : 0.004, COMP : 0.003, OMG : 0.002, CRV : 0.002, XRP : -0.001, WAVES : -0.003, FIL : -0.003, EGLD : -0.016, ZIL : -0.028, BAL : -0.028, THETA : -0.045, SOL : -0.052, RSR : -0.058, CTK : -0.06

It can be seen that only 10 of the 74 currencies have negative average rates, and the total average rate is 0.01235%. The currency with a negative average rate will always be negative, which can be avoided in advance. Actually, we can choose a currency with a long-term average rate of more than 0.02%, so that the daily yield will be 0.02% * 3=0.06%, and the annualized rate will be 20%. If the spot is hedged and the futures are twice as leveraged, plus the loss of opening positions, premium, closing positions and other adverse factors, the annualized rate should be 10-15%. The withdrawl is almost negligible.

Risk analysis and avoidance

Negative rate The lowest rate can be -0.75%. If it happens once, the loss is equivalent to the profit of 75 times of 0.01%. Although the currency of the average rate has been screened, it is inevitable that there will be an unexpected market. In addition to avoiding new currency and demon currency, the most important solution is to decentralize hedging. If you hedge more than 30 currencies at a time, the loss of one currency will only account for a small part. In addition, in this case, it is necessary to close the position in advance, but due to the handling charges and closing position costs, it is not recommended to close the position at a negative rate. Generally, it can be avoided by closing the position at a rate below - 0.2%. Generally, when the rate is negative, the perpetual price is lower than the spot price, and the negative premium makes it possible to make profits after deducting the handling fees.

Changes in premium Generally, a positive rate represents a premium for perpetuity on spot. If the premium is high, it may earn a certain premium return. Of course, the strategy has been holding positions for a long time, so the profit will not disappear. Attention should be paid not to open a position against a high negative premium. Of course, in the long run, the problem of premium changes can be ignored.

Contract blow-up risk Because of decentralized hedging, this part of the risk is much smaller. Take the perpetual 2 times leverage as an example. Unless the overall price increases by 50%, there will be the possibility of blow-up. And because of the spot hedging, there will be no loss at this time. As long as the position is closed for fund transfer, or the margin can be increased at any time. The higher the perpetual leverage is, the higher the capital utilization rate will be, and the greater the risk of contract blow-up will be.

Long term bear market Most of the bull market rates are positive, and the average rate in many currencies can exceed 0.02%, occasionally, there is a very high rate. If the market turns into a long-term bear market, the average rate will decrease, and the probability of large negative rates will increase, which will reduce the returns.

Specific ideas for strategies

  1. The currency can be screened automatically or specified manually. We can refer to the historical funding rate. Transactions can only be conducted when the threshold value is exceeded.
  2. Obtain the current rate, exceed the threshold set, and we begin to place an order for futures and spot hedging at the same time to fix a certain value.
  3. If the price of a single currency has risen too much, the strategy can close the position automatically to avoid excessive perpetual risk.
  4. If the rate of a currency is too low, it is necessary to close the position to avoid the charged rate.
  1. Since there is no requirement on the opening position speed, iceberg commission is used for opening and closing positions to reduce the impact.


The overall risk of the rate arbitrage strategy is low, the capital capacity is large, which is relatively stable, and the profit is not ver much. It is suitable for those who seek low risk arbitrage. You can consider running the strategy if you have spare funds in the exchange.



my 那个100万的实盘呢

小白菜汤 这个能不能程序化检测到开仓点,就帮我开仓的,然后平仓也是智能化,这样就几乎是程序操作了。 之前有用一个策略,可以自动检测到市场的套利机会,设置开平仓条件让程序自动运行就行,很方便的

a888888088 购买了策略现在怎么开始

Suraj Hindi bhasa

liuyuxuan 怎么实盘出错呢

zzsist 可以再优化一下哈,实盘看远没我的收益高,哈哈

cgy505x 收益率咋么样

50950471@qq.com 实盘出错,是什么情况?

fendoudexiaohai 无法添加微信好友,想要咨询下

宁公子 怎么自动卖掉BNB呢,没有BNB手续费不就高了吗

MightyTeam 赞一个

老有所依 没有货币的吗?

谭雅少尉 能否用于其他交易所

搞事情 牛逼

liuyi111 全程机器人操作吗?

zoukai 6666

tnmmhm 学习

韬奋量化 牛逼

🏆Benson点我头像了解免费量化跟单教程 牛逼

Z 牛逼

扁豆子 牛逼

奥克量化 牛逼

khushboo hii

张超 fmz_zhangchao

张超 目前只支持币安,后期会加上OKEX