<jupyter_start><jupyter_text>IntroductionThis notebook shows how to connect to a crypto exchange and receive a trade feed from it. We then start the run using this trade feed.  Besides the support for Binance (see also the other notebook), roboquant includes support for most other crypto exchanges using the XChange library. This notebook demonstrates how to use that library.> XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.<jupyter_code>%use @http://roboquant.org/roboquant-crypto.json
Welcome()<jupyter_output><empty_output><jupyter_text>Add required librariesWhen usign the XChange integration, there are a few additional steps required to use a particular exchange:1. Load the exchange specific libraries, like bitstamp in this example. You can use the **@file:DependsOn** syntax for this. Make sure the version is the same as is included with roboquant.2. Import both the roboquant packages (import org.roboquant.xchange.*) and the packages for the exchange that you want to connect to.Check the [XChange](https://github.com/knowm/XChange) repository for more details on all the available exchanges. In this example we use Bitstamp<jupyter_code>@file:DependsOn("org.knowm.xchange:xchange-bitstamp:5.0.13")
@file:DependsOn("org.knowm.xchange:xchange-stream-bitstamp:5.0.13")

import info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingExchange
import info.bitrich.xchangestream.core.StreamingExchangeFactory<jupyter_output><empty_output><jupyter_text>Setup a RoboquantWe now create, as usual, the strategy we want to test. There is nothing specific to crypto trading that needs to be taken care of.<jupyter_code>val strategy = EMACrossover.EMA_5_15
val roboquant =  Roboquant(strategy, AccountSummary())<jupyter_output><empty_output><jupyter_text>Define FeedNow we create an instance of the Bitstamp exchange and connect to it. Then we are ready to use it as a feed and subscribe to one or more currency pairs using the *subscribeTicker* method.<jupyter_code>val exchange = StreamingExchangeFactory.INSTANCE.createExchange(BitstampStreamingExchange::class.java)
exchange.connect().blockingAwait()

val feed = XChangeLiveFeed(exchange)
feed.availableAssets
feed.subscribeTicker("BTC_USD")<jupyter_output><empty_output><jupyter_text>Run Live TestAll that remains, is to start run to roboquant and evaluate the strategy against the feed. We'll run it for 10 minutes. If the time that is displayed looks wrong, don't forget that roboquant uses a timezone independent representation for all internal time processing and not your local timezone.<jupyter_code>val timeframe = Timeframe.next(60.minutes)
roboquant.run(feed, timeframe)<jupyter_output><empty_output><jupyter_text>DisconnectAnd we disconnect from the exchnage<jupyter_code>exchange.disconnect().blockingAwait()
roboquant.broker.account.fullSummary()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06883814640698456, 'fraction_numerical': 0.006715916722632639, 'mean_word_length': 6.6976744186046515, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '123341', 'license': 'Apache-2.0', 'n_tokens_mistral': 862, 'n_tokens_neox': 828, 'n_words': 309, 'path': 'tutorials/crypto.ipynb', 'repo_name': 'neurallayer/roboquant-notebook', 'size': '2978'}