One bar field across many instruments: one row per instant, one column per instrument.
More...
#include <algotradelib/src/analytics/panel.hpp>
|
| | Panel ()=default |
| | Constructs an empty panel.
|
| std::size_t | rows () const noexcept |
| | Returns the number of rows.
|
| std::size_t | columns () const noexcept |
| | Returns the number of columns.
|
| const TimeIndex & | time () const noexcept |
| | Returns the instants of the rows.
|
| const std::vector< InstrumentId > & | instruments () const noexcept |
| | Returns the instruments of the columns.
|
| BarField | field () const noexcept |
| | Returns the bar field the panel holds.
|
| Alignment | alignment () const noexcept |
| | Returns how the panel lined up its instruments.
|
| std::optional< std::size_t > | find (const InstrumentId &instrument) const |
| | Finds an instrument's column.
|
| math::SeriesView | column (std::size_t position) const |
| | Returns one instrument's column.
|
| Scalar | at (std::size_t row, std::size_t column) const |
| | Reads one value.
|
| math::MatrixView | values () const |
| | Returns all values.
|
One bar field across many instruments: one row per instant, one column per instrument.
Build one with from_bars(). A row is a cross-section (all instruments at one instant), which is what ranking, covariance and portfolio weights read. The panel records the field and the Alignment it was built with.
Definition at line 74 of file panel.hpp.
◆ Panel()
| algotradelib::analytics::Panel::Panel |
( |
| ) |
|
|
default |
◆ alignment()
| Alignment algotradelib::analytics::Panel::alignment |
( |
| ) |
const |
|
inlinenoexcept |
◆ at()
| Scalar algotradelib::analytics::Panel::at |
( |
std::size_t | row, |
|
|
std::size_t | column ) const |
|
inline |
Reads one value.
- Parameters
-
| row | The row position. |
| column | The column position. |
- Returns
- The value, or missing().
- Exceptions
-
| std::out_of_range | if row or column is past the end. |
Definition at line 149 of file panel.hpp.
◆ column()
| math::SeriesView algotradelib::analytics::Panel::column |
( |
std::size_t | position | ) |
const |
|
inline |
Returns one instrument's column.
- Parameters
-
| position | The column position. |
- Returns
- A view into the panel's storage; valid while the panel is alive and unmoved.
- Exceptions
-
| std::out_of_range | if position is past the end. |
Definition at line 135 of file panel.hpp.
Referenced by at(), find(), and from_bars().
◆ columns()
| std::size_t algotradelib::analytics::Panel::columns |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of columns.
- Returns
- The number of instruments.
Definition at line 89 of file panel.hpp.
Referenced by at().
◆ field()
| BarField algotradelib::analytics::Panel::field |
( |
| ) |
const |
|
inlinenoexcept |
◆ find()
| std::optional< std::size_t > algotradelib::analytics::Panel::find |
( |
const InstrumentId & | instrument | ) |
const |
|
inline |
Finds an instrument's column.
- Parameters
-
- Returns
- Its column position, or std::nullopt if it is not in the panel.
Definition at line 120 of file panel.hpp.
◆ from_bars()
Builds a panel of one bar field from several bar series.
- Parameters
-
| series | The series, one per column, each strictly ascending in time. |
| field | The bar field to take from each series. |
| alignment | How to line up instants the series do not share. |
- Returns
- The panel; empty (with field and alignment recorded) if series is empty.
- Exceptions
-
| std::invalid_argument | if any series is not strictly ascending in time. |
Definition at line 171 of file panel.hpp.
◆ instruments()
| const std::vector< InstrumentId > & algotradelib::analytics::Panel::instruments |
( |
| ) |
const |
|
inlinenoexcept |
Returns the instruments of the columns.
- Returns
- The instruments, in column order.
Definition at line 101 of file panel.hpp.
◆ rows()
| std::size_t algotradelib::analytics::Panel::rows |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of rows.
- Returns
- The number of instants.
Definition at line 83 of file panel.hpp.
Referenced by at().
◆ time()
| const TimeIndex & algotradelib::analytics::Panel::time |
( |
| ) |
const |
|
inlinenoexcept |
Returns the instants of the rows.
- Returns
- The panel's time index.
Definition at line 95 of file panel.hpp.
◆ values()
Returns all values.
- Returns
- A view of the rows-by-instruments storage.
Definition at line 160 of file panel.hpp.
The documentation for this class was generated from the following file: