-
Notifications
You must be signed in to change notification settings - Fork 2
Home
- 1. Server setup
- 2. Backtest a sample strategy
- 3. Analyze bot performance
- 4. Optimize bot parameters
- 5. Deploy a live bot
- 6. Custom data sources
- 7. Custom ordering logic
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.
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.
-
Start a Flashbot server, if not already running.
$ java -jar flashbot.jar server --exchanges=gdax --dataDir=/my/data/dir
-
Install the client library
Follow the Java Library instructions to get the Java client.
-
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;
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");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.
- Extend the
DataIngestService