This script tracks the net Bitfinex margin sizes from candle to candle (longs - shorts), and divide it by the total volume from the previous candle. This should give you a ratio of net margin trading volume over total volume on Bitfinex.
Note that assuming the delay is not severe, this ratio should never exceed 1 or -1 (since margin traded volume should strictly be lower than total traded volume during any time interval). As you can see clearly however, the ratio exceeds 1 and -1 quite frequently. Thanks to CryptoTrendy on Twitter for bringing this issue to attention. Our trading group has noticed this issue ever since they introduced the tickers, and we suspect there are severe inaccuracies in either one, or both of the margin and total volume tickers.
版本注释
Fixed to use previous candle total volume instead of current one.