SimpleFastDB - Functions
TFire.add_data_from_disk!
— Methodadd_data_from_disk!(spec::SpecificationStruct, full_data_path::String;sfdb = "default", verbose=false,
trading_dates::Union{Nothing,TradingDates}=nothing)
Adds data from disk to the SimpleFastDB based on the Specification.
Arguments
sfdb
: The SimpleFastDB to add data tofull_data_path
: The full path to the data file on diskspec
: The Specification defining what data to read. "default" uses the first SimpleFastDB in DBStore.verbose
: Print progress info. Default false.
Fetches the required external data based on the Specification, reads it from disk at the provided path, and adds it to the SimpleFastDB.
TFire.add_data_from_internet!
— Methodadd_data_from_internet!(spec::SpecificationStruct; internet_service::Union{String, Type{T}}="default", sfdb="default", verbose=false,
trading_dates::Union{Nothing,TradingDates}=nothing) where T <: InternetDataSource
Downloads external data from the internet based on the Specification and adds it to the SimpleFastDB sfdb.
Arguments
spec
: The Specification defining what data to downloadinternet_service
: Service to use for downloading data. "default" uses the default internet service specified in TFSettings.sfdb
: The SimpleFastDB to add data to. "default" uses the first SimpleFastDB in DBStore.verbose
: Print progress info. Default false.
Uses the external data Specification to determine what data to download. Fetches the data using the provided internet service. Then calls addexternaldata! to add the downloaded data to the SimpleFastDB.
TFire.add_external_data!
— Methodadd_external_data!(sfdb::SimpleFastDB, external_data::ExternalDataCollection, sfdb_cons::Union{ConstituentsContinuous, ConstituentsDiscrete}, data_fields; verbose=false, trading_dates::Union{Nothing,TradingDates}=nothing)
Adds external data to the SimpleFastDB instance sfdb
based on the provided external_data
and sfdb_cons
(either ConstituentsContinuous
or ConstituentsDiscrete
). The data_fields
parameter specifies the data fields to be added.
The verbose
parameter controls whether to print additional information about the data addition process. The trading_dates
parameter can be used to filter the added data to only include trading dates.
TFire.get_time_series
— Methodget_time_series(sfdb, ticker; resolution="1d", interval="continuous", date=Date(1,1,1))
Retrieves the time series data for the given ticker from the provided SimpleFastDB, based on the specified resolution, interval, and date.
Arguments
sfdb
: The SimpleFastDB to retrieve data from.ticker
: The ticker symbol to retrieve data for.resolution
: The resolution of the data, e.g. "1d". Default is "1d".interval
: Either "continuous" or "1d". Default is "continuous".date
: The specific date to retrieve data for (only used if interval="1d"). Default is Date(1,1,1).
Returns
- The TimeSeries data for the given ticker, resolution, interval and date.
- Returns
nothing
if no data is found.
TFire.setup_simple_fast_db
— Methodsetup_simple_fast_db(spec::SpecificationStruct; read_external=true,
read_disk=false, data_path="", internet_service=YahooFinance)
Sets up and returns a SimpleFastDB based on the given Specification. Data can be optionally read from disk or downloaded from the internet.
Arguments
spec
: The Specification to set up the SimpleFastDB for.read_external
: Whether to download data from the internet. Default false.read_disk
: Whether to read data from disk. Default false.data_path
: The path to the data directory if reading from disk.internet_service
: Service to use for downloading data. Default YahooData.
Returns
- The constructed SimpleFastDB containing data according to the arguments.
TFire.ExternalDataHandler.EDH_internal.DataFields
— MethodDataFields(ts::TimeSeries)
Returns a DataFields
object containing the set of data field symbols present in the given TimeSeries
object.
TFire.TradingDates
— MethodTradingDates(vts::Vector{TimeSeries})
Returns all unique dates that exists in any of the TimeSeries provided in a chronological order.
TFire.get_datafield
— Methodget_datafield(ts::TimeSeries, field::Symbol)
Returns the data vector for the specified field in the given TimeSeries
object.
Arguments:
ts::TimeSeries
: TheTimeSeries
object to retrieve the data field from.field::Symbol
: The symbol representing the data field to retrieve.
Returns:
- The data vector for the specified field in the
TimeSeries
object.