Skip to content

About

Publish and subscribe with pubsub then log to bigquery and display utilizing websocket and bigquery query

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RealTime And Historical charts

The repository contains code for building realtime and historical charts by leveraging Google Pub/Sub and SocketIO for realtime and Bigquery and Flask for historical.

Steps

  • Create/Setup your GCP environment (we'll need pub/sub and bigquery for this project)
    • create the json secret as seen starting at minute 1:34 in this video https://www.youtube.com/watch?v=xOtrCmPjal8]
      • place the json secret in your backend folder
    • create a pubsub topic and a subscriber to that topic
    • create a bigquery table and subscribe to the created pubsub topic
      • your table needs only one field: data with type string Screenshot 2024-07-09 at 4 08 40 PM
    • create a settings.ini file and place it in your backend folder it should be of the form
      [DEFAULT]
      credentials_path = xxxx-123.json
      topic_path = projects/example-project/topics/pub-sub-topic-name-path
      subscription_path = projects/example-project/topics/pub-sub-subscription-path
  • install the requirements using requirements.txt
  • npm install all requirements in the frontend folder
  • Run the stream_in.py server first (it is listening for dummy price data from stream_out)
  • Then run bigquery_server.py (it is serving bigquery directly to the frontend)
  • Then run the frontend (npm run dev)
  • Then run stream_out.py (it is creating mock prices 1<random_float<100)

Demo

Screen.Recording.2024-07-09.at.4.34.31.PM.mov

The reads in bigquery are quite fast when table is relatively small <10mb speeds of 300ms as seen here

Screenshot 2024-07-09 at 4 12 03 PM

Architecture

Screenshot 2024-07-15 at 12 55 02 PM

About

Publish and subscribe with pubsub then log to bigquery and display utilizing websocket and bigquery query

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages