Collections
PlanarCore.Collections.InstrumentCollection — Type
A type representing a collection of asset instances.
Invariants: eltype(data.asset) is the runtime asset type (authoritative) and eltype(data.instance) is the runtime instance type. The type parameters T,I reflect the construction-time concrete types when homogeneous; after a heterogeneous push! the DataFrame columns widen to abstract and T/I become stale. Callers should use eltype(ac.data.asset) / eltype(ac.data.instance) or assettype(ac) / eltype(ac) for runtime truth.
PlanarCore.TimeTicks.DateRange — Type
Makes a date range that spans the common minimum and maximum dates of the collection.
DateRange(
ac::PlanarCore.Collections.InstrumentCollection;
...
) -> PlanarCore.TimeTicks.DateRange
DateRange(
ac::PlanarCore.Collections.InstrumentCollection,
tf;
full,
kwargs...
) -> PlanarCore.TimeTicks.DateRange
The DateRange function takes the following parameters:
ac: an InstrumentCollection object which encapsulates a collection of assets.tf(optional): a TimeFrame object that represents a specific time frame. If not provided, the function will calculate the date range based on all time frames in the InstrumentCollection.skip_empty(optional, default is false): a boolean that indicates whether to skip empty data frames in the calculation of the date range.
PlanarCore.Collections._daterange_full — Function
Makes a date range that spans the union (earliest start to latest end) of the collection.
_daterange_full(
ac::PlanarCore.Collections.InstrumentCollection;
...
) -> PlanarCore.TimeTicks.DateRange
_daterange_full(
ac::PlanarCore.Collections.InstrumentCollection,
tf;
kwargs...
) -> PlanarCore.TimeTicks.DateRange
The daterange function returns a DateRange covering the earliest available timestamp and the latest available timestamp across all assets' OHLCV data in the InstrumentCollection.
Parameters:
ac: theInstrumentCollectiontf(optional): aTimeFrame. If not provided, it is inferred from the first asset instance
PlanarCore.Collections.bqe — Method
Dispatch based on either base, quote currency, or exchange.
PlanarCore.Collections.fill_universe! — Method
Fills the universe (InstrumentCollection) with OHLCV data for given timeframes.
fill_universe!(
ac::PlanarCore.Collections.InstrumentCollection,
tfs...;
kwargs...
)
This function loads OHLCV data for the specified timeframes into each instrument instance of the collection. It calls the load_ohlcv! function on each instance.
PlanarCore.Collections.flatten — Method
Returns a dictionary of all the OHLCV dataframes present in the asset collection.
flatten(
ac::PlanarCore.Collections.InstrumentCollection;
noempty
) -> SortedDict{TimeFrames.TimeFrame, Vector{DataFrames.DataFrame}, Base.Order.ForwardOrdering}
The flatten function takes the following parameter:
ac: an InstrumentCollection object which encapsulates a collection of assets.
The function returns a SortedDict where the keys are TimeFrame objects and the values are vectors of DataFrames that represent OHLCV (Open, High, Low, Close, Volume) data. The dictionary is sorted by the TimeFrame keys.
PlanarCore.Collections.iscashable — Method
Checks that all assets in the universe match the cash currency.
iscashable(
c::PlanarCore.Instruments.AbstractCash,
ac::PlanarCore.Collections.InstrumentCollection
) -> Bool
The iscashable function takes the following parameters:
c: an AbstractCash object which encapsulates a representation of cash.ac: an InstrumentCollection object which encapsulates a collection of assets.
PlanarCore.Collections.prettydf — Method
Pretty prints the InstrumentCollection DataFrame.
prettydf(
ac::PlanarCore.Collections.InstrumentCollection;
full
) -> DataFrames.DataFrame
The prettydf function takes the following parameters:
ac: an InstrumentCollection object which encapsulates a collection of assets.full(optional, default is false): a boolean that indicates whether to print the full DataFrame. If true, the function prints the full DataFrame. If false, it prints a truncated version.
PlanarCore.Collections.replace_universe! — Method
replace_universe!(ac::InstrumentCollection, new::Vector{<:InstrumentInstance})Atomically replace the collection contents with new. Computes added/removed by raw symbol, replaces ac.data in one assignment under ac.lock, calls _maybe_narrow!, and returns (added, removed). Idempotent and atomic; empty new is allowed.
PlanarCore.Collections.rows — Method
Iterates the collection yielding concretely typed rows (; exchange, asset, instance).