CREATE TABLE "public"."stat" (
"id" int4 NOT NULL DEFAULT nextval('stat_id_seq'::regclass),
"type" varchar(100),
"datetime" timestamptz,
"amount" int8,
"wallet_id" int8,
"date" date DEFAULT now(),
"symbol" varchar(10),
PRIMARY KEY ("id")
);
id |
type |
datetime |
amount |
wallet_id |
date |
symbol |
1 |
deposit |
2023-06-16 14:33:56.962547+00 |
1 |
1 |
2023-06-16 |
trx |
2 |
deposit |
2023-06-16 14:35:56.962547+00 |
1 |
1 |
2023-06-16 |
trx |
3 |
deposit |
2023-06-16 14:36:56.962547+00 |
1 |
1 |
2023-06-16 |
trx |
4 |
deposit |
2023-06-17 14:33:56.962547+00 |
1 |
1 |
2023-06-17 |
trx |
5 |
deposit |
2023-06-18 14:33:56.962547+00 |
1 |
1 |
2023-06-18 |
trx |
6 |
deposit |
2023-06-19 00:00:00.962547+00 |
1 |
1 |
2023-06-19 |
trx |
7 |
deposit |
2023-06-20 14:30:56.962547+00 |
1 |
1 |
2023-06-20 |
trx |
8 |
deposit |
2023-06-20 14:31:56.962547+00 |
1 |
1 |
2023-06-20 |
trx |
13 |
deposit |
2023-06-20 14:33:56.962547+00 |
1 |
1 |
2023-06-20 |
btc |
14 |
deposit |
2023-06-20 14:33:56.962547+00 |
1 |
1 |
2023-06-20 |
btc |
SELECT date AS day, SUM(stat.amount) * 0.99985 AS amount_per_day_in_usd
FROM stat
WHERE date BETWEEN '2023-06-16' AND '2023-06-17'
AND wallet_id = 1
AND symbol = 'trx'
GROUP BY day
ORDER BY day;