Skip to content

EasyTrade - demo microservices application that allows its users to buy and sell stocks

License

Notifications You must be signed in to change notification settings

mmondics/easytrade

 
 

Repository files navigation

EasyTrade

Sample stock trading application modified to run on both Intel/x86 (amd64) architecture as well as IBM LinuxONE (s390x).

Fraud Detection

This version of easytrade has been modified to enable fraud detection with the IBM LinuxONE on-chip AI Accelerator. If enabled, each buy and sell request made through the easytrade frontend GUI or an API call will receive a fraud score between 0 and 1 from an Nvidia Triton Inference Server.

See the fraud-detection README for instructions and more information.

Buy example:

[16/04/25 03:44:48 | Information] Sending payload to Triton at http://svc-triton-accelerated-easytrade.local/v2/models/fraud_ensemble/infer: {"inputs":[{"name":"raw_input","shape":[1,9],"datatype":"FP32","data":[6,1,1,1,159.33264,159.33264,3,3,1]}]} | FraudDetectionClient
[16/04/25 03:44:48 | Information] 🧠 Fraud score for BuyAssets: 0.7734375 | Entities.Trades.Service.TradeService

Architecture diagram

EasyTrade architecture

Service list

EasyTrade consists of the following services/components:

Service Proxy port Proxy endpoint
Account service 80 /accountservice
Aggregator service 80 ---
Broker service 80 /broker-service
Calculation service 80 ---
Content creator 80 ---
Credit card order service 80 /credit-card-order-service
Db 80 ---
Engine 80 /engine
Feature flag service 80 /feature-flag-service
Frontend 80 /
Frontend reverse-proxy 80 ---
Loadgen -- ---
Login service 80 /loginservice
Manager 80 /manager
Offer service 80 /offerservice
Pricing service 80 /pricing-service
Problem operator 80 ---
RabbitMQ 80 ---
Third party service 80 /third-party-service

To learn more about endpoints / swagger for the services go to their respective readmes

Mixed-architecture Cluster

This version of easyTrade can run on a mixed-architecture OpenShift cluster, i.e. one that has both amd64 and s390x compute nodes.

~ oc get no -l node-role.kubernetes.io/worker -L kubernetes.io/arch
NAME                     STATUS   ROLES    AGE   VERSION            ARCH
stg1.ma1.cpolab.local    Ready    worker   82d   v1.29.10+67d3387   amd64
stg2.ma1.cpolab.local    Ready    worker   82d   v1.29.10+67d3387   amd64
stg3.ma1.cpolab.local    Ready    worker   82d   v1.29.10+67d3387   amd64
work1.ma1.cpolab.local   Ready    worker   82d   v1.29.10+67d3387   amd64
work2.ma1.cpolab.local   Ready    worker   82d   v1.29.10+67d3387   amd64
work3.ma1.cpolab.local   Ready    worker   82d   v1.29.10+67d3387   amd64
work4.ma1.cpolab.local   Ready    worker   82d   v1.29.10+67d3387   amd64
work5.ma1.cpolab.local   Ready    worker   57d   v1.29.10+67d3387   s390x
work6.ma1.cpolab.local   Ready    worker   57d   v1.29.10+67d3387   s390x
work7.ma1.cpolab.local   Ready    worker   57d   v1.29.10+67d3387   s390x
work8.ma1.cpolab.local   Ready    worker   57d   v1.29.10+67d3387   s390x

Follow the instructions below and in the README, making sure to specify the release-mixed-arch release.

OpenShift Instructions

To deploy on OpenShift:

# Create the `easytrade` project
oc new-project easytrade

# Give the default user elevated credentials (don't do this in production 😊)
oc -n easytrade adm policy add-scc-to-user anyuid -z default

# then use the manifests to deploy
# use 'release-multiarch' to deploy to either s390x or amd64
# use 'release-mixed-arch' to deploy to a cluster that includes both s390x and amd64
oc -n easytrade apply -f ./kubernetes-manifests/release-multiarch

# Optional: if you want the problem patterns to be automatically
# enabled once a day, deploy these manifests too
# kubectl -n easytrade apply -f ./kubernetes-manifests/problem-patterns

# Expose the easytrade frontend service as a route 
oc -n easytrade expose svc frontendreverseproxy-easytrade

Kubernetes Instructions

To deploy on Kubernetes:

# first create the namespace for it
kubectl create namespace easytrade

# then use the manifests to deploy
kubectl -n easytrade apply -f ./kubernetes-manifests/release-multiarch

# Optional: if you want the problem patterns to be automatically
# enabled once a day, deploy these manifests too
# kubectl -n easytrade apply -f ./kubernetes-manifests/problem-patterns

# to get the ip of reverse proxy
# look for EXTERNAL-IP of frontendreverseproxy
# it may take some time before it gets assigned
kubectl -n easytrade get svc

# to delete the deployment
kubectl delete namespace easytrade

Where to start

After starting easyTrade application you can:

  • go to the frontend and try it out. Navigate to the OpenShift route and you should see the login page. You can either create a new user, or use one of superusers (with easy passwords) like "demouser/demopass" or "specialuser/specialpass". Remember that in order to buy stocks you need money, so visit the deposit page first.
  • go to some services swagger endpoint - you will find proper instructions in the dedicated service readmes.

EasyTrade users

If you want to use easyTrade, then you will need a user. You can either:

  • use an existing user - they have some preinserted data and new data is automatically generated:

    • login: james_norton
    • pass: pass_james_123
  • create a new user - click on "Sign up" on the login page and create a new user.

NOTE: After creating a new user there is no confirmation given, no email sent and you are not redirected... Just go back to login page and try to login.

About

EasyTrade - demo microservices application that allows its users to buy and sell stocks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TSQL 78.9%
  • TypeScript 8.8%
  • C# 4.8%
  • Java 4.0%
  • Go 1.6%
  • Python 1.3%
  • Other 0.6%