Identify high-risk and high-value users by analyzing and identifying trends in user betting patterns.
psql
, is installed in your environment. For detailed instructions, see Download PostgreSQL.user_profiles
table contains static information about each user.
betting_history
table contains historical betting records for each user.
positions
table has real-time updates for ongoing betting positions for each user.
data_generator.py
file. This Python script utilizes the psycopg2
library to establish a connection with RisingWave so you can generate and insert synthetic data into the tables positions
and market_data
.
If you are not running RisingWave locally or using default credentials, update the connection parameters accordingly:
user_betting_patterns
materialized view provides an overview of each user’s betting history, including their win/loss count and average profit.
user_betting_patterns
to see the results.
real_time_user_exposure
materialized view sums up the stake amounts of active positions for each user to track each user’s current total exposure in real-time.
With this materialized view, you can filter for users who may be overexposed.
real_time_user_exposure
to see the results.
high_risk_users
materialized view identifies high-risk users by analyzing their risk tolerance, exposure, and profit patterns.
A user is considered high-risk if they meet all of the following criteria:
high_risk_users
to see the results.
Ctrl+C
to close the connection between RisingWave and psycopg2
.