margot.data¶
-
class
margot.data.
MargotDataFrame
(env: dict = {})¶ An MargotDataFrame brings together symbols, columns, features and ratios.
- Parameters
env (dict) – optional env dictionary as an alternative to sysenv variables.
- Raises
NotImplementedError – [description]
- Returns
[description]
- Return type
[type]
-
to_pandas
(when: datetime.datetime = None) → pandas.core.frame.DataFrame¶ Return a pandas Dataframe representing this MargotDataFrame.
- Parameters
when (datetime, optional) – slice to only show data that was available at when. That is, the EOD from the previous day. Defaults to None.
- Returns
- a Pandas dataframe representing all data from
the MargotDataFrame
- Return type
pd.DataFrame
-
refresh
()¶ Refresh all Symbols in this DataFrame.
-
property
start_date
¶ First Timestamp of the time-series index.
- Returns
a pandas timestamp.
- Return type
Timestamp
-
property
end_date
¶ Last Timestamp value of the time-series index.
- Returns
a pandas timestamp.
- Return type
Timestamp
-
property
index
¶ Return the time-series index.
- Returns
a pandas timeseries index.
- Return type
pd.Index
-
class
margot.data.
Symbol
(symbol: str, trading_calendar: str, env: dict = {})¶ A Symbol, that has columns and features.
- Parameters
object ([type]) – [description]
- Raises
NotImplementedError – [description]
- Returns
[description]
- Return type
[type]
-
refresh
()¶ Refresh all columns in this Symbol.
-
class
margot.data.
Ratio
(numerator, denominator, label, **kwargs)¶ Ratio of two series.
Ratio = numerator / denomnator of two series.
- Parameters
numerator (str) – the series to numerate the ratio
denominator (str) – the series to denominate the ratio
label (str) – give it a name for your dataframe. e.g. current_ratio
-
property
latest
¶ Return the latest value in this series