Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristanwietsma/bc611463e0131f067f7e5633d0120ac0 to your computer and use it in GitHub Desktop.
Save tristanwietsma/bc611463e0131f067f7e5633d0120ac0 to your computer and use it in GitHub Desktop.
quant=> \d+ regsho
Table "public.regsho"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+--------+-----------+----------+--------------+-------------
Symbol | text | | extended | |
Date | text | | extended | |
ShortVolume | bigint | | plain | |
TotalVolume | bigint | | plain | |
Indexes:
"ix_regsho_Date" btree ("Date")
"ix_regsho_Symbol" btree ("Symbol")
quant=> create table short_interest (
quant(> ticker varchar(10),
quant(> date date,
quant(> shortvol bigint,
quant(> totalvol bigint
quant(> );
CREATE TABLE
quant=> insert into short_interest select "Symbol" as ticker, cast("Date" as date) as date, "ShortVolume" as shortvol, "TotalVolume" as totalvol from regsho where "Symbol" is not null;
quant=> create unique index ticker_date_idx on short_interest (ticker, date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment