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 421 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)
        # Set Account Currency to Binance Stable Coin, since USD-BUSD will not auto-convert and USD cannot be used to trade
        self.set_cash("BUSD", 100000)
        # Binance Futures Exchange accepts both Cash and Margin account types, select the one you need for the best reality modeling.
        self.set_brokerage_model(BrokerageName.BINANCE_FUTURES, AccountType.MARGIN)

        # Requesting data, we only trade on BTCBUSD Future in Binance Future exchange
        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:
        # Note that you may want to access the margin interest of the crypto future to calculate if it would impact a trade's PnL
        # Or you can calculate the trade size on keeping the quote currency constant
        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}")        

        # Trade only based on updated price data
        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

        # Scalp-trade the bid-ask spread based on the supply-demand strength
        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: