lbroudoux / cloud-tradegame

A Trading Game to deploy on Google Cloud on multi-clusters / multi-clouds mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$ gcloud iam service-accounts create tradegame-pubsub-sa \
  --description="Service Account for accessing PubSub from quotegame"

$ PROJECT=cloud-tradegame

# Directly put the sa as editor as we need to publish, subscribe and also create subscriptions.    
$ gcloud projects add-iam-policy-binding $PROJECT \
    --member=serviceAccount:tradegame-pubsub-sa@$PROJECT.iam.gserviceaccount.com\
    --role=roles/pubsub.editor
$ curl localhost:8080/api/quote/CYB
140.57                                                                                                                                                                                              

$ curl localhost:8080/api/quote/TYR
187.71

$ curl localhost:8080/api/user -XPOST -H 'Content-type: application/json' \
  -d '{"name":"lbroudoux", "email":"lbroudoux@google.com"}' -s | jq
  
$ curl localhost:8080/api/portfolio -s | jq
[
  {
    "username": "lbroudoux",
    "money": 1000,
    "quotes": {}
  }
]

$ curl localhost:8080/api/order -XPOST -H 'Content-type: application/json' \
  -d '{"username":"lbroudoux","orderType":"BUY","timestamp":1665130686122,"quote":"TYR","price":187.71,"number":1}' -s | jq
$ curl localhost:8083/api/order -XPOST -H 'Content-type: application/json' \
  -d '{"username":"lbroudoux","orderType":"BUY","timestamp":1665130686122,"quote":"TYR","price":187.71,"number":1}' -s | jq

About

A Trading Game to deploy on Google Cloud on multi-clusters / multi-clouds mode

License:MIT License


Languages

Language:Java 54.7%Language:TypeScript 31.1%Language:HTML 10.3%Language:JavaScript 2.3%Language:CSS 1.5%