dbn_hist

package
v0.0.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Condition_Available = "available"
	Condition_Degraded  = "degraded"
	Condition_Pending   = "pending"
	Condition_Missing   = "missing"
)

Variables

This section is empty.

Functions

func GetBillableSize added in v0.0.11

func GetBillableSize(apiKey string, metaParams MetadataQueryParams) (int, error)

Calls the Metadata API to get the billable size of a GetRange query. Returns the billable size or an error if any.

func GetCost added in v0.0.11

func GetCost(apiKey string, metaParams MetadataQueryParams) (float64, error)

Calls the Metadata API to get the cost estimate of a GetRange query. Returns the cost or an error if any.

func GetRecordCount added in v0.0.11

func GetRecordCount(apiKey string, metaParams MetadataQueryParams) (int, error)

Calls the Metadata API to get the record count of a GetRange query. Returns the record count or an error if any.

func ListDatasets

func ListDatasets(apiKey string, dateRange DateRange) ([]string, error)

Lists all available dataset codes on Databento.

# Errors This function returns an error when it fails to communicate with the Databento API or the API indicates there's an issue with the request.

func ListSchemas

func ListSchemas(apiKey string, dataset string) ([]string, error)

Lists all available schemas for the given `dataset`.

# Errors This function returns an error when it fails to communicate with the Databento API or the API indicates there's an issue with the request.

Types

type ConditionDetail added in v0.0.11

type ConditionDetail struct {
	Date         string // The day of the described data, as an ISO 8601 date string
	Condition    string // The condition code describing the quality and availability of the data on the given day. Possible values are ConditionKind.
	LastModified string // The date when any schema in the dataset on the given day was last generated or modified, as an ISO 8601 date string.
}

func GetDatasetCondition added in v0.0.11

func GetDatasetCondition(apiKey string, dataset string, dateRange DateRange) ([]ConditionDetail, error)

Calls the Metadata API to get the condition of a dataset and date range. Returns ConditionDetails, or an error if any. Passing a zero time for Start is the beginning of the Dataset. Passing a zero time for End is the end of the Dataset.

type DateRange

type DateRange struct {
	// The start date (inclusive).
	Start time.Time `json:"start"`
	// The end date (exclusive).
	End time.Time `json:"end"`
}

A **half**-closed date interval with an inclusive start date and an exclusive end date.

func GetDatasetRange added in v0.0.11

func GetDatasetRange(apiKey string, dataset string) (DateRange, error)

Calls the Metadata API to get the date range of a dataset. Returns the DateRage, or an error if any.

type FeedMode

type FeedMode uint8

A type of data feed.

const (
	// The historical batch data feed.
	FeedMode_Historical FeedMode = 0
	/// The historical streaming data feed.
	FeedMode_HistoricalStreaming FeedMode = 1
	/// The Live data feed for real-time and intraday historical.
	FeedMode_Live FeedMode = 2
)

func (FeedMode) String added in v0.0.11

func (f FeedMode) String() string

type FieldDetail

type FieldDetail struct {
	// The field name.
	Name string `json:"name,omitempty"`
	// The field type name.
	TypeName string `json:"type_name,omitempty"`
}

The details about a field in a schema.

func ListFields

func ListFields(apiKey string, encoding dbn.Encoding, schema dbn.Schema) ([]FieldDetail, error)

Lists all fields for a schema and encoding.

# Errors This function returns an error when it fails to communicate with the Databento API or the API indicates there's an issue with the request.

type MappingInterval

type MappingInterval struct {
	StartDate string `json:"d0"` // The UTC start date of interval (inclusive).
	EndDate   string `json:"d1"` // The UTC end date of interval (exclusive).
	Symbol    string `json:"s"`  // The resolved symbol for this interval.
}

The resolved symbol for a date range.

type MetadataQueryParams added in v0.0.11

type MetadataQueryParams struct {
	// The dataset code.
	Dataset   string    `json:"dataset,omitempty"`  // The dataset code. Must be one of the values from ListDatasets.
	Symbols   []string  `json:"symbols"`            // The product symbols to filter for. Takes up to 2,000 symbols per request. If `ALL_SYMBOLS` or not specified then will be for all symbols.
	Schema    string    `json:"schema,omitempty"`   // The data record schema. Must be one of the values from ListSchemas.
	DateRange DateRange `json:"date_range"`         // The date range of the request to get the cost for.
	Mode      FeedMode  `json:"mode,omitempty"`     // The data feed mode of the request. Must be one of 'historical', 'historical-streaming', or 'live'.
	StypeIn   dbn.SType `json:"stype_in,omitempty"` // The symbology type of input symbols. Must be one of 'raw_symbol', 'instrument_id', 'parent', or 'continuous'.
	Limit     int32     `json:"limit,omitempty"`    // The maximum number of records to return. 0 and negative (-1) means no limit.
}

MetadataQueryParams is the common request structure for several Metadata API queries

type PublisherDetail

type PublisherDetail struct {
	// The publisher ID assigned by Databento, which denotes the dataset and venue.
	PublisherID uint16 `json:"publisher_id,omitempty"`
	// The dataset code for the publisher.
	Dataset string `json:"dataset,omitempty"`
	// The venue for the publisher.
	Venue string `json:"venue,omitempty"`
	// The publisher description.
	Description string `json:"description,omitempty"`
}

The details about a publisher.

func ListPublishers

func ListPublishers(apiKey string) ([]PublisherDetail, error)

Lists the details of all publishers.

# Errors This function returns an error when it fails to communicate with the Databento API.

type RequestError

type RequestError struct {
	Case       string `json:"case"`
	Message    string `json:"message"`
	StatusCode int    `json:"status_code"`
	Docs       string `json:"docs,omitempty"`
	Payload    string `json:"payload,omitempty"`
}

type RequestErrorResp

type RequestErrorResp struct {
	Detail RequestError `json:"detail"`
}

type Resolution

type Resolution struct {
	// A mapping from input symbol to a list of resolved symbols in the output symbology.
	Mappings map[string][]MappingInterval `json:"result"`
	// A list of symbols that were resolved for part, but not all of the date range from the request.
	Partial []string `json:"partial"`
	// A list of symbols that were not resolved.
	NotFound []string `json:"not_found"`
	// The input symbology type, in string form.
	StypeIn string `json:"stype_in"`
	// The output symbology type, in string form.
	StypeOut string `json:"stype_out"`
	// A message from the server.
	Message string `json:"message"`
	// The status code of the response.
	Status int `json:"status"`
}

A symbology resolution from one symbology type to another.

func SymbologyResolve

func SymbologyResolve(apiKey string, params ResolveParams) (*Resolution, error)

type ResolveParams

type ResolveParams struct {
	// The dataset code.
	Dataset string `json:"dataset"`
	// The symbols to resolve.
	Symbols []string `json:"symbols"`
	// The symbology type of the input `symbols`. Defaults to SType_RawSymbol
	StypeIn dbn.SType `json:"stype_in"`
	// The symbology type of the output `symbols`. Defaults to SType_InstrumentId
	StypeOut dbn.SType `json:"stype_out"`
	// The date range of the resolution.
	DateRange DateRange `json:"date_range"`
}

https://github.com/databento/databento-rs/blob/main/src/historical/symbology.rs The parameters for [`SymbologyClient::resolve()`]. Use [`ResolveParams::builder()`] to get a builder type with all the preset defaults.

type UnitPricesForMode

type UnitPricesForMode struct {
	/// The data feed mode.
	Mode string `json:"mode,omitempty"`
	/// The unit prices in US dollars by data record schema.
	UnitPrices map[string]float64 `json:"unit_prices,omitempty"`
}

The unit prices for a particular [`FeedMode`].

func ListUnitPrices

func ListUnitPrices(apiKey string, dataset string) ([]UnitPricesForMode, error)

Lists unit prices for each data schema and feed mode in US dollars per gigabyte.

# Errors This function returns an error when it fails to communicate with the Databento API or the API indicates there's an issue with the request.

Jump to

Keyboard shortcuts

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