- Timestamp:
- 09/17/26 00:36:39 (2 weeks ago)
- Branches:
- main
- Children:
- 4438e45
- Parents:
- 35bcb41
- Location:
- server
- Files:
-
- 2 edited
-
db/schema_creation.sql (modified) (3 diffs)
-
reports.go (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
server/db/schema_creation.sql
r35bcb41 r9e6d8a2 261 261 avg_price numeric, 262 262 market_return_pct numeric, 263 price_volatility numeric,264 263 participating_users bigint 265 264 ) … … 281 280 COUNT(*) AS trade_count, 282 281 AVG(price) AS avg_price, 283 STDDEV(price) AS price_volatility,284 282 MAX(first_price) AS first_price, 285 283 MAX(last_price) AS last_price … … 300 298 ROUND(ms.avg_price, 6) AS avg_price, 301 299 ROUND((ms.last_price - ms.first_price) / NULLIF(ms.first_price, 0) * 100, 2) AS market_return_pct, 302 ROUND(COALESCE(ms.price_volatility, 0), 6) AS price_volatility,303 300 COALESCE(p.participating_users, 0) AS participating_users 304 301 FROM market_stats ms -
server/reports.go
r35bcb41 r9e6d8a2 81 81 defer rows.Close() 82 82 83 header := fmt.Sprintf(" %-6s %-5s %12s %8s %14s %12s % 14s %8s",84 "Symbol", "Quote", "Volume", "Trades", "Avg Price", "Return %", " Volatility", "Users")83 header := fmt.Sprintf(" %-6s %-5s %12s %8s %14s %12s %8s", 84 "Symbol", "Quote", "Volume", "Trades", "Avg Price", "Return %", "Users") 85 85 fmt.Println() 86 86 fmt.Println(header) … … 90 90 for rows.Next() { 91 91 var symbol, quote string 92 var volume, avgPrice, returnPct , volatilityfloat6492 var volume, avgPrice, returnPct float64 93 93 var tradeCount, users int64 94 if err := rows.Scan(&symbol, "e, &volume, &tradeCount, &avgPrice, &returnPct, & volatility, &users); err != nil {94 if err := rows.Scan(&symbol, "e, &volume, &tradeCount, &avgPrice, &returnPct, &users); err != nil { 95 95 fmt.Println("scan error:", err) 96 96 return 97 97 } 98 fmt.Printf(" %-6s %-5s %12.4f %8d %14.6f %+12.2f % 14.6f %8d\n",99 symbol, quote, volume, tradeCount, avgPrice, returnPct, volatility,users)98 fmt.Printf(" %-6s %-5s %12.4f %8d %14.6f %+12.2f %8d\n", 99 symbol, quote, volume, tradeCount, avgPrice, returnPct, users) 100 100 empty = false 101 101 }
Note:
See TracChangeset
for help on using the changeset viewer.
