storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DailyBarV2SchemaVersion = "2.0.0"
View Source
const IndexBarV1SchemaVersion = "1.0.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type BacktestExperimentCaseRow

type BacktestExperimentCaseRow struct {
	bun.BaseModel `bun:"table:backtest_experiment_cases,alias:backtest_experiment_case"`

	ID                       string    `bun:"id,pk"`
	ExperimentID             string    `bun:"experiment_id,notnull"`
	CaseID                   string    `bun:"case_id,notnull"`
	CaseName                 string    `bun:"case_name,notnull"`
	RunName                  string    `bun:"run_name,notnull"`
	PeriodFrom               string    `bun:"period_from,notnull"`
	PeriodTo                 string    `bun:"period_to,notnull"`
	ParameterJSON            string    `bun:"parameter_json,notnull"`
	RegimeTagsJSON           string    `bun:"regime_tags_json,notnull"`
	Status                   string    `bun:"status,notnull"`
	PassedConstraints        bool      `bun:"passed_constraints,notnull"`
	Rank                     int       `bun:"rank,notnull"`
	Objective                string    `bun:"objective,nullzero"`
	ObjectiveValue           float64   `bun:"objective_value,nullzero"`
	StrategyHash             string    `bun:"strategy_hash,notnull,default:''"`
	RunHash                  string    `bun:"run_hash,notnull,default:''"`
	EngineVersion            string    `bun:"engine_version,notnull,default:''"`
	IndicatorRegistryVersion string    `bun:"indicator_registry_version,notnull,default:''"`
	MetricRegistryVersion    string    `bun:"metric_registry_version,notnull,default:''"`
	DataFingerprint          string    `bun:"data_fingerprint,notnull,default:''"`
	ResultHash               string    `bun:"result_hash,notnull"`
	CreatedAt                time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestExperimentRow

type BacktestExperimentRow struct {
	bun.BaseModel `bun:"table:backtest_experiments,alias:backtest_experiment"`

	ID               string    `bun:"id,pk"`
	Name             string    `bun:"name,notnull"`
	StrategyName     string    `bun:"strategy_name,notnull"`
	BaseRunName      string    `bun:"base_run_name,notnull"`
	SchemaVersion    int       `bun:"schema_version,notnull"`
	SpecJSON         string    `bun:"spec_json,notnull"`
	SpecHash         string    `bun:"spec_hash,notnull"`
	StrategySpecHash string    `bun:"strategy_spec_hash,notnull"`
	DataFrom         string    `bun:"data_from,notnull"`
	DataTo           string    `bun:"data_to,notnull"`
	CreatedAt        time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestMetricSummaryRow

type BacktestMetricSummaryRow struct {
	bun.BaseModel `bun:"table:backtest_metric_summaries,alias:backtest_metric_summary"`

	ID               string    `bun:"id,pk"`
	ExperimentCaseID string    `bun:"experiment_case_id,notnull"`
	Metric           string    `bun:"metric,notnull"`
	Value            float64   `bun:"value,notnull"`
	CreatedAt        time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestResultRow

type BacktestResultRow struct {
	bun.BaseModel `bun:"table:backtest_results,alias:backtest_result"`

	ID                       string    `bun:"id,pk"`
	ExperimentCaseID         string    `bun:"experiment_case_id,notnull"`
	ResultJSON               string    `bun:"result_json,notnull"`
	EngineVersion            string    `bun:"engine_version,notnull,default:''"`
	IndicatorRegistryVersion string    `bun:"indicator_registry_version,notnull,default:''"`
	MetricRegistryVersion    string    `bun:"metric_registry_version,notnull,default:''"`
	ResultHash               string    `bun:"result_hash,notnull"`
	CreatedAt                time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestRunRow

type BacktestRunRow struct {
	bun.BaseModel `bun:"table:backtest_runs,alias:backtest_run"`

	ID                       string    `bun:"id,pk"`
	RunName                  string    `bun:"run_name,notnull"`
	StrategyName             string    `bun:"strategy_name,notnull"`
	Market                   string    `bun:"market,notnull"`
	Timeframe                string    `bun:"timeframe,notnull"`
	PeriodFrom               string    `bun:"period_from,notnull"`
	PeriodTo                 string    `bun:"period_to,notnull"`
	StrategyHash             string    `bun:"strategy_hash,notnull"`
	RunHash                  string    `bun:"run_hash,notnull"`
	EngineVersion            string    `bun:"engine_version,notnull,default:''"`
	IndicatorRegistryVersion string    `bun:"indicator_registry_version,notnull,default:''"`
	MetricRegistryVersion    string    `bun:"metric_registry_version,notnull,default:''"`
	DataFingerprint          string    `bun:"data_fingerprint,notnull"`
	ResultHash               string    `bun:"result_hash,notnull"`
	ResultJSON               string    `bun:"result_json,notnull"`
	MetricsJSON              string    `bun:"metrics_json,notnull"`
	CreatedAt                time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestStrategyRow

type BacktestStrategyRow struct {
	bun.BaseModel `bun:"table:backtest_strategies,alias:backtest_strategy"`

	ID              string     `bun:"id,pk"`
	Name            string     `bun:"name,notnull,unique"`
	ActiveVersionID string     `bun:"active_version_id,notnull"`
	CreatedAt       time.Time  `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
	UpdatedAt       time.Time  `bun:"updated_at,notnull,default:CURRENT_TIMESTAMP"`
	DeletedAt       *time.Time `bun:"deleted_at,nullzero"`
}

type BacktestStrategyVersionRow

type BacktestStrategyVersionRow struct {
	bun.BaseModel `bun:"table:backtest_strategy_versions,alias:backtest_strategy_version"`

	ID            string    `bun:"id,pk"`
	StrategyID    string    `bun:"strategy_id,notnull"`
	Version       int       `bun:"version,notnull"`
	SchemaVersion int       `bun:"schema_version,notnull"`
	SpecJSON      string    `bun:"spec_json,notnull"`
	SpecHash      string    `bun:"spec_hash,notnull"`
	CreatedAt     time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type BacktestWalkForwardStepRow

type BacktestWalkForwardStepRow struct {
	bun.BaseModel `bun:"table:backtest_walk_forward_steps,alias:backtest_walk_forward_step"`

	ID                       string    `bun:"id,pk"`
	ExperimentID             string    `bun:"experiment_id,notnull"`
	StepIndex                int       `bun:"step_index,notnull"`
	TrainFrom                string    `bun:"train_from,notnull"`
	TrainTo                  string    `bun:"train_to,notnull"`
	TestFrom                 string    `bun:"test_from,notnull"`
	TestTo                   string    `bun:"test_to,notnull"`
	SelectedParameterJSON    string    `bun:"selected_parameter_json,notnull"`
	TrainCaseID              string    `bun:"train_case_id,notnull"`
	TestCaseID               string    `bun:"test_case_id,notnull"`
	TrainObjective           float64   `bun:"train_objective,notnull"`
	TestMetricsJSON          string    `bun:"test_metrics_json,notnull,default:'{}'"`
	StrategyHash             string    `bun:"strategy_hash,notnull,default:''"`
	RunHash                  string    `bun:"run_hash,notnull,default:''"`
	EngineVersion            string    `bun:"engine_version,notnull,default:''"`
	IndicatorRegistryVersion string    `bun:"indicator_registry_version,notnull,default:''"`
	MetricRegistryVersion    string    `bun:"metric_registry_version,notnull,default:''"`
	DataFingerprint          string    `bun:"data_fingerprint,notnull,default:''"`
	ResultHash               string    `bun:"result_hash,notnull"`
	CreatedAt                time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
}

type CompanyEventV1Row

type CompanyEventV1Row struct {
	bun.BaseModel `bun:"table:company_event_v1,alias:company_event_v1"`

	ID            int64  `bun:"id,pk,autoincrement"`
	CompanyID     int64  `bun:"company_id,notnull"`
	InstrumentID  int64  `bun:"instrument_id"`
	EventType     string `bun:"event_type,notnull"`
	EventDate     string `bun:"event_date,notnull,default:''"`
	RceptDt       string `bun:"rcept_dt,notnull,default:''"`
	RceptNo       string `bun:"rcept_no,notnull,default:''"`
	Provider      string `bun:"provider,notnull"`
	ProviderGroup string `bun:"provider_group,notnull"`
	Operation     string `bun:"operation,notnull"`
	Title         string `bun:"title,notnull,default:''"`
	AmountMinor   *int64 `bun:"amount_minor"`
	ValueText     string `bun:"value_text,notnull,default:''"`
	RawJSON       string `bun:"raw_json,notnull,default:'{}'"`
	CreatedAtMS   int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS   int64  `bun:"updated_at_ms,notnull"`
}

type CompanyFactV1Row

type CompanyFactV1Row struct {
	bun.BaseModel `bun:"table:company_fact_v1,alias:company_fact_v1"`

	ID                             int64  `bun:"id,pk,autoincrement"`
	CompanyID                      int64  `bun:"company_id,notnull"`
	InstrumentID                   int64  `bun:"instrument_id"`
	Provider                       string `bun:"provider,notnull"`
	ProviderGroup                  string `bun:"provider_group,notnull"`
	Operation                      string `bun:"operation,notnull"`
	ProviderCompanyIdentifierType  string `bun:"provider_company_identifier_type,notnull,default:''"`
	ProviderCompanyIdentifierValue string `bun:"provider_company_identifier_value,notnull,default:''"`
	FactType                       string `bun:"fact_type,notnull"`
	FiscalYear                     string `bun:"fiscal_year,notnull,default:''"`
	ReportCode                     string `bun:"report_code,notnull,default:''"`
	RceptNo                        string `bun:"rcept_no,notnull,default:''"`
	FactDate                       string `bun:"fact_date,notnull,default:''"`
	Key                            string `bun:"key,notnull"`
	ValueText                      string `bun:"value_text,notnull,default:''"`
	ValueNumber                    string `bun:"value_number,notnull,default:''"`
	CurrencyCode                   string `bun:"currency_code,notnull,default:''"`
	RawJSON                        string `bun:"raw_json,notnull,default:'{}'"`
	CreatedAtMS                    int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS                    int64  `bun:"updated_at_ms,notnull"`
}

type CompanyIdentifierV1Row

type CompanyIdentifierV1Row struct {
	bun.BaseModel `bun:"table:company_identifier_v1,alias:company_identifier_v1"`

	ID              int64   `bun:"id,pk,autoincrement"`
	CompanyID       int64   `bun:"company_id,notnull"`
	Provider        string  `bun:"provider,notnull,default:''"`
	ProviderGroup   string  `bun:"provider_group,notnull,default:''"`
	Operation       string  `bun:"operation,notnull,default:''"`
	IdentifierType  string  `bun:"identifier_type,notnull"`
	IdentifierValue string  `bun:"identifier_value,notnull"`
	ValidFrom       string  `bun:"valid_from,notnull,default:''"`
	ValidTo         string  `bun:"valid_to,notnull,default:''"`
	PrimaryFlag     bool    `bun:"primary_flag,notnull,default:false"`
	Confidence      float64 `bun:"confidence,notnull,default:1"`
	SourceUpdatedAt string  `bun:"source_updated_at,notnull,default:''"`
	CreatedAtMS     int64   `bun:"created_at_ms,notnull"`
	UpdatedAtMS     int64   `bun:"updated_at_ms,notnull"`
}

type CompanyV1Row

type CompanyV1Row struct {
	bun.BaseModel `bun:"table:company_v1,alias:company_v1"`

	ID          int64  `bun:"id,pk,autoincrement"`
	Name        string `bun:"name,notnull"`
	LegalName   string `bun:"legal_name,notnull,default:''"`
	EnglishName string `bun:"english_name,notnull,default:''"`
	CountryCode string `bun:"country_code,notnull,default:''"`
	CreatedAtMS int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS int64  `bun:"updated_at_ms,notnull"`
}

type CompositionMemberV1Row

type CompositionMemberV1Row struct {
	bun.BaseModel `bun:"table:composition_member_v1,alias:composition_member_v1"`

	CompositionID      int64  `bun:"composition_id,pk,notnull"`
	MemberInstrumentID int64  `bun:"member_instrument_id,pk,notnull"`
	Ordinal            int    `bun:"ordinal,notnull"`
	WeightValue        string `bun:"weight_value,notnull,default:''"`
	QuantityValue      string `bun:"quantity_value,notnull,default:''"`
	ValuationCurrency  string `bun:"valuation_currency,notnull,default:''"`
	ValuationValue     string `bun:"valuation_value,notnull,default:''"`
	CreatedAtMS        int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS        int64  `bun:"updated_at_ms,notnull"`
}

type CompositionObservationV1Row

type CompositionObservationV1Row struct {
	bun.BaseModel `bun:"table:composition_observation_v1,alias:composition_observation_v1"`

	ID                  int64  `bun:"id,pk,autoincrement"`
	SourceID            int64  `bun:"source_id,notnull"`
	SubjectInstrumentID int64  `bun:"subject_instrument_id,notnull"`
	AsOfDate            string `bun:"as_of_date,notnull"`
	ObservedAtMS        int64  `bun:"observed_at_ms,notnull"`
	CreatedAtMS         int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS         int64  `bun:"updated_at_ms,notnull"`
}

type DailyBarExtensionV2Row

type DailyBarExtensionV2Row struct {
	bun.BaseModel `bun:"table:daily_bar_extension_v2,alias:daily_bar_extension_v2"`

	InstrumentID int64  `bun:"instrument_id,pk,notnull"`
	SourceID     int64  `bun:"source_id,pk,notnull"`
	TradingDate  int    `bun:"trading_date,pk,notnull"`
	Key          string `bun:"key,pk,notnull"`
	Value        string `bun:"value,notnull"`
}

type DailyBarRow

type DailyBarRow = DailyBarV1Row

type DailyBarV1Row

type DailyBarV1Row struct {
	bun.BaseModel `bun:"table:daily_bar,alias:daily_bar"`

	ID                               int64     `bun:"id,pk,autoincrement"`
	Provider                         string    `bun:"provider,notnull"`
	ProviderGroup                    string    `bun:"provider_group,notnull"`
	Operation                        string    `bun:"operation,notnull"`
	Market                           string    `bun:"market,notnull"`
	SecurityType                     string    `bun:"security_type,notnull"`
	Symbol                           string    `bun:"symbol,notnull"`
	ISIN                             string    `bun:"isin,notnull,default:''"`
	Name                             string    `bun:"name,notnull,default:''"`
	TradingDate                      string    `bun:"trading_date,notnull"`
	Currency                         string    `bun:"currency,notnull,default:''"`
	OpeningPrice                     string    `bun:"opening_price,notnull,default:''"`
	HighestPrice                     string    `bun:"highest_price,notnull,default:''"`
	LowestPrice                      string    `bun:"lowest_price,notnull,default:''"`
	ClosingPrice                     string    `bun:"closing_price,notnull,default:''"`
	PriceChangeFromPreviousClose     string    `bun:"price_change_from_previous_close,notnull,default:''"`
	PriceChangeRateFromPreviousClose string    `bun:"price_change_rate_from_previous_close,notnull,default:''"`
	TradedVolume                     string    `bun:"traded_volume,notnull,default:''"`
	TradedAmount                     string    `bun:"traded_amount,notnull,default:''"`
	MarketCapitalization             string    `bun:"market_capitalization,notnull,default:''"`
	ExtensionsJSON                   string    `bun:"extensions_json,notnull,default:'{}'"`
	CreatedAt                        time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
	UpdatedAt                        time.Time `bun:"updated_at,notnull,default:CURRENT_TIMESTAMP"`
}

type DailyBarV2Row

type DailyBarV2Row struct {
	bun.BaseModel `bun:"table:daily_bar_v2,alias:daily_bar_v2"`

	SchemaVersion string `bun:"schema_version,notnull"`
	InstrumentID  int64  `bun:"instrument_id,pk,notnull"`
	SourceID      int64  `bun:"source_id,pk,notnull"`
	TradingDate   int    `bun:"trading_date,pk,notnull"`

	OpenPrice    sql.NullInt64 `bun:"open_price"`
	HighPrice    sql.NullInt64 `bun:"high_price"`
	LowPrice     sql.NullInt64 `bun:"low_price"`
	ClosePrice   sql.NullInt64 `bun:"close_price"`
	ChangePrice  sql.NullInt64 `bun:"change_price"`
	ChangeRateBP sql.NullInt64 `bun:"change_rate_bp"`

	Volume            sql.NullInt64 `bun:"volume"`
	TradedAmountMinor sql.NullInt64 `bun:"traded_amount_minor"`
	MarketCapMinor    sql.NullInt64 `bun:"market_cap_minor"`

	NAVPrice      sql.NullInt64 `bun:"nav_price"`
	ListedShares  sql.NullInt64 `bun:"listed_shares"`
	NetAssetMinor sql.NullInt64 `bun:"net_asset_minor"`

	CreatedAtMS int64 `bun:"created_at_ms,notnull"`
	UpdatedAtMS int64 `bun:"updated_at_ms,notnull"`
}

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(path string) *Database

func (*Database) Client

func (db *Database) Client(ctx context.Context) (*bun.DB, error)

func (*Database) Close

func (db *Database) Close() error

func (*Database) DB

func (db *Database) DB(ctx context.Context) (*bun.DB, error)

func (*Database) Reader

func (db *Database) Reader(ctx context.Context) (*bun.DB, error)

type FinancialLineItemV1Row

type FinancialLineItemV1Row struct {
	bun.BaseModel `bun:"table:financial_line_item_v1,alias:financial_line_item_v1"`

	ID               int64  `bun:"id,pk,autoincrement"`
	StatementID      int64  `bun:"statement_id,notnull"`
	AccountID        string `bun:"account_id,notnull,default:''"`
	AccountName      string `bun:"account_name,notnull"`
	CanonicalAccount string `bun:"canonical_account,notnull,default:''"`
	AmountMinor      *int64 `bun:"amount_minor"`
	CurrencyCode     string `bun:"currency_code,notnull,default:''"`
	Unit             string `bun:"unit,notnull,default:''"`
	RawAmount        string `bun:"raw_amount,notnull,default:''"`
	PeriodName       string `bun:"period_name,notnull,default:''"`
	Ord              int    `bun:"ord,notnull,default:0"`
	ExtensionsJSON   string `bun:"extensions_json,notnull,default:'{}'"`
	CreatedAtMS      int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS      int64  `bun:"updated_at_ms,notnull"`
}

type FinancialMetricV1Row

type FinancialMetricV1Row struct {
	bun.BaseModel `bun:"table:financial_metric_v1,alias:financial_metric_v1"`

	ID                 int64  `bun:"id,pk,autoincrement"`
	CompanyID          int64  `bun:"company_id,notnull"`
	InstrumentID       int64  `bun:"instrument_id"`
	StatementID        int64  `bun:"statement_id"`
	Metric             string `bun:"metric,notnull"`
	FiscalYear         string `bun:"fiscal_year,notnull"`
	FiscalPeriod       string `bun:"fiscal_period,notnull,default:''"`
	AsOfDate           string `bun:"as_of_date,notnull,default:''"`
	ValueDecimal       string `bun:"value_decimal,notnull,default:''"`
	ValueBP            *int64 `bun:"value_bp"`
	ValueMinor         *int64 `bun:"value_minor"`
	FormulaVersion     string `bun:"formula_version,notnull"`
	ProvenanceJSON     string `bun:"provenance_json,notnull,default:'{}'"`
	UncomputableReason string `bun:"uncomputable_reason,notnull,default:''"`
	CreatedAtMS        int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS        int64  `bun:"updated_at_ms,notnull"`
}

type FinancialStatementV1Row

type FinancialStatementV1Row struct {
	bun.BaseModel `bun:"table:financial_statement_v1,alias:financial_statement_v1"`

	ID                             int64  `bun:"id,pk,autoincrement"`
	CompanyID                      int64  `bun:"company_id,notnull"`
	InstrumentID                   int64  `bun:"instrument_id"`
	Provider                       string `bun:"provider,notnull"`
	ProviderGroup                  string `bun:"provider_group,notnull"`
	Operation                      string `bun:"operation,notnull"`
	ProviderCompanyIdentifierType  string `bun:"provider_company_identifier_type,notnull,default:''"`
	ProviderCompanyIdentifierValue string `bun:"provider_company_identifier_value,notnull,default:''"`
	RceptNo                        string `bun:"rcept_no,notnull,default:''"`
	FiscalYear                     string `bun:"fiscal_year,notnull"`
	FiscalPeriod                   string `bun:"fiscal_period,notnull,default:''"`
	ReportCode                     string `bun:"report_code,notnull,default:''"`
	FsDiv                          string `bun:"fs_div,notnull,default:''"`
	StatementType                  string `bun:"statement_type,notnull"`
	ReportedAt                     string `bun:"reported_at,notnull,default:''"`
	SourcePayloadRef               string `bun:"source_payload_ref,notnull,default:''"`
	CreatedAtMS                    int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS                    int64  `bun:"updated_at_ms,notnull"`
}

type IndexBarExtensionV1Row

type IndexBarExtensionV1Row struct {
	bun.BaseModel `bun:"table:index_bar_extension_v1,alias:index_bar_extension_v1"`

	IndexID     int64  `bun:"index_id,pk,notnull"`
	SourceID    int64  `bun:"source_id,pk,notnull"`
	TradingDate int    `bun:"trading_date,pk,notnull"`
	Key         string `bun:"key,pk,notnull"`
	Value       string `bun:"value,notnull"`
}

type IndexBarV1Row

type IndexBarV1Row struct {
	bun.BaseModel `bun:"table:index_bar_v1,alias:index_bar_v1"`

	SchemaVersion string `bun:"schema_version,notnull"`
	IndexID       int64  `bun:"index_id,pk,notnull"`
	SourceID      int64  `bun:"source_id,pk,notnull"`
	TradingDate   int    `bun:"trading_date,pk,notnull"`

	OpenValue         sql.NullInt64 `bun:"open_value"`
	HighValue         sql.NullInt64 `bun:"high_value"`
	LowValue          sql.NullInt64 `bun:"low_value"`
	CloseValue        sql.NullInt64 `bun:"close_value"`
	ChangeValue       sql.NullInt64 `bun:"change_value"`
	ChangeRateBP      sql.NullInt64 `bun:"change_rate_bp"`
	Volume            sql.NullInt64 `bun:"volume"`
	TradedAmountMinor sql.NullInt64 `bun:"traded_amount_minor"`
	MarketCapMinor    sql.NullInt64 `bun:"market_cap_minor"`

	CreatedAtMS int64 `bun:"created_at_ms,notnull"`
	UpdatedAtMS int64 `bun:"updated_at_ms,notnull"`
}

type IndexSourceV1Row

type IndexSourceV1Row struct {
	bun.BaseModel `bun:"table:index_source_v1,alias:index_source_v1"`

	ID             int64  `bun:"id,pk,autoincrement"`
	Provider       string `bun:"provider,notnull"`
	ProviderGroup  string `bun:"provider_group,notnull"`
	Operation      string `bun:"operation,notnull"`
	ProviderSymbol string `bun:"provider_symbol,notnull"`
	IndexID        int64  `bun:"index_id,notnull"`
	CreatedAtMS    int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS    int64  `bun:"updated_at_ms,notnull"`
}

type IndexV1Row

type IndexV1Row struct {
	bun.BaseModel `bun:"table:index_v1,alias:index_v1"`

	ID             int64  `bun:"id,pk,autoincrement"`
	Market         string `bun:"market,notnull"`
	IndexCode      string `bun:"index_code,notnull"`
	Name           string `bun:"name,notnull,default:''"`
	Family         string `bun:"family,notnull,default:''"`
	CountryCode    string `bun:"country_code,notnull,default:''"`
	CurrencyCode   string `bun:"currency_code,notnull,default:''"`
	Timezone       string `bun:"timezone,notnull,default:''"`
	IndexType      string `bun:"index_type,notnull,default:''"`
	ExtensionsJSON string `bun:"extensions_json,notnull,default:'{}'"`
	CreatedAtMS    int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS    int64  `bun:"updated_at_ms,notnull"`
}

type InstrumentCompanyLinkV1Row

type InstrumentCompanyLinkV1Row struct {
	bun.BaseModel `bun:"table:instrument_company_link_v1,alias:instrument_company_link_v1"`

	ID           int64  `bun:"id,pk,autoincrement"`
	InstrumentID int64  `bun:"instrument_id,notnull"`
	CompanyID    int64  `bun:"company_id,notnull"`
	RelationType string `bun:"relation_type,notnull"`
	ValidFrom    string `bun:"valid_from,notnull,default:''"`
	ValidTo      string `bun:"valid_to,notnull,default:''"`
	CreatedAtMS  int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS  int64  `bun:"updated_at_ms,notnull"`
}

type InstrumentExtensionV1Row

type InstrumentExtensionV1Row struct {
	bun.BaseModel `bun:"table:instrument_extension_v1,alias:instrument_extension_v1"`

	InstrumentID int64  `bun:"instrument_id,pk,notnull"`
	SourceID     int64  `bun:"source_id,pk,notnull"`
	Key          string `bun:"key,pk,notnull"`
	Value        string `bun:"value,notnull"`
}

type InstrumentSourceV1Row

type InstrumentSourceV1Row struct {
	bun.BaseModel `bun:"table:instrument_source_v1,alias:instrument_source_v1"`

	ID             int64  `bun:"id,pk,autoincrement"`
	Provider       string `bun:"provider,notnull"`
	ProviderGroup  string `bun:"provider_group,notnull"`
	Operation      string `bun:"operation,notnull"`
	ProviderSymbol string `bun:"provider_symbol,notnull"`
	InstrumentID   int64  `bun:"instrument_id,notnull"`
	CreatedAtMS    int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS    int64  `bun:"updated_at_ms,notnull"`
}

type InstrumentV2Row

type InstrumentV2Row struct {
	bun.BaseModel `bun:"table:instrument_v2,alias:instrument_v2"`

	ID           int64  `bun:"id,pk,autoincrement"`
	MarketID     int64  `bun:"market_id,notnull"`
	SecurityType string `bun:"security_type,notnull"`
	Symbol       string `bun:"symbol,notnull"`
	ISIN         string `bun:"isin,notnull,default:''"`
	Name         string `bun:"name,notnull,default:''"`
	CurrencyCode string `bun:"currency_code,notnull,default:'KRW'"`
	PriceScale   int    `bun:"price_scale,notnull"`
	CreatedAtMS  int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS  int64  `bun:"updated_at_ms,notnull"`
}

type MarketV2Row

type MarketV2Row struct {
	bun.BaseModel `bun:"table:market_v2,alias:market_v2"`

	ID                 int64  `bun:"id,pk,autoincrement"`
	Code               string `bun:"code,notnull"`
	Timezone           string `bun:"timezone,notnull"`
	RegularOpenMinute  int    `bun:"regular_open_minute,notnull"`
	RegularCloseMinute int    `bun:"regular_close_minute,notnull"`
	CreatedAtMS        int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS        int64  `bun:"updated_at_ms,notnull"`
}

type MigrationRunRow

type MigrationRunRow struct {
	bun.BaseModel `bun:"table:migration_runs,alias:migration_runs"`

	ID           string `bun:"id,pk,notnull"`
	Name         string `bun:"name,notnull"`
	Resource     string `bun:"resource,notnull"`
	FromVersion  string `bun:"from_version,notnull"`
	ToVersion    string `bun:"to_version,notnull"`
	Status       string `bun:"status,notnull"`
	RowsMigrated int64  `bun:"rows_migrated,notnull"`
	AppliedAtMS  int64  `bun:"applied_at_ms,notnull"`
	UpdatedAtMS  int64  `bun:"updated_at_ms,notnull"`
}

type OpenDARTCompanyRow

type OpenDARTCompanyRow struct {
	bun.BaseModel `bun:"table:opendart_companies,alias:opendart_companies"`

	ID          int64  `bun:"id,pk,autoincrement"`
	CorpCode    string `bun:"corp_code,notnull"`
	CorpName    string `bun:"corp_name,notnull"`
	CorpEngName string `bun:"corp_eng_name,notnull,default:''"`
	StockCode   string `bun:"stock_code,notnull,default:''"`
	ModifyDate  string `bun:"modify_date,notnull,default:''"`
	Listed      bool   `bun:"listed,notnull,default:false"`
	CreatedAtMS int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS int64  `bun:"updated_at_ms,notnull"`
}

type ProviderRawSnapshotRow

type ProviderRawSnapshotRow struct {
	bun.BaseModel `bun:"table:provider_raw_snapshots,alias:provider_raw_snapshots"`

	ID               int64  `bun:"id,pk,autoincrement"`
	Provider         string `bun:"provider,notnull"`
	ProviderGroup    string `bun:"provider_group,notnull"`
	Operation        string `bun:"operation,notnull"`
	BaseDate         int    `bun:"base_date,notnull"`
	CanonicalSupport string `bun:"canonical_support,notnull,default:''"`
	RowCount         int    `bun:"row_count,notnull"`
	PayloadJSON      string `bun:"payload_json,notnull"`
	CreatedAtMS      int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS      int64  `bun:"updated_at_ms,notnull"`
}

type ProviderSourceV2Row

type ProviderSourceV2Row struct {
	bun.BaseModel `bun:"table:provider_source_v2,alias:provider_source_v2"`

	ID            int64  `bun:"id,pk,autoincrement"`
	Provider      string `bun:"provider,notnull"`
	ProviderGroup string `bun:"provider_group,notnull"`
	Operation     string `bun:"operation,notnull"`
	CreatedAtMS   int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS   int64  `bun:"updated_at_ms,notnull"`
}

type ScreenRunItemRow

type ScreenRunItemRow struct {
	bun.BaseModel `bun:"table:screen_run_items,alias:screen_run_item"`

	ID          string `bun:"id,pk"`
	ScreenRunID string `bun:"screen_run_id,notnull"`
	Ordinal     int    `bun:"ordinal,notnull"`
	Symbol      string `bun:"symbol,notnull,default:''"`
	PayloadJSON string `bun:"payload_json,notnull"`
}

type ScreenRunRow

type ScreenRunRow struct {
	bun.BaseModel `bun:"table:screen_runs,alias:screen_run"`

	ID                 string     `bun:"id,pk"`
	Alias              string     `bun:"alias,nullzero"`
	StrategyID         string     `bun:"strategy_id,notnull"`
	StrategyVersionID  string     `bun:"strategy_version_id,notnull"`
	QueryHash          string     `bun:"query_hash,notnull"`
	InputDataset       string     `bun:"input_dataset,notnull"`
	InputSchemaVersion int        `bun:"input_schema_version,notnull"`
	ParamsJSON         string     `bun:"params_json,notnull,default:'{}'"`
	DataFrom           string     `bun:"data_from,notnull,default:''"`
	DataTo             string     `bun:"data_to,notnull,default:''"`
	DataAsOf           string     `bun:"data_as_of,notnull,default:''"`
	StartedAt          time.Time  `bun:"started_at,notnull,default:CURRENT_TIMESTAMP"`
	FinishedAt         *time.Time `bun:"finished_at,nullzero"`
	Status             string     `bun:"status,notnull"`
	ResultCount        int        `bun:"result_count,notnull"`
	ResultHash         string     `bun:"result_hash,notnull,default:''"`
	ResultSizeBytes    int64      `bun:"result_size_bytes,notnull"`
	SummaryJSON        string     `bun:"summary_json,notnull,default:'{}'"`
	ErrorMessage       string     `bun:"error_message,notnull,default:''"`
}

type StrategyRow

type StrategyRow struct {
	bun.BaseModel `bun:"table:strategies,alias:strategy"`

	ID              string     `bun:"id,pk"`
	Name            string     `bun:"name,notnull,unique"`
	Engine          string     `bun:"engine,notnull"`
	ActiveVersionID string     `bun:"active_version_id,notnull"`
	CreatedAt       time.Time  `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
	UpdatedAt       time.Time  `bun:"updated_at,notnull,default:CURRENT_TIMESTAMP"`
	ArchivedAt      *time.Time `bun:"archived_at,nullzero"`
}

type StrategyVersionRow

type StrategyVersionRow struct {
	bun.BaseModel `bun:"table:strategy_versions,alias:strategy_version"`

	ID                 string    `bun:"id,pk"`
	StrategyID         string    `bun:"strategy_id,notnull"`
	Version            int       `bun:"version,notnull"`
	QueryText          string    `bun:"query_text,notnull"`
	QueryHash          string    `bun:"query_hash,notnull"`
	InputDataset       string    `bun:"input_dataset,notnull"`
	InputSchemaVersion int       `bun:"input_schema_version,notnull"`
	ParamsJSON         string    `bun:"params_json,notnull,default:'{}'"`
	SpecJSON           string    `bun:"spec_json,notnull,default:'{}'"`
	SpecHash           string    `bun:"spec_hash,notnull,default:''"`
	CreatedAt          time.Time `bun:"created_at,notnull,default:CURRENT_TIMESTAMP"`
	Note               string    `bun:"note,notnull,default:''"`
}

type ValuationSnapshotV1Row

type ValuationSnapshotV1Row struct {
	bun.BaseModel `bun:"table:valuation_snapshot_v1,alias:valuation_snapshot_v1"`

	ID                  int64  `bun:"id,pk,autoincrement"`
	CompanyID           int64  `bun:"company_id,notnull"`
	InstrumentID        int64  `bun:"instrument_id,notnull"`
	AsOfDate            string `bun:"as_of_date,notnull"`
	SourcePriceDate     string `bun:"source_price_date,notnull"`
	MarketCapMinor      *int64 `bun:"market_cap_minor"`
	ClosePriceMinor     *int64 `bun:"close_price_minor"`
	SharesOutstanding   *int64 `bun:"shares_outstanding"`
	PerBP               *int64 `bun:"per_bp"`
	PbrBP               *int64 `bun:"pbr_bp"`
	PsrBP               *int64 `bun:"psr_bp"`
	EpsMinor            *int64 `bun:"eps_minor"`
	BpsMinor            *int64 `bun:"bps_minor"`
	DividendYieldBP     *int64 `bun:"dividend_yield_bp"`
	MetricSourceVersion string `bun:"metric_source_version,notnull"`
	ProvenanceJSON      string `bun:"provenance_json,notnull,default:'{}'"`
	UncomputableJSON    string `bun:"uncomputable_json,notnull,default:'{}'"`
	CreatedAtMS         int64  `bun:"created_at_ms,notnull"`
	UpdatedAtMS         int64  `bun:"updated_at_ms,notnull"`
}

Jump to

Keyboard shortcuts

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