data

package
v0.0.0-...-72b89ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	AssetKey             = "asset-description"
	CustomKey            = "custom"
	EconomicIndicatorKey = "economic-indicator"
	EODKey               = "eod"
	FundamentalsKey      = "fundamental"
	MarketHolidaysKey    = "market-holidays"
	MetricKey            = "metric"
	RatingKey            = "rating"
)

Variables

View Source
var DataTypes = map[string]*DataType{
	AssetKey: {
		Name: AssetKey,
		Schema: `CREATE TABLE %[1]s (
ticker TEXT,
composite_figi TEXT,
share_class_figi TEXT,
primary_exchange TEXT,
asset_type assettype,
active BOOLEAN,
name TEXT,
description TEXT,
corporate_url TEXT,
sector TEXT,
industry TEXT,
sic_code INT,
cik TEXT,
cusips text[],
isins text[],
other_identifiers JSONB,
similar_tickers TEXT[],
tags TEXT[],
listed timestamp,
delisted timestamp,
last_updated timestamp,
PRIMARY KEY (ticker, composite_figi)
);

CREATE INDEX %[1]s_active ON %[1]s(active);

ALTER TABLE %[1]s
ADD COLUMN search tsvector
	GENERATED ALWAYS AS (
		setweight(to_tsvector('pg_catalog.english', coalesce(ticker,'')), 'A') ||
		setweight(to_tsvector('pg_catalog.english', coalesce(name,'')), 'B') ||
		setweight(to_tsvector('pg_catalog.english', coalesce(composite_figi,'')), 'C')
) STORED;

CREATE INDEX %[1]s_search_idx ON %[1]s USING GIN (search);`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
	CustomKey: {
		Name: CustomKey,
		Schema: `CREATE TABLE %[1]s (
	ticker         CHARACTER VARYING(10) NOT NULL,
	composite_figi CHARACTER(12)         NOT NULL,
	event_date     DATE                  NOT NULL,
	key            TEXT                  NOT NULL,
	value          JSONB                 NOT NULL,
	PRIMARY KEY (key, composite_figi, event_date)
);

CREATE INDEX %[1]s_key_ticker_event_date_idx ON %[1]s(key, ticker, event_date DESC)`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
	EconomicIndicatorKey: {
		Name: EconomicIndicatorKey,
		Schema: `CREATE TABLE %[1]s (
			series     TEXT NOT NULL,
			event_date DATE NOT NULL,
			value      REAL NOT NULL,
			PRIMARY KEY (series, event_date)
		);`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
	EODKey: {
		Name: EODKey,
		Schema: `CREATE TABLE %[1]s (
ticker         CHARACTER VARYING(10) NOT NULL,
composite_figi CHARACTER(12)         NOT NULL,
event_date     DATE                  NOT NULL,
open           NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
high           NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
low            NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
close          NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
adj_close      NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
volume         BIGINT                NOT NULL DEFAULT 0.0,
dividend       NUMERIC(12, 4)        NOT NULL DEFAULT 0.0,
split_factor   NUMERIC(9, 6)         NOT NULL DEFAULT 1.0,
PRIMARY KEY (composite_figi, event_date)
) PARTITION BY RANGE (event_date);

CREATE INDEX %[1]s_event_date_idx ON %[1]s(event_date);
CREATE INDEX %[1]s_ticker_idx ON %[1]s(ticker);

CREATE TRIGGER %[1]s_adj_close_default
BEFORE INSERT ON %[1]s
FOR EACH ROW
WHEN (NEW.adj_close IS NULL AND NEW.close IS NOT NULL)
EXECUTE PROCEDURE adj_close_default();`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: true,
	},
	FundamentalsKey: {
		Name: FundamentalsKey,
		Schema: `CREATE TABLE %[1]s (
	event_date DATE,
	ticker TEXT,
	composite_figi TEXT,
	dimension TEXT,
	date_key DATE,
	report_period DATE,
	last_updated DATE,

	accumulated_other_comprehensive_income BIGINT,
	total_assets BIGINT,
	average_assets BIGINT,
	current_assets BIGINT,
	assets_non_current BIGINT,
	asset_turnover NUMERIC,
	book_value_per_share NUMERIC,
	capital_expenditure BIGINT,
	cash_and_equivalents BIGINT,
	cost_of_revenue BIGINT,
	consolidated_income BIGINT,
	current_ratio NUMERIC,
	debt_to_equity_ratio NUMERIC,
	total_debt BIGINT,
	debt_current BIGINT,
	debt_non_current BIGINT,
	deferred_revenue BIGINT,
	depreciation_amortization_and_accretion BIGINT,
	deposits BIGINT,
	dividend_yield NUMERIC,
	dividends_per_basic_common_share NUMERIC,
	ebit BIGINT,
	ebitda BIGINT,
	ebitda_margin NUMERIC,
	ebt BIGINT,
	eps NUMERIC,
	eps_diluted NUMERIC,
	equity BIGINT,
	equity_avg BIGINT,
	enterprise_value BIGINT,
	ev_to_ebit BIGINT,
	ev_to_ebitda NUMERIC,
	free_cash_flow BIGINT,
	free_cash_flow_per_share NUMERIC,
	fx_usd NUMERIC,
	gross_profit BIGINT,
	gross_margin NUMERIC,
	intangibles BIGINT,
	interest_expense BIGINT,
	invested_capital BIGINT,
	invested_capital_average BIGINT,
	inventory BIGINT,
	investments BIGINT,
	investments_current BIGINT,
	investments_non_current BIGINT,
	total_liabilities BIGINT,
	current_liabilities BIGINT,
	liabilities_non_current BIGINT,
	market_capitalization BIGINT,
	net_cash_flow BIGINT,
	net_cash_flow_business BIGINT,
	net_cash_flow_common BIGINT,
	net_cash_flow_debt BIGINT,
	net_cash_flow_dividend BIGINT,
	net_cash_flow_from_financing BIGINT,
	net_cash_flow_from_investing BIGINT,
	net_cash_flow_invest BIGINT,
	net_cash_flow_from_operations BIGINT,
	net_cash_flow_fx BIGINT,
	net_income BIGINT,
	net_income_common_stock BIGINT,
	net_loss_income_discontinued_operations BIGINT,
	net_income_to_non_controlling_interests BIGINT,
	profit_margin NUMERIC,
	operating_expenses BIGINT,
	operating_income BIGINT,
	payables BIGINT,
	payout_ratio NUMERIC,
	pb NUMERIC,
	pe NUMERIC,
	pe1 NUMERIC,
	property_plant_and_equipment_net BIGINT,
	preferred_dividends_income_statement_impact BIGINT,
	price NUMERIC,
	ps NUMERIC,
	ps1 NUMERIC,
	receivables BIGINT,
	accumulated_retained_earnings_deficit BIGINT,
	revenues BIGINT,
	r_and_d_expenses BIGINT,
	roa NUMERIC,
	roe NUMERIC,
	roic NUMERIC,
	return_on_sales NUMERIC,
	share_based_compensation BIGINT,
	selling_general_and_administrative_expense BIGINT,
	share_factor NUMERIC,
	shares_basic BIGINT,
	weighted_average_shares BIGINT,
	weighted_average_shares_diluted BIGINT,
	sales_per_share NUMERIC,
	tangible_asset_value BIGINT,
	tax_assets BIGINT,
	income_tax_expense BIGINT,
	tax_liabilities BIGINT,
	tangible_assets_book_value_per_share NUMERIC,
	working_capital BIGINT,

	PRIMARY KEY (composite_figi, dimension, event_date)
);

CREATE INDEX %[1]s_ticker_idx ON %[1]s(ticker, dimension);
CREATE INDEX %[1]s_event_date_idx ON %[1]s(event_date, dimension);`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
	MarketHolidaysKey: {
		Name: MarketHolidaysKey,
		Schema: `CREATE TABLE %[1]s (
holiday TEXT NOT NULL,
event_date DATE NOT NULL,
market VARCHAR(25) NOT NULL,
early_close BOOLEAN NOT NULL DEFAULT false,
close_time TIME NOT NULL DEFAULT '16:00:00',
PRIMARY KEY (event_date, market)
);`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
	MetricKey: {
		Name: MetricKey,
		Schema: `CREATE TABLE %[1]s (
ticker         CHARACTER VARYING(10) NOT NULL,
composite_figi CHARACTER(12)         NOT NULL,
event_date     DATE                  NOT NULL,
market_cap     BIGINT                NOT NULL DEFAULT 0.0,
ev             BIGINT                NOT NULL DEFAULT 0.0,
pe             REAL                  NOT NULL DEFAULT 0.0,
pb             REAL                  NOT NULL DEFAULT 0.0,
ps             REAL                  NOT NULL DEFAULT 0.0,
ev_ebit        REAL                  NOT NULL DEFAULT 0.0,
ev_ebitda      REAL                  NOT NULL DEFAULT 0.0,
sp500          BOOLEAN               DEFAULT false,
CHECK (LENGTH(TRIM(BOTH composite_figi)) = 12),
PRIMARY KEY (composite_figi, event_date)
) PARTITION BY RANGE (event_date);

CREATE INDEX %[1]s_event_date_idx ON %[1]s(event_date);
CREATE INDEX %[1]s_ticker_idx ON %[1]s(ticker);`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: true,
	},
	RatingKey: {
		Name: RatingKey,
		Schema: `CREATE TABLE %[1]s (
	ticker         CHARACTER VARYING(10) NOT NULL,
	composite_figi CHARACTER(12)         NOT NULL,
	event_date     DATE                  NOT NULL,
	analyst        TEXT                  NOT NULL,
	rating         INT                   NOT NULL,
	PRIMARY KEY (analyst, composite_figi, event_date)
);

CREATE INDEX %[1]s_ticker_event_date_idx ON %[1]s(ticker, event_date DESC)`,
		Migrations:    []string{},
		Version:       0,
		IsPartitioned: false,
	},
}

Functions

This section is empty.

Types

type AnalystRating

type AnalystRating struct {
	Ticker        string    `db:"ticker"`
	CompositeFigi string    `db:"composite_figi"`
	EventDate     time.Time `db:"event_date"`
	Analyst       string    `db:"analyst"`

	// A rating of 1 means buy or strong buy, 2 means outperform, 3 means hold,
	// 4 means underperform and 5 means sell.
	Rating int
}

func LatestRating

func LatestRating(ctx context.Context, tbl string, dbConn *pgxpool.Conn, analyst string) *AnalystRating

func (*AnalystRating) SaveDB

func (rating *AnalystRating) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type Asset

type Asset struct {
	Ticker               string    `json:"ticker" parquet:"name=ticker, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Name                 string    `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Description          string    `json:"description" parquet:"name=description, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	PrimaryExchange      Exchange  `` /* 143-byte string literal not displayed */
	AssetType            AssetType `json:"asset_type" toml:"asset_type" parquet:"name=asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	CompositeFigi        string    `` /* 137-byte string literal not displayed */
	ShareClassFigi       string    `` /* 143-byte string literal not displayed */
	Active               bool      `json:"active" toml:"active" parquet:"name=active, type=BOOLEAN"`
	CUSIP                []string  `json:"cusips" parquet:"name=cusip, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY" db:"cusips"`
	ISIN                 []string  `json:"isins" parquet:"name=isin, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY" db:"isins"`
	CIK                  string    `json:"cik" parquet:"name=cik, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SIC                  int       `json:"sic" db:"sic_code"`
	ListingDate          string    `` /* 143-byte string literal not displayed */
	DelistingDate        string    `` /* 151-byte string literal not displayed */
	Industry             string    `json:"industry" parquet:"name=industry, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Sector               string    `json:"sector" parquet:"name=sector, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Icon                 []byte    `parquet:"name=icon, type=BYTE_ARRAY"`
	IconMimeType         string    `parquet:"name=icon_mime_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LogoMimeType         string    `parquet:"name=logo_mime_type, tyle=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	CorporateUrl         string    `` /* 134-byte string literal not displayed */
	HeadquartersLocation string    `` /* 158-byte string literal not displayed */
	OtherIdentifiers     map[string]string
	Tags                 []string
	SimilarTickers       []string  `` /* 153-byte string literal not displayed */
	LastUpdated          time.Time `json:"last_updated" parquet:"name=last_updated, type=INT64"`
}

func ActiveAssets

func ActiveAssets(ctx context.Context, dbConn *pgxpool.Conn, tables ...string) []*Asset

func (*Asset) ID

func (asset *Asset) ID() string

func (*Asset) MarshalZerologObject

func (asset *Asset) MarshalZerologObject(e *zerolog.Event)

func (*Asset) SaveDB

func (asset *Asset) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

func (*Asset) SaveFiles

func (asset *Asset) SaveFiles(ctx context.Context, filer Filer) error

type AssetType

type AssetType string
const (
	CommonStock  AssetType = "CS"
	ETF          AssetType = "ETF"
	ETN          AssetType = "ETN"
	CEF          AssetType = "CEF"
	MutualFund   AssetType = "MF"
	ADRC         AssetType = "ADRC"
	FRED         AssetType = "FRED"
	SYNTH        AssetType = "SYNTH"
	INDEX        AssetType = "INDEX"
	UnknownAsset AssetType = "Unknown"
)

type Custom

type Custom struct {
	Ticker        string
	CompositeFigi string
	EventDate     time.Time
	Key           string
	Value         interface{}
}

func (*Custom) SaveDB

func (custom *Custom) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type DataType

type DataType struct {
	Name          string
	Schema        string
	Migrations    []string
	Version       int
	IsPartitioned bool
}

func (*DataType) ExpandedSchema

func (dt *DataType) ExpandedSchema(tableName string) string

Schema returns the schema of the data type. A getter is used to ensure that the value is immutable after construction

type EconomicIndicator

type EconomicIndicator struct {
	Series    string
	EventDate time.Time
	Value     float64
}

func (*EconomicIndicator) SaveDB

func (ind *EconomicIndicator) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type Eod

type Eod struct {
	Date          time.Time `json:"date"`
	Ticker        string    `json:"ticker"`
	CompositeFigi string    `json:"compositeFigi"`
	Open          float64   `json:"open"`
	High          float64   `json:"high"`
	Low           float64   `json:"low"`
	Close         float64   `json:"close"`
	Volume        float64   `json:"volume"`
	Dividend      float64   `json:"divCash"`
	Split         float64   `json:"splitFactor"`
}

func (*Eod) SaveDB

func (eod *Eod) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type Exchange

type Exchange string
const (
	NasdaqExchange  Exchange = "XNAS"
	NYSEExchange    Exchange = "XNYS"
	BATSExchange    Exchange = "BATS"
	NYSEMktExchange Exchange = "XASE"
	NMFQSExchange   Exchange = "NMFQS"
	ARCAExchange    Exchange = "ARCX"
	IndexExchange   Exchange = "INDEX"
	OTCExchange     Exchange = "OTC"
	UnknownExchange Exchange = "UNK"
)

type FSFiler

type FSFiler struct {
	BasePath string
}

func (*FSFiler) CreateFile

func (fs *FSFiler) CreateFile(name string, data []byte) (string, error)

type Filer

type Filer interface {
	CreateFile(name string, data []byte) (string, error)
}

func NewFilerFromString

func NewFilerFromString(spec string) Filer

type Fundamental

type Fundamental struct {
	// [Entity] The Event Date represents the normalized [ReportPeriod]. This
	// provides a common date to query for which is necessary due to
	// irregularity in report periods across companies. For example; if the
	// report period is 2015-09-26; the event date will be 2015-09-30 for
	// quarterly and trailing-twelve-month dimensions (ARQ;MRQ;ART;MRT); and
	// 2015-12-31 for annual dimensions (ARY;MRY). We also employ offsets in
	// order to maximise comparability of the period across companies. For
	// example consider two companies: one with a quarter ending on 2018-07-24;
	// and the other with a quarter ending on 2018-06-28. A naive normalization
	// process would assign these to differing calendar quarters of 2018-09-30
	// and 2018-06-30 respectively. However; we assign these both to the
	// 2018-06-30 calendar quarter because this maximises the overlap in the
	// report periods in question and therefore the comparability of this
	// period.
	EventDate time.Time

	// [Entity] The ticker is a unique identifier for a security in the
	// database. Where a company is delisted and the ticker subsequently
	// recycled for use by a different company; we utilise that ticker for the
	// currently active company and append a number to the ticker of the
	// delisted company. The ACTIONS table provides a record of historical
	// ticker changes.
	Ticker string

	// [Entity] The composite FIGI is a globally unique identifier assigned
	// by openfigi.com
	CompositeFigi string

	// [Entity] The dimension field allows you to take different dimensional
	// views of data over time. ARQ: Quarterly; excluding restatements; MRQ:
	// Quarterly; including restatements; ARY: annual; excluding restatements;
	// MRY: annual; including restatements; ART: trailing-twelve-months;
	// excluding restatements; MRT: trailing-twelve-months; including
	// restatements.
	Dimension string

	// [Entity] The Date Key represents the SEC filing date for AR dimensions
	// (ARQ;ART;ARY); and the [REPORTPERIOD] for MR dimensions (MRQ;MRT;MRY). In
	// addition; this is the observation date used for [Price] based data such
	// as [MarketCap]; [Price] and [PE].
	DateKey time.Time

	// [Entity] The Report Period represents the end date of the fiscal period.
	ReportPeriod time.Time // YYYY-MM-DD

	// [Entity] Last Updated represents the last date that this database entry
	// was updated; which is useful to users when updating their local records.
	LastUpdated time.Time // YYYY-MM-DD

	// [Balance Sheet] A component of [Equity] representing the accumulated
	// change in equity from transactions and other events and circumstances
	// from non-owner sources; net of tax effect; at period end. Includes
	// foreign currency translation items; certain pension adjustments;
	// unrealized gains and losses on certain investments in debt and equity
	// securities. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	AccumulatedOtherComprehensiveIncome int64 // currency

	// [Balance Sheet] Sum of the carrying amounts as of the balance sheet date
	// of all assets that are recognized. Major components are [CashnEq];
	// [Investments];[Intangibles]; [PPNENet];[TaxAssets] and [Receivables].
	TotalAssets int64 // currency

	// [Metrics] Average asset value for the period used in calculation of [ROE]
	// and [ROA]; derived from [Assets].
	AverageAssets int64 // currency

	// [Balance Sheet] The current portion of [Assets]; reported if a company
	// operates a classified balance sheet that segments current and non-current
	// assets.
	CurrentAssets int64 // currency

	// [Balance Sheet] Amount of non-current assets; for companies that operate
	// a classified balance sheet. Calculated as the different between Total
	// Assets [Assets] and Current Assets [AssetsC].
	AssetsNonCurrent int64 // currency

	// [Metrics] Asset turnover is a measure of a firms operating efficiency;
	// calculated by dividing [Revenue] by [AssetsAVG]. Often a component of
	// DuPont ROE analysis.
	AssetTurnover float64 // ratio

	// [Metrics] Measures the ratio between [Equity] and [SharesWA] as adjusted
	// by [ShareFactor].
	BookValuePerShare float64 // currency/share

	// [Cash Flow Statement] A component of [NCFI] representing the net cash
	// inflow/outflow associated with the acquisition & disposal of long-lived;
	// physical & intangible assets that are used in the normal conduct of
	// business to produce goods and services and are not intended for resale.
	// Includes cash inflows/outflows to pay for construction of
	// self-constructed assets & software. Where this item is not contained on
	// the company consolidated financial statements and cannot otherwise be
	// imputed the value of 0 is used.
	CapitalExpenditure int64 // currency

	// [Balance Sheet] A component of [Assets] representing the amount of
	// currency on hand as well as demand deposits with banks or financial
	// institutions. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	CashAndEquivalents int64 // currency

	// [Income Statement] The aggregate cost of goods produced and sold and
	// services rendered during the reporting period. Where this item is not
	// contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	CostOfRevenue int64 // currency

	// [Income Statement] The portion of profit or loss for the period; net of
	// income taxes; which is attributable to the consolidated entity; before
	// the deduction of [NetIncNCI].
	ConsolidatedIncome int64 // currency

	// [Metrics] The ratio between [AssetsC] and [LiabilitiesC]; for companies
	// that operate a classified balance sheet.
	CurrentRatio float64 // ratio

	// [Metrics] Measures the ratio between [Liabilities] and [Equity].
	DebtToEquityRatio float64 // ratio

	// [Balance Sheet] A component of [Liabilities] representing the total
	// amount of current and non-current debt owed. Includes secured and
	// unsecured bonds issued; commercial paper; notes payable; credit
	// facilities; lines of credit; capital lease obligations; operating lease
	// obligations; and convertible notes. Where this item is not contained on
	// the company consolidated financial statements and cannot otherwise be
	// imputed the value of 0 is used.
	TotalDebt int64 // currency

	// [Balance Sheet] The current portion of [Debt]; reported if the company
	// operates a classified balance sheet that segments current and non-current
	// liabilities. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	DebtCurrent int64 // currency

	// [Balance Sheet] The non-current portion of [Debt] reported if the company
	// operates a classified balance sheet that segments current and non-current
	// liabilities. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	DebtNonCurrent int64 // currency

	// [Balance Sheet] A component of [Liabilities] representing the carrying
	// amount of consideration received or receivable on potential earnings that
	// were not recognized as revenue; including sales; license fees; and
	// royalties; but excluding interest income. Where this item is not
	// contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	DeferredRevenue int64 // currency

	// [Cash Flow Statement] A component of operating cash flow representing the
	// aggregate net amount of depreciation; amortization; and accretion
	// recognized during an accounting period. As a non-cash item; the net
	// amount is added back to net income when calculating cash provided by or
	// used in operations using the indirect method. Where this item is not
	// contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	DepreciationAmortizationAndAccretion int64 // currency

	// [Balance Sheet] A component of [Liabilities] representing the total of
	// all deposit liabilities held; including foreign and domestic; interest
	// and noninterest bearing. May include demand deposits; saving deposits;
	// Negotiable Order of Withdrawal and time deposits among others. Where this
	// item is not contained on the company consolidated financial statements
	// and cannot otherwise be imputed the value of 0 is used.
	Deposits int64 // currency

	// [Metrics] Dividend Yield measures the ratio between a company's [DPS] and
	// its [Price]. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	DividendYield float64 // ratio

	// [Income Statement] Aggregate dividends declared during the period for
	// each split-adjusted share of common stock outstanding. Where this item is
	// not contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	DividendsPerBasicCommonShare float64 // USD/share

	// [Income Statement] Earnings Before Interest and Tax is calculated by
	// adding [TaxExp] and [IntExp] back to [NetInc].
	EBIT int64 // currency

	// [Metrics] EBITDA is a non-GAAP accounting metric that is widely used when
	// assessing the performance of companies; calculated by adding [DepAmor]
	// back to [EBIT].
	EBITDA int64 // currency

	// [Metrics] Measures the ratio between a company's [EBITDA] and [Revenue].
	EBITDAMargin float64 // ratio

	// [Metrics] Earnings Before Tax is calculated by adding [TaxExp] back to
	// [NetInc].
	EBT int64 // currency

	// [Income Statement] Earnings per share as calculated and reported by the
	// company. Approximates to the amount of [NetIncCmn] for the period per
	// each [SharesWA] after adjusting for [ShareFactor].
	EPS float64 // currency/share

	// [Income Statement] Earnings per diluted share as calculated and reported
	// by the company. Approximates to the amount of [NetIncCmn] for the period
	// per each [SharesWADil] after adjusting for [ShareFactor]..
	EPSDiluted float64 // currency/share

	// [Balance Sheet] A principal component of the balance sheet; in addition
	// to [Liabilities] and [Assets]; that represents the total of all
	// stockholders' equity (deficit) items; net of receivables from officers;
	// directors; owners; and affiliates of the entity which are attributable to
	// the parent.
	Equity int64 // currency)

	// [Metrics] Average equity value for the period used in calculation of
	// [ROE]; derived from [Equity].
	EquityAvg int64 // currency

	// [Metrics] Enterprise value is a measure of the value of a business as a
	// whole; calculated as [MarketCap] plus [DebtUSD] minus [CashnEqUSD].
	EnterpriseValue int64 // USD

	// [Metrics] Measures the ratio between [EV] and [EBITUSD].
	EVtoEBIT int64 // ratio

	// [Metrics] Measures the ratio between [EV] and [EBITDAUSD].
	EVtoEBITDA float64 // ratio

	// [Metrics] Free Cash Flow is a measure of financial performance calculated
	// as [NCFO] minus [CapEx].
	FreeCashFlow int64 // currency

	// [Metrics] Free Cash Flow per Share is a valuation metric calculated by
	// dividing [FCF] by [SharesWA] and [ShareFactor].
	FreeCashFlowPerShare float64 // currency/share

	// [Metrics] The exchange rate used for the conversion of foreign currency
	// to USD for non-US companies that do not report in USD.
	FxUSD float64 // ratio

	// [Income Statement] Aggregate revenue [Revenue] less cost of revenue [CoR]
	// directly attributable to the revenue generation activity.
	GrossProfit int64 // currency

	// [Metrics] Gross Margin measures the ratio between a company's [GP] and
	// [Revenue].
	GrossMargin float64 // ratio

	// [Balance Sheet] A component of [Assets] representing the carrying amounts
	// of all intangible assets and goodwill as of the balance sheet date; net
	// of accumulated amortization and impairment charges. Where this item is
	// not contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	Intangibles int64 // currency

	// [Income Statement] Amount of the cost of borrowed funds accounted for as
	// interest expense. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	InterestExpense int64 // currency

	// [Metrics] Invested capital is an input into the calculation of [ROIC];
	// and is calculated as: [Debt] plus [Assets] minus [Intangibles] minus
	// [CashnEq] minus [LiabilitiesC]. Please note this calculation method is
	// subject to change.
	InvestedCapital int64 // currency

	// [Metrics] Average invested capital value for the period used in the
	// calculation of [ROIC]; and derived from [InvCap]. Invested capital is an
	// input into the calculation of [ROIC]; and is calculated as: [Debt] plus
	// [Assets] minus [Intangibles] minus [CashnEq] minus [LiabilitiesC]. Please
	// note this calculation method is subject to change.
	InvestedCapitalAverage int64 // currency

	// [Balance Sheet] A component of [Assets] representing the amount after
	// valuation and reserves of inventory expected to be sold; or consumed
	// within one year or operating cycle; if longer. Where this item is not
	// contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	Inventory int64 // currency

	// [Balance Sheet] A component of [Assets] representing the total amount of
	// marketable and non-marketable securties; loans receivable and other
	// invested assets. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	Investments int64 // currency

	// [Balance Sheet] The current portion of [Investments]; reported if the
	// company operates a classified balance sheet that segments current and
	// non-current assets. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	InvestmentsCurrent int64 // currency

	// [Balance Sheet] The non-current portion of [Investments]; reported if the
	// company operates a classified balance sheet that segments current and
	// non-current assets. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	InvestmentsNonCurrent int64 // currency

	// [Balance Sheet] Sum of the carrying amounts as of the balance sheet date
	// of all liabilities that are recognized. Principal components are [Debt];
	// [DeferredRev]; [Payables];[Deposits]; and [TaxLiabilities].
	TotalLiabilities int64 // currency

	// [Balance Sheet] The current portion of [Liabilities]; reported if the
	// company operates a classified balance sheet that segments current and
	// non-current liabilities.
	CurrentLiabilities int64 // currency

	// [Balance Sheet] The non-current portion of [Liabilities]; reported if the
	// company operates a classified balance sheet that segments current and
	// non-current liabilities.
	LiabilitiesNonCurrent int64 // currency

	// [Metrics] Represents the product of [SharesBas]; [Price] and
	// [ShareFactor].
	MarketCapitalization int64 // USD

	// [Cash Flow Statement] Principal component of the cash flow statement
	// representing the amount of increase (decrease) in cash and cash
	// equivalents. Includes [NCFO]; investing [NCFI] and financing [NCFF] for
	// continuing and discontinued operations; and the effect of exchange rate
	// changes on cash [NCFX].
	NetCashFlow int64 // currency

	// [Cash Flow Statement] A component of [NCFI] representing the net cash
	// inflow (outflow) associated with the acquisition & disposal of
	// businesses; joint-ventures; affiliates; and other named investments.
	// Where this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowBusiness int64 // currency

	// [Cash Flow Statement] A component of [NCFF] representing the net cash
	// inflow (outflow) from common equity changes. Includes additional capital
	// contributions from share issuances and exercise of stock options; and
	// outflow from share repurchases.  Where this item is not contained on the
	// company consolidated financial statements and cannot otherwise be imputed
	// the value of 0 is used.
	NetCashFlowCommon int64 // currency

	// [Cash Flow Statement] A component of [NCFF] representing the net cash
	// inflow (outflow) from issuance (repayment) of debt securities. Where this
	// item is not contained on the company consolidated financial statements
	// and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowDebt int64 // currency

	// [Cash Flow Statement] A component of [NCFF] representing dividends and
	// dividend equivalents paid on common stock and restricted stock units.
	// Where this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowDividend int64 // currency

	// [Cash Flow Statement] A component of [NCF] representing the amount of
	// cash inflow (outflow) from financing activities; from continuing and
	// discontinued operations. Principal components of financing cash flow are:
	// issuance (purchase) of equity shares; issuance (repayment) of debt
	// securities; and payment of dividends & other cash distributions. Where
	// this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowFromFinancing int64 // currency

	// [Cash Flow Statement] A component of [NCF] representing the amount of
	// cash inflow (outflow) from investing activities; from continuing and
	// discontinued operations. Principal components of investing cash flow are:
	// capital (expenditure) disposal of equipment [CapEx]; business
	// (acquisitions) disposition [NCFBus] and investment (acquisition) disposal
	// [NCFInv]. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	NetCashFlowFromInvesting int64 // currency

	// [Cash Flow Statement] A component of [NCFI] representing the net cash
	// inflow (outflow) associated with the acquisition & disposal of
	// investments; including marketable securities and loan originations. Where
	// this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowInvest int64 // currency

	// [Cash Flow Statement] A component of [NCF] representing the amount of
	// cash inflow (outflow) from operating activities; from continuing and
	// discontinued operations.
	NetCashFlowFromOperations int64 // currency

	// [Cash Flow Statement] A component of Net Cash Flow [NCF] representing the
	// amount of increase (decrease) from the effect of exchange rate changes on
	// cash and cash equivalent balances held in foreign currencies. Where this
	// item is not contained on the company consolidated financial statements
	// and cannot otherwise be imputed the value of 0 is used.
	NetCashFlowFx int64 // currency)

	// [Income Statement] The portion of profit or loss for the period; net of
	// income taxes; which is attributable to the parent after the deduction of
	// [NetIncNCI] from [ConsolInc]; and before the deduction of [PrefDivIS].
	NetIncome int64 // currency

	// [Income Statement] The amount of net income (loss) for the period due to
	// common shareholders. Typically differs from [NetInc] to the parent entity
	// due to the deduction of [PrefDivIS].
	NetIncomeCommonStock int64 // currency

	// [Income Statement] Amount of loss (income) from a disposal group; net of
	// income tax; reported as a separate component of income. Where this item
	// is not contained on the company consolidated financial statements and
	// cannot otherwise be imputed the value of 0 is used.
	NetLossIncomeDiscontinuedOperations int64 // currency)

	// [Income Statement] The portion of income which is attributable to
	// non-controlling interest shareholders; subtracted from [ConsolInc] in
	// order to obtain [NetInc]. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	NetIncomeToNonControllingInterests int64 // currency

	// [Metrics] Measures the ratio between a company's [NetIncCmn] and
	// [Revenue].
	ProfitMargin float64 // ratio

	// [Income Statement] Operating expenses represent the total expenditure on
	// [SGnA]; [RnD] and other operating expense items; it excludes [CoR].
	OperatingExpenses int64 // currency

	// [Income Statement] Operating income is a measure of financial performance
	// before the deduction of [IntExp]; [TaxExp] and other Non-Operating items.
	// It is calculated as [GP] minus [OpEx].
	OperatingIncome int64 // currency

	// [Balance Sheet] A component of [Liabilities] representing trade and
	// non-trade payables. Where this item is not contained on the company
	// consolidated financial statements and cannot otherwise be imputed the
	// value of 0 is used.
	Payables int64 // currency

	// [Metrics] The percentage of earnings paid as dividends to common
	// stockholders. Calculated by dividing [DPS] by [EPSUSD].
	PayoutRatio float64 // ratio

	// [Metrics] Measures the ratio between [MarketCap] and [EquityUSD].
	PB float64 // ratio

	// [Metrics] Measures the ratio between [MarketCap] and [NetIncCmnUSD]
	PE float64 // ratio

	// [Metrics] An alternative to [PE] representing the ratio between [Price]
	// and [EPSUSD].
	PE1 float64 // ratio

	// [Balance Sheet] A component of [Assets] representing the amount after
	// accumulated depreciation; depletion and amortization of physical assets
	// used in the normal conduct of business to produce goods and services and
	// not intended for resale. Includes Operating Right of Use Assets. Where
	// this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	PropertyPlantAndEquipmentNet int64 // currency

	// [Income Statement] Income statement item reflecting dividend payments to
	// preferred stockholders. Subtracted from Net Income to Parent [NetInc] to
	// obtain Net Income to Common Stockholders [NetIncCmn]. Where this item is
	// not contained on the company consolidated financial statements and cannot
	// otherwise be imputed the value of 0 is used.
	PreferredDividendsIncomeStatementImpact int64 // currency

	// [Entity] The price per common share adjusted for stock splits but not
	// adjusted for dividends; used in the computation of [PE1]; [PS1];
	// [DivYield] and [SPS].
	Price float64 // USD/share

	// [Metrics] Measures the ratio between [MarketCap] and [RevenueUSD].
	PS float64 // ratio

	// [Metrics] An alternative calculation method to [PS]; that measures the
	// ratio between a company's [Price] and it's [SPS].
	PS1 float64 // ratio

	// [Balance Sheet] A component of [Assets] representing trade and non-trade
	// receivables. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	Receivables int64 // currency

	// [Balance Sheet] A component of [Equity] representing the cumulative
	// amount of the entities undistributed earnings or deficit. May only be
	// reported annually by certain companies; rather than quarterly.
	AccumulatedRetainedEarningsDeficit int64 // currency

	// [Income Statement] The amount of Revenue recognised from goods sold;
	// services rendered; insurance premiums; or other activities that
	// constitute an earning process. Interest income for financial institutions
	// is reported net of interest expense and provision for credit losses.
	// Where this item is not contained on the company consolidated financial
	// statements and cannot otherwise be imputed the value of 0 is used.
	Revenues int64 // currency

	// [Income Statement] A component of [OpEx] representing the aggregate costs
	// incurred in a planned search or critical investigation aimed at discovery
	// of new knowledge with the hope that such knowledge will be useful in
	// developing a new product or service. Where this item is not contained on
	// the company consolidated financial statements and cannot otherwise be
	// imputed the value of 0 is used.
	RandDExpenses int64 // currency

	// [Metrics] Return on assets measures how profitable a company is
	// [NetIncCmn] relative to its total assets [AssetsAvg].
	ROA float64 // ratio

	// [Metrics] Return on equity measures a corporation's profitability by
	// calculating the amount of [NetIncCmn] returned as a percentage of
	// [EquityAvg].
	ROE float64 // ratio

	// [Metrics] Return on Invested Capital is a ratio estimated by dividing
	// [EBIT] by [InvCapAvg]. [InvCap] is calculated as: [Debt] plus [Assets]
	// minus [Intangibles] minus [CashnEq] minus [LiabilitiesC]. Please note
	// this calculation method is subject to change.
	ROIC float64 // ratio

	// [Metrics] Return on Sales is a ratio to evaluate a company's operational
	// efficiency; calculated by dividing [EBIT] by [Revenue]. ROS is often a
	// component of DuPont ROE analysis.
	ReturnOnSales float64 // ratio

	// [Cash Flow Statement] A component of [NCFO] representing the total amount
	// of noncash; equity-based employee remuneration. This may include the
	// value of stock or unit options; amortization of restricted stock or
	// units; and adjustment for officers' compensation. As noncash; this
	// element is an add back when calculating net cash generated by operating
	// activities using the indirect method.
	ShareBasedCompensation int64 // currency

	// [Income Statement] A component of [OpEx] representing the aggregate total
	// costs related to selling a firm's product and services; as well as all
	// other general and administrative expenses. Direct selling expenses (for
	// example; credit; warranty; and advertising) are expenses that can be
	// directly linked to the sale of specific products. Indirect selling
	// expenses are expenses that cannot be directly linked to the sale of
	// specific products; for example telephone expenses; Internet; and postal
	// charges. General and administrative expenses include salaries of
	// non-sales personnel; rent; utilities; communication; etc. Where this item
	// is not contained on the company consolidated financial statements and
	// cannot otherwise be imputed the value of 0 is used.
	SellingGeneralAndAdministrativeExpense int64 // currency

	// [Entity] Share factor is a multiplicant in the calculation of [MarketCap]
	// and is used to adjust for: American Depository Receipts (ADRs) that
	// represent more or less than 1 underlying share; and; companies which have
	// different earnings share for different share classes (eg Berkshire
	// Hathaway - BRK.B).
	ShareFactor float64 // ratio

	// [Entity] The number of shares or other units outstanding of the entity's
	// capital or common stock or other ownership interests; as stated on the
	// cover of related periodic report (10-K/10-Q); after adjustment for stock
	// splits.
	SharesBasic int64 // units

	// [Income Statement] The weighted average number of shares or units issued
	// and outstanding that are used by the company to calculate [EPS];
	// determined based on the timing of issuance of shares or units in the
	// period.
	WeightedAverageShares int64 // units

	// [Income Statement] The weighted average number of shares or units issued
	// and outstanding that are used by the company to calculate [EPSDil];
	// determined based on the timing of issuance of shares or units in the
	// period.
	WeightedAverageSharesDiluted int64 // units

	// [Metrics] Sales per Share measures the ratio between [RevenueUSD] and
	// [SharesWA] as adjusted by [ShareFactor].
	SalesPerShare float64 // USD/share

	// [Metrics] The value of tangibles assets calculated as the difference
	// between [Assets] and [Intangibles].
	TangibleAssetValue int64 // currency

	// [Balance Sheet] A component of [Assets] representing tax assets and
	// receivables. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	TaxAssets int64 // currency

	// [Income Statement] Amount of current income tax expense (benefit) and
	// deferred income tax expense (benefit) pertaining to continuing
	// operations. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	IncomeTaxExpense int64 // currency

	// [Balance Sheet] A component of [Liabilities] representing outstanding tax
	// liabilities. Where this item is not contained on the company consolidated
	// financial statements and cannot otherwise be imputed the value of 0 is
	// used.
	TaxLiabilities int64 // currency

	// [Metrics] Measures the ratio between [Tangibles] and [SharesWA] as
	// adjusted by [ShareFactor].
	TangibleAssetsBookValuePerShare float64 // currency/share

	// [Metrics] Working capital measures the difference between [AssetsC] and
	// [LiabilitiesC].
	WorkingCapital int64 // currency
}

func (*Fundamental) SaveDB

func (fundamental *Fundamental) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type MarketHoliday

type MarketHoliday struct {
	Name       string    `db:"holiday"`
	EventDate  time.Time `db:"event_date"`
	Market     string    `db:"market"`
	EarlyClose bool      `db:"early_close"`
	CloseTime  time.Time `db:"close_time"`
}

func (*MarketHoliday) MarshalZerologObject

func (holiday *MarketHoliday) MarshalZerologObject(e *zerolog.Event)

func (*MarketHoliday) SaveDB

func (holiday *MarketHoliday) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type Metric

type Metric struct {
	Ticker        string
	CompositeFigi string
	EventDate     time.Time
	MarketCap     int64
	EV            int64
	PE            float64
	PB            float64
	PS            float64
	EVtoEBIT      float64
	EVtoEBITDA    float64
	SP500         bool
}

func (*Metric) MarshalZerologObject

func (metric *Metric) MarshalZerologObject(e *zerolog.Event)

func (*Metric) SaveDB

func (metric *Metric) SaveDB(ctx context.Context, tbl string, dbConn *pgxpool.Conn) error

type Observation

type Observation struct {
	AssetObject       *Asset
	CustomObject      *Custom
	EconomicIndicator *EconomicIndicator
	EodQuote          *Eod
	Fundamental       *Fundamental
	MarketHoliday     *MarketHoliday
	Metric            *Metric
	Rating            *AnalystRating

	ObservationDate  time.Time
	SubscriptionID   uuid.UUID
	SubscriptionName string
}

type RunSummary

type RunSummary struct {
	StartTime        time.Time
	EndTime          time.Time
	NumObservations  int
	Status           StatusType
	SubscriptionID   uuid.UUID
	SubscriptionName string
}

type StatusType

type StatusType int
const (
	StatusUnknown StatusType = iota
	RunFailed
	RunSuccess
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL