davewhiiite

Funding Rate for FTX:BTCPERP (estimated) v0.1

Original credits goes to @Hayemaker, and @NeoButane for the TWAP portions of this script

By @davewhiiite, 2021-03-27
Version 0.1

Summary: The funding rate is the interest charged / credited to a perpetual futures trader for taking a long or short position. The direction of the funding rate is used as an indicator of trader sentiment (+ve = bullish ; -ve = bearish ), and therefore useful to plot in real time.

The FTX exchange has published the calculation of their funding rate as follows:
TWAP((future - index) / index) / 24

The formula here is the same, but expresses it in the more common % per 8hr duration:
funding = TWAP((future / index) - 1) * (8 / 24) * 100

For reference: future refers to the FTX bitcoin futures contract price (FTX:BTCPERP) and index is the spot price of bitcoin on the exchange (FTX:BTCUSD)

Additional notes:
  • Probably best to add to the indicator to a new pane, or as secondary axis
  • Plot this in combination with FTX:BTCPERP or FTX:BTCUSD, or chart of your choice to complement your bitcoin dashboard
  • Compare to funding rates published on ViewBase
  • questions? Ask me!
Phát hành các Ghi chú: This is my official set of updates to the funding script. I hope it proves much more visually appealing, and useful. Updates:
- Used step plot to show that funding changes each hour
- Added a zero line for reference. You can actually add alert now for when zero-crossing occurs (use at own risk!)
- Default values updated for better accuracy; funding should now be viewed on hourly timeframe, with 1m/1hr resolution setting.
Phát hành các Ghi chú: 2021-04-19 UPDATE: Now you can change ticker symbols to use with other exchanges. CAUTION(!): I HAVE NOT TESTED ANY OF THESE PAIRS FOR CORRECTNESS. Please also note that this will calculate funding using FTX's formula--so it's not guaranteed to be a "true" or even good measurement of the actual funding rate at your respective exchange. Please compare, and use your own discretion--this is just a jumping off point for your own creativity and analysis!

Add'l exchange pairs (exchange / perp symbol / spot symbol):
FTX / FTX:BTCPERP / FTX:BTCUSD
BINANCE / BINANCE:BTCUSDTPERP / BINANCE:BTCUSDT
OKEX / OKEX:BTCUSDTPERP / OKEX:BTCUSDT
HUOBI / HUOBI:BTCPERP / HUOBI:BTCUSDT (! This pair seems visibly *incorrect*)
Phát hành các Ghi chú: Added a tickbox to select between displaying a 1hr funding plot and/or an 8hr plot.
Phát hành các Ghi chú: Small fix to ensure that precision is set to 4 by default. Before, it had low precision and the values/axes just looked like zeros.
Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Bình luận

Dude, this is good stoff.
But can we get funding rates chart for BINANCE/BITMEX/FTX/HUODY in ONE (!) multi-indicator ??? This would be awesome. or is there any already existing??
Regards
Phản hồi
davewhiiite Efremov4D
@Efremov4D, hey this is a very good idea. I bet I could create a drop-down that would allow you to toggle between the different exchanges. Definitely for FTX, Binance, Mex. I don't know about other ones, but ultimately all that is needed is the Trading View tickers for 1. the perp contract (ex: FTX:BTCPERP) and 2. the spot price (ex: FTX:BTCUSD). If you have any of these pair names, paste them here and I'll look to add them to an updated version of the indicator. Cheers
Phản hồi
davewhiiite Efremov4D
@Efremov4D, added the possibility to try other exchange pairs. No promises of accuracy, but maybe you can tune it to get what you want. Cheers!
Phản hồi
Haha apparently I didn't publish this according to the exacting rules of the community--I swear I tried. Doesn't look like you can edit something after publishing?

Upgrades:

- The plot look a little cleaner using linewidth = 1 and a step line. Substitute the following:
plot(funding, "FUNDING", orange, linewidth=1, transp=0, style=stepline)

- Also, since funding is probably calculated each hour, you might want to keep the dropdown option "Resolution for Funding Interval" set to 1h. For a more continuous or dynamic calculation of what the funding should be, select "same as chart" from the dropdown, and use a shorter timeframe.
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Giới thiệu Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Tin nhắn riêng Trò chuyện Đăng xuất