Skip to content
Alex Lopatin edited this page May 10, 2018 · 13 revisions

Getting started

The server processes market data as it's being ingested and provides all kinds of interesting data and aggregations via a GraphQL endpoint.

Visit http://localhost:9020/graphiql in a browser to interactively explore and query the Flashbot GraphQL API.

Connect via the client

Here we'll use the Flashbot Java client library to start exporing our data. If you're using Python, you can skip to the Python and Jupyter section.

  1. Start a Flashbot server, if not already running.

    $ java -jar flashbot.jar server --exchanges=gdax --dataDir=/my/data/dir
  2. Install the client library

    Follow the Java Library instructions to get the Java client.

  3. Query the Flashbot server for some market data, in this case, we request an aggregated order book and look up the price of the best ask.

    import io.flashbook.flashbot.client.Client;
    
    Client client = new Client(9020);
    Double bestAsk = client.orderBook('gdax', 50).asks.get(0).price;

Run and analyze a built-in strategy

Flashbot comes with a few sample strategies in io.flashbook.flashbot.strategies. Let's run a Moving Average Crossover Strategy, a.k.a. the "Hello World" of algorithmic trading on some historical data.

import io.flashbook.flashbot.server.Server;
import io.flashbook.flashbot.client.Client;

Client fb = new Client(9020);
fb.newBot("io.flashbook.flashbot.strategies.MovingAverageCrossover");

Optimize parameters of built-in strategy

Custom indicators & ordering logic

External data sources

Our sample bot is currently looking at only historical order book data to make decisions. i.e. what everyone else is looking at. But what if we want to trade based on, say, streaming Twitter data? Flashbot allows you to setup custom data sources to do exactly this.

  1. Extend the DataIngestService

Clone this wiki locally