About Bybit Crypto Future Margin Rate Data
The Bybit Crypto Future Margin Rate Data by QuantConnect is for Cryptocurrency Futures margin interest data points. The data covers 433 Cryptocurrency pairs, starts in August 2020, and is delivered on a daily update frequency. This dataset is created by downloading data using Bybit API.
This dataset is an important companion to the Bybit 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.
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 BybitCryptoFutureDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2022, 10, 1)
self.set_end_date(2022, 10, 10)
# Set Account Currency to Tether, since USD and USDT will not auto-convert and USD cannot be used to trade
self.set_account_currency("USDT", 100000)
# Bybit accepts both Cash and Margin account types, select the one you need for the best reality modeling.
self.set_brokerage_model(BrokerageName.BYBIT, AccountType.MARGIN)
# Requesting data, we only trade on BTCUSDT Future in Bybit exchange
crypto_future = self.add_crypto_future("BTCUSDT", Resolution.DAILY)
# perpetual futures does not have a filter function
self.btcusdt = crypto_future.symbol
# Historical data
history = self.history(self.btcusdt, 10, Resolution.DAILY)
self.debug(f"We got {len(history)} from our history request for {self.btcusdt}")
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.btcusdt in slice.margin_interest_rates:
interest_rate = slice.margin_interest_rates[self.btcusdt].interest_rate
self.log(f"{self.btcusdt} close at {slice.time}: {interest_rate}")
# Trade only based on updated price data
if not slice.bars.contains_key(self.btcusdt) or not slice.quote_bars.contains_key(self.btcusdt):
return
quote = slice.quote_bars[self.btcusdt]
price = slice.bars[self.btcusdt].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.btcusdt, -1)
else:
self.set_holdings(self.btcusdt, 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:
- Horizontal/Diagonal arbitrage with the underlying Cryptocurrencies
- Trade Contango/Backwardation predictions
- Hedge for illiquid Cryptocurrencies
Pricing
Cloud Access
Free access to Bybit Crypto Future margin rate data from Bybit via the QuantConnect Cloud platform for your backtesting and research.
Download On Premise
Crypto-futures margin rate archives in LEAN format for on-premise backtesting and research. One file per ticker/day
Explore Other Datasets
Kraken Crypto Price Data
Dataset by CoinAPI
US Fundamental Data
Dataset by Morningstar
US Equity Coarse Universe
Dataset by QuantConnect