Skip to content
Snippets Groups Projects
Commit 45fbc968 authored by Michal Zander's avatar Michal Zander
Browse files

Remove block parameter from aggregated history

parent 59dbf3d0
No related branches found
No related tags found
2 merge requests!168Update return types: VEST balances should be returned as strings to address JSON limitations,!160Add daily and monthly aggregations for balances
Pipeline #116659 failed
......@@ -3,8 +3,7 @@ SET ROLE btracker_owner;
DROP TYPE IF EXISTS balance_history_aggregation CASCADE;
CREATE TYPE balance_history_aggregation AS (
date TIMESTAMP,
balance BIGINT,
block INT
balance BIGINT
);
CREATE OR REPLACE VIEW balance_history_by_year AS
......@@ -63,8 +62,7 @@ BEGIN
RETURN QUERY (
SELECT
fb.date,
fb.balance,
fb.block
fb.balance
FROM get_balance_history_by_day(
_account_id,
_coin_type,
......@@ -77,8 +75,7 @@ BEGIN
RETURN QUERY (
SELECT
fb.date,
fb.balance,
fb.block
fb.balance
FROM get_balance_history_by_month(
_account_id,
_coin_type,
......@@ -91,8 +88,7 @@ BEGIN
RETURN QUERY (
SELECT
fb.date,
fb.balance,
fb.block
fb.balance
FROM get_balance_history_by_year(
_account_id,
_coin_type,
......@@ -182,8 +178,7 @@ RETURN QUERY (
)
SELECT
LEAST(fb.date + INTERVAL '1 day' - INTERVAL '1 second', CURRENT_TIMESTAMP)::TIMESTAMP AS adjusted_date,
fb.balance,
fb.source_op_block
fb.balance
FROM filled_balances fb
ORDER BY
(CASE WHEN _direction = 'desc' THEN fb.date ELSE NULL END) DESC,
......@@ -266,8 +261,7 @@ RETURN QUERY (
)
SELECT
LEAST(fb.date + INTERVAL '1 month' - INTERVAL '1 second', CURRENT_TIMESTAMP)::TIMESTAMP AS adjusted_date,
fb.balance,
fb.source_op_block
fb.balance
FROM filled_balances fb
ORDER BY
(CASE WHEN _direction = 'desc' THEN fb.date ELSE NULL END) DESC,
......@@ -350,8 +344,7 @@ RETURN QUERY (
)
SELECT
LEAST(fb.date + INTERVAL '1 year' - INTERVAL '1 second', CURRENT_TIMESTAMP)::TIMESTAMP AS adjusted_date,
fb.balance,
fb.source_op_block
fb.balance
FROM filled_balances fb
ORDER BY
(CASE WHEN _direction = 'desc' THEN fb.date ELSE NULL END) DESC,
......
......@@ -146,8 +146,7 @@ BEGIN
SELECT to_json(array_agg(row)) FROM (
SELECT
fb.date,
fb.balance::TEXT,
fb.block
fb.balance::TEXT
FROM get_balance_history_aggregation(
_account_id,
_coin_type,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment