About Binance Crypto Price Data
The Binance Crypto Price Data by CoinAPI is for Cryptocurrency price and volume data points. The data covers 2,684 Cryptocurrency pairs, starts in July 2017, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Binance.
About CoinAPI
CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.
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 *
from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *
class CoinAPIDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2020, 6, 1)
self.set_end_date(2021, 6, 1)
# Set Account Currency to BUSD, since USD-BUSD will not auto-convert and USD cannot be used to trade
self.set_cash("BUSD", 100000)
self.universe_settings.asynchronous = True
# Binance accepts both Cash and Margin account types, select the one you need for the best reality modeling.
self.set_brokerage_model(BrokerageName.BINANCE, AccountType.MARGIN)
# Warm up the security with the last known price to avoid conversion error
self.set_security_initializer(lambda security: security.set_market_price(self.get_last_known_price(security)))
# Requesting data, we only trade on BTCBUSD in Binance exchange
crypto = self.add_crypto("BTCBUSD", Resolution.MINUTE, Market.BINANCE)
self.btcbusd = crypto.symbol
self.minimum_order_size = crypto.symbol_properties.minimum_order_size
# Historical data
history = self.history(self.btcbusd, 30, Resolution.DAILY)
self.debug(f"We got {len(history)} items from our history request")
# Add Crypto Universe Selection that select crypto pairs in Binance exchange
self._universe = self.add_universe(CryptoUniverse.binance(self.universe_selection_filter))
# Historical Universe data
universe_history = self.history(self._universe, 30, Resolution.DAILY)
self.debug(f"We got {len(universe_history)} items from our universe history request")
for (univere_symbol, time), universe_day in universe_history.items():
for universe_item in universe_day:
self.debug(f"{universe_item.symbol} price at {universe_item.end_time}: {universe_item.close}")
def universe_selection_filter(self, universe_day):
# Filter for materially traded crypto pairs with significant size and dollar volume, assuming higher capital flow in for higher return
return [universe_item.symbol for universe_item in universe_day
if universe_item.volume >= 100
and universe_item.volume_in_usd > 10000]
def on_data(self, slice: Slice) -> None:
# Speculate-invest all available free cash on BTCBUSD, obeying the order quantity restriction to avoid invalid order
if self.portfolio.cash_book['BTC'].amount == 0:
free_cash = self.portfolio.cash_book['BUSD'].amount * (1-self.settings.free_portfolio_value_percentage)
quantity = free_cash / slice[self.btcbusd].price
quantity -= quantity % self.minimum_order_size
if quantity > 0:
self.market_order(self.btcbusd, quantity)
Example Applications
The Binance Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:
- Buy and hold
- Trading Cryptocurrency volatility and price action
- Allocating a small portion of your portfolio to Cryptocurrencies to hedge against inflation
Pricing
Cloud Access
Free access to Binance Crypto price data from CoinApi via the QuantConnect Cloud platform for your backtesting and research.
Tick Download
Crypto-currencies Tick resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day/brokerage
Second Download
Crypto-currencies Second resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day/brokerage.
Minute Download
Crypto-currencies Minute resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day/brokerage.
Hour Download
Crypto-currencies Hour resolution archives in LEAN format for on premise backtesting and research. One file per ticker/brokerage.
Daily Download
Crypto-currencies Daily resolution archives in LEAN format for on premise backtesting and research. One file per ticker/brokerage.
Explore Other Datasets
US Treasury Yield Curve
Dataset by Treasury Department
Corporate Lobbying
Dataset by Quiver Quantitative
US ETF Constituents
Dataset by QuantConnect