Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAssetMap(assets []*Asset) map[string]*Asset
- func BuildVersionString() string
- func GetDependencyList() []string
- func LogSummary(assets []*Asset)
- func MergeAssetList(first []*Asset, second []*Asset) (combinedAssets []*Asset, firstOnly []*Asset, secondOnly []*Asset)
- func SaveIcons(assets []*Asset, dirpath string)
- func SaveToDatabase(assets []*Asset) error
- func SaveToParquet(records []*Asset, fn string) error
- func TrimWhiteSpace(assets []*Asset)
- type Asset
- func ActiveAssetsFromDatabase() (assets []*Asset)
- func CleanAssets(assets []*Asset) []*Asset
- func DeduplicateCompositeFigi(assets []*Asset) []*Asset
- func FilterMixedCase(assets []*Asset) []*Asset
- func MergeAsset(a *Asset, b *Asset) *Asset
- func ReadAssetsFromParquet(fn string) []*Asset
- func ReadAssetsFromToml(fn string) []*Asset
- func RemoveAssets(assets []*Asset, remove []*Asset) []*Asset
- func RemoveDelistedAssets(assets []*Asset) []*Asset
- func SubtractAssets(a []*Asset, b []*Asset) (sub []*Asset)
- type AssetType
- type Version
Constants ¶
const ( EXIT_CODE_POLYGON = 64 EXIT_CODE_ASSET_COUNT_OUT_OF_RANGE = 65 EXIT_CODE_DATABASE_ERROR = 66 )
Variables ¶
var CurrentVersion = Version{
Major: 1,
Minor: 0,
Patch: 0,
Suffix: "dev",
}
CurrentVersion represents the current build version. This is the only one in the system
Functions ¶
func BuildAssetMap ¶
BuildAssetMap creates a map[string]*Asset hashmap where the ticker is the key
func BuildVersionString ¶
func BuildVersionString() string
BuildVersionString creates a version string. This is what you see when running "import-fred version".
func GetDependencyList ¶
func GetDependencyList() []string
GetDependencyList returns a sorted dependency list on the format package="version".
func LogSummary ¶ added in v0.3.0
func LogSummary(assets []*Asset)
LogSummary logs statistics about each signficant asset change
func MergeAssetList ¶ added in v0.3.0
func MergeAssetList(first []*Asset, second []*Asset) (combinedAssets []*Asset, firstOnly []*Asset, secondOnly []*Asset)
MergeAssetList combines assets from `first` and `second`. Assets in `first` are given preference to `second`
func SaveToDatabase ¶
func SaveToParquet ¶
func TrimWhiteSpace ¶
func TrimWhiteSpace(assets []*Asset)
TrimeWhiteSpace removes leading and trailing whitespace in selected fields of the asset
Types ¶
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 string `` /* 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 */ CUSIP string `json:"cusip" parquet:"name=cusip, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` ISIN string `json:"isin" parquet:"name=isin, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` CIK string `json:"cik" parquet:"name=cik, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` ListingDate string `` /* 131-byte string literal not displayed */ DelistingDate string `` /* 137-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 `json:"icon"` IconUrl string `json:"icon_url" toml:"icon_url" parquet:"name=icon_url, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` CorporateUrl string `` /* 134-byte string literal not displayed */ HeadquartersLocation string `` /* 158-byte string literal not displayed */ SimilarTickers []string `` /* 153-byte string literal not displayed */ PolygonDetailAge int64 `json:"polygon_detail_age" parquet:"name=polygon_detail_age, type=INT64"` FidelityCusip bool `parquet:"name=fidelity_cusip, type=BOOLEAN"` Updated bool UpdateReason string LastUpdated int64 `json:"last_updated" parquet:"name=last_update, type=INT64"` Source string `json:"source" parquet:"name=source, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` }
func ActiveAssetsFromDatabase ¶ added in v0.3.0
func ActiveAssetsFromDatabase() (assets []*Asset)
ActiveAssetsFromDatabase loads all active assets from the database
func CleanAssets ¶
CleanAssets remove assets that have no composite figi or have an unknown asset type
func DeduplicateCompositeFigi ¶ added in v0.4.0
DeduplicateCompositeFigi de-dupes assets that belong to the same composite figi. Dedup rules are as follows:
- Common stock is preferred to all other types
- Closed-end funds are preferred to mutual funds
- Most recent listed_utc is preferred
func FilterMixedCase ¶ added in v0.3.0
FilterMixedCase removes assets that have mixed-case tickers
func ReadAssetsFromParquet ¶ added in v0.3.0
func ReadAssetsFromToml ¶ added in v0.3.0
ReadAssetsFromToml reads assets stored as TOML from the file `fn`
func RemoveAssets ¶ added in v0.4.0
RemoveAssets remove assets in `remove` from `assets`
func RemoveDelistedAssets ¶ added in v0.3.0
RemoveDelistedAssets removes assets with DelistingDate set
func SubtractAssets ¶ added in v0.3.0
SubtractAssets returns the set of assets in a but not b
func (*Asset) MarshalZerologObject ¶
type AssetType ¶
type AssetType string
const ( CommonStock AssetType = "Common Stock" ETF AssetType = "Exchange Traded Fund" ETN AssetType = "Exchange Traded Note" CEF AssetType = "Closed-End Fund" MutualFund AssetType = "Mutual Fund" ADRC AssetType = "American Depository Receipt Common" FRED AssetType = "FRED" UnknownAsset AssetType = "Unknown" )
type Version ¶
type Version struct { // Increment this for backwards incompatible changes Major int // Increment this for feature releases Minor int // Increment this for bug releases Patch int // VersionSuffix is the suffix used in the PV API version string. // It will be blank for release versions. Suffix string }
Version represents a SemVer 2.0.0 compatible build version