Balti2016 / trader-dss

Automatically exported from code.google.com/p/trader-dss
0 stars 0 forks source link

volume and related fields should be integers #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I just encountered this loading ASX data

[INFO][inserting 72857]AKR, 2000/03/06, 546.0000, 546.0000, 518.0000,
546.0000, 900, 10701600.0000
DBD::Pg::st execute failed: ERROR:  numeric field overflow
DETAIL:  The absolute value is greater than or equal to 10^7 for field with
precision 9, scale 2. at ./update-quotes.pl line 128.
ERROR:  numeric field overflow
DETAIL:  The absolute value is greater than or equal to 10^7 for field with
precision 9, scale 2. at ./update-quotes.pl line 128.

Volume should be an integer. Derived tables and functions should be the
same. In fact functions that hold table related variables should all use
the %TYPE style declarations so that they track the table column data
types. Like in the declarations in /functions/update_exchange_indicators.sql

Original issue reported on code.google.com by peter.st...@1ab.ltd.uk on 1 Apr 2010 at 10:14

GoogleCodeExporter commented 9 years ago
These functions need to be updated...
/functions/update_exchange_indicators.sql
/functions/update_moving_averages.sql

These tables...
tables/cart.sql
/tables/holdings.sql
/tables/moving_averages.sql
/tables/quotes.sql
/tables/sector_quotes.sql
/tables/trade_dates.sql
/tables/trades.sql
/tables/watch.sql

This works and preserves the existing data

alter table quotes alter column volume type integer;

Original comment by peter.st...@1ab.ltd.uk on 1 Apr 2010 at 10:19

GoogleCodeExporter commented 9 years ago
Bummer,

trader=# alter table quotes alter column volume type integer;
ERROR:  integer out of range

Original comment by peter.st...@1ab.ltd.uk on 1 Apr 2010 at 10:25

GoogleCodeExporter commented 9 years ago
I didn't read the error well enough last night. It was an overflow in adjusted 
close,
not volume. It looks like yahoo data corruption, not a real issue.

Original comment by peter.st...@1ab.ltd.uk on 2 Apr 2010 at 8:42

GoogleCodeExporter commented 9 years ago
would this lead to needing to cast integer to numeric when using volume in 
other calculations?

Original comment by peter.st...@1ab.ltd.uk on 31 Dec 2010 at 11:18