About Binance Crypto Future Margin Rate Data

The Binance Crypto Future Margin Rate Data by QuantConnect is for crypto-currency futures margin interest data points. The data covers 348 Cryptocurrency pairs, starts in August 2020, and is delivered on a daily update frequency. This dataset is created by downloading data using Binance API.

This dataset is an important companion to the Binance Crypto Future Price Data dataset because it contains information on margin interest data to model margin costs.


About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Add Binance Crypto Future Margin Rate Data

Add Dataset Create Free QuantConnect Account

About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

from AlgorithmImports import *

class BinanceCryptoFutureDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2022, 10, 1)
        self.set_end_date(2022, 10, 10)
        self.set_cash("BUSD", 100000)

        self.set_brokerage_model(BrokerageName.BINANCE_FUTURES, AccountType.MARGIN)

        crypto_future = self.add_crypto_future("BTCBUSD", Resolution.DAILY)
        # perpetual futures does not have a filter function
        self.btcbusd = crypto_future.symbol

        # Historical data
        history = self.history(self.btcbusd, 10, Resolution.DAILY)
        self.debug(f"We got {len(history)} from our history request for {self.btcbusd}")

    def on_data(self, slice: Slice) -> None:

        if self.btcbusd in slice.margin_interest_rates:
            interest_rate = slice.margin_interest_rates[self.btcbusd].interest_rate
            self.log(f"{self.btcbusd} close at {slice.time}: {interest_rate}")        

        if not slice.bars.contains_key(self.btcbusd) or not slice.quote_bars.contains_key(self.btcbusd):
            return

        quote = slice.quote_bars[self.btcbusd]
        price = slice.bars[self.btcbusd].price
        
        if price - quote.bid.close > quote.ask.close - price:
            self.set_holdings(self.btcbusd, -1)
        else:
            self.set_holdings(self.btcbusd, 1)

Example Applications

The Binance Crypto Future Margin Rate dataset enables correct margin cost so you can accurately design strategies for Cryptocurrencies with term structure. Examples include the following strategies: