GithubHelp home page GithubHelp logo

rp-use-cases-algo-trading's Introduction

Redpanda University

Redpanda University is a series of courses that will teach you the basics of event streaming, and will help you gain hands-on experience with a new data streaming platform called Redpanda.

Disclosure

This course and the corresponding code were created for illustrative purposes only, and neither Redpanda nor the contributors to this course are recommending any specific trading strategies, stocks, or cryptocurrencies. Our intent is to help you explore this exciting field by creating a fun and foundational project to help you learn. It's up to you to test your strategies fully before deploying them to a live trading environment.

RP Use Cases: Algorithmic Trading

This repository contains code examples for the Algorithmic Trading course from Redpanda University. The following chapters are included:

Getting Started

There are three steps you need to get started. It should take < 5 minutes.

  1. Setup a Python environment
  2. Start the Docker services
  3. Get an Alpaca API key

See the follow sections for detailed instructions.

Setup a Python Environment

A Python environment is needed to run the producer scripts to get the financial and market news data into Redpanda, and for running a separate consumer to process trade signals.

Create a Python virtual environment and install all dependencies.

# create a virtual environment
python3 -m venv .

# activate the environment
source bin/activate

# install dependencies
pip install -r requirements.txt

Start the Docker Services

We need a Redpanda cluster to store the data, and a Flink cluster to create trade signals using Flink SQL. To start the Redpanda and Flink clusters, run the following commands:

docker-compose build
docker-compose up -d

Redpanda

Once the clusters are running, Redpanda console will be available at: http://localhost:8080.

To interact with Redpanda from the commandline, set the following alias so that any invocation of rpk uses the pre-installed version in your local Redpanda cluster:

alias rpk="docker exec -ti redpanda-1 rpk"

From here, you can use rpk to interact with the Redpanda cluster:

rpk cluster info

Flink

The Flink web interface will be available at: http://localhost:8081.

To start a Flink SQL client, run the following command:

docker-compose run sql-client

You can verify that everything is running properly in the Flink cluster by running the following SQL statements from the prompt:

SET 'pipeline.name' = 'Hello, Flink';

SELECT
  CONCAT('Hello, ', name) as greeting
FROM
  (VALUES ('Flink'), ('Redpanda'), ('Alpaca')) AS NameTable(name)
GROUP BY name;

Each chapter will contain a set of queries for you to execute. Please see in the individual chapters for more information.

Get an Alpaca API Key

We're using Alpaca as the source for market data.

  1. Sign up for an Alpaca account here.

  2. Create an API key from the Alpaca Paper Trading dashboard.

  3. Replace the following lines in the .env file with your API key and secret

    ALPACA_API_KEY="<YOUR_ALPACA_KEY_ID>"
    ALPACA_SECRET_KEY="<YOUR_ALPACA_SECRET_KEY>"

rp-use-cases-algo-trading's People

Contributors

mitch-seymour avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.