Coder Social home page Coder Social logo

johnulist / reactive-stock-trader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redelastic/reactive-stock-trader

0.0 1.0 0.0 893 KB

A Stock Trader system to demonstrate reactive systems development

License: Apache License 2.0

Java 76.96% Scala 2.18% JavaScript 2.71% HTML 0.04% Vue 18.11%

reactive-stock-trader's Introduction

Reactive in Practice: An Introduction

Reactive in practice: A complete guide to event-driven systems development in Java is a 12 part series that takes learners through the entire spectrum of a real-world event-sourced project from inception to deployment. This reference architecture is to support the series, originally published on IBM Developer:

Complete examples of this material are very sparse in the industry because they are so time intensive to create. However, with the support of IBM and the IBM Developer portal, we've brought this material to life. We hope it inspires the community and showcases best practices of these technologies. Special thanks to Lightbend for peer review assistance.

The main technologies showcased:

  • Java
  • Lagom
  • Play
  • Kafka
  • Cassandra

Published units of learning materials

As of this date, 8 of 12 units of this series have been finished and are reflected in the code:

The remaining 4 units of this series are still under construction, so the topics reflected may not be in this repo yet:

  • Unit 9: Microservice integration patterns
  • Unit 10: Streaming data
  • Unit 11: Deploying and monitoring reactive systems in the cloud
  • Unit 12: Recap and conclusion

Contributions

If you would like to contribute, fork this repo and issue a PR. All contributions are welcome!

Installation

The following will help you get set up in the following contexts:

  • Local development
  • Deployment to local Kubernetes (using Minikube)
  • Interactions (UI, command line)

Local development

  • Install Java 8 SDK
  • Install sbt (brew install sbt on Mac)

Running Lagom in development mode is simple. Start by launching the backend services using sbt.

  • sbt runAll

The BFF exposes an API to the frontend on port 9100.

Deploying to Kubernetes

For instructions on how to deploy Reactive Stock Trader to Kubernetes, you can find the deployment instructions and Helm Charts for Kafka and Cassandra here: https://github.com/RedElastic/reactive-stock-trader/tree/master/deploy

Interacting with the UI

The UI is developed in Vue.js. You'll need to have Node.js and npm installed and then follow the instructions below.

Project setup and launching for development:

npm install
npm run serve

This will launch the UI on localhost:8080 for development. You can then use the UI to interact with the Lagom system.

Testing / debugging:

  • Run your tests: npm run test
  • Lints and fixes files: npm run lint

Reactive Stock Trader uses Rollbar for debugging purposes. In order to make use of Rollbar:

  • copy config.env to .env.local
  • sign up at Rollbar and create an access token
  • change VUE_APP_ROLLBAR_ACCESS_TOKEN to your token in .env.local

Visit Environment Variables and Modes and https://rollbar.com for more details.

For additional Vue configuration information, see Configuration Reference.

Interacting with the command line

If you would like to test the backend without installing the UI, you can use the following command line information to help.

The jq command line tool for JSON is very handy for pretty printing JSON responses, on Mac this can be installed with brew install jq.

Create a new portfolio named "piggy bank savings": PID=$(curl -X POST http:/localhost:9000/api/portfolio -F name="piggy bank savings" | jq -r .portfolioId); echo $PID

Place an order: curl -X POST http://localhost:9000/api/portfolio/$PID/order -F symbol=RHT -F shares=10 -F order=buy

View the portfolio curl http://localhost:9000/api/portfolio/$PID | jq .

Transfer funds into the portfolio curl -X POST http://localhost:9000/api/transfer -F amount=20000 -F sourceType=savings -F sourceId=123 -F destinationType=portfolio -F destinationId=$PID

PID=$(curl -X POST http:/localhost:9000/api/portfolio -F name="piggy bank savings" | jq -r .portfolioId); echo $PID

curl -X POST http://localhost:9000/api/transfer -F amount=20000 -F sourceType=savings -F sourceId=123 -F destinationType=portfolio -F destinationId=$PID

curl http://localhost:9000/api/portfolio/$PID | jq .

curl -X POST http://localhost:9000/api/portfolio/$PID/order -F symbol=IBM -F shares=10 -F order=buy

curl http://localhost:9000/api/portfolio/$PID | jq .

reactive-stock-trader's People

Contributors

dana-harrington avatar rjammart avatar rocketpages avatar sfdomina 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.