formatting the datetime in an instrument Parameters ---------- inst_df: pd.DataFrame inst_df.columns = [self.SYMBOL_FIELD_NAME, self.START_DATE_FIELD, self.END_DATE_FIELD] Returns -------
(self, inst_df: pd.DataFrame)
| 101 | raise NotImplementedError("rewrite html_table_index") |
| 102 | |
| 103 | def format_datetime(self, inst_df: pd.DataFrame) -> pd.DataFrame: |
| 104 | """formatting the datetime in an instrument |
| 105 | |
| 106 | Parameters |
| 107 | ---------- |
| 108 | inst_df: pd.DataFrame |
| 109 | inst_df.columns = [self.SYMBOL_FIELD_NAME, self.START_DATE_FIELD, self.END_DATE_FIELD] |
| 110 | |
| 111 | Returns |
| 112 | ------- |
| 113 | |
| 114 | """ |
| 115 | if self.freq != "day": |
| 116 | inst_df[self.START_DATE_FIELD] = inst_df[self.START_DATE_FIELD].apply( |
| 117 | lambda x: (pd.Timestamp(x) + pd.Timedelta(hours=9, minutes=30)).strftime("%Y-%m-%d %H:%M:%S") |
| 118 | ) |
| 119 | inst_df[self.END_DATE_FIELD] = inst_df[self.END_DATE_FIELD].apply( |
| 120 | lambda x: (pd.Timestamp(x) + pd.Timedelta(hours=15, minutes=0)).strftime("%Y-%m-%d %H:%M:%S") |
| 121 | ) |
| 122 | return inst_df |
| 123 | |
| 124 | def get_changes(self) -> pd.DataFrame: |
| 125 | """get companies changes |