TradingView
davewhiiite
Mar 27, 2021 5:45 PM

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

Bitcoin Perpetual FuturesFTX

Description

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!

Release Notes

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.

Release Notes

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*)

Release Notes

Added a tickbox to select between displaying a 1hr funding plot and/or an 8hr plot.

Release Notes

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.
Comments
TCCSAcademy
i really want to use it but i dont know how to put it in my chart
davewhiiite
@TCCSAcademy, can you add add it doing the following: 1) favorite it, then 2) favorite indicators menu --> Funding Rate for FTX:BTCPERP (estimated) v0.1? I think it's set to open on its own new pane, but if not, hover over the text for the indicator in the chart, click (...) --> move to --> new pane below
Nomoscrypto
seems very useful, thanks! I'll definetely try it out!
RapidRiseTrader
Can you update the script to dynamically change to a selected ticker ID? For example, if I want to view XRP, the script should automatically change from BTC to XRP. Currently, this need to be done manually for every coin.
davewhiiite
Whoa, sorry I didn't see all of the questions in here. Actually quite surprised at the success of this indicator. Please let me know if there are other features or things that you'd like to see, and I'll try to check back here more often. Thanks!
AlphaOmega66
Nice script and well done on the visual! Does this show the current funding rate or the predicted funding? Im interested in the predicted funding rate as this gives imo a better indication of where the majority of traders are positioned. Heavily positive funding is for a signal that shorts are more favorable compared to longs and vice versa.
davewhiiite
@AlphaOmega66, it's calculated based on the difference between the spot and futures price, so it is historical, def *not* predicted. And it's based off of FTX's stated formula, no guarantee it is exact, or that it is what your exchange does if you change the perp and spot pairs that are selected. Hope that helps!
Apinky
What’s the symbol I need to put in for this to be added to my watch list
davewhiiite
@Apinky, it's not a symbol, it's an indicator. I think you just "favorite" the indicator, then you can add it to your chart. That said, it has the tickers hard-coded into the indicator, so it doesn't matter what the main chart is, but obviously use it to complement a BTC-PERP or BTC/XXX chart
More