Skip to content

Commit

Permalink
change updated_at to unix ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rcholic committed Sep 2, 2024
1 parent 2fac2f8 commit 2085af9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cschwabpy/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def to_dataframe_row(self, strip_space: bool = False) -> List[Any]:
self.expirationDate,
util.ts_to_date_string(self.quoteTimeInLong),
self.totalVolume,
util.ts_to_date_string(self.quoteTimeInLong),
self.quoteTimeInLong, # updated_at
self.gamma,
self.delta,
self.vega,
Expand Down Expand Up @@ -417,6 +417,7 @@ def break_down_option_map(
strip_space: bool = False,
) -> Mapping[str, pd.DataFrame]:
"""Whether strip spaces in option symbols."""
now_unix_ts = int(util.now_unix_ts())
result: MutableMapping[str, pd.DataFrame] = {}
for exp_date, strike_map in optionExpMap.items():
expiration = exp_date.split(":")[0]
Expand All @@ -434,6 +435,8 @@ def break_down_option_map(

strike_df = pd.DataFrame(all_rows)
strike_df.columns = OptionChain_Headers
# change updated_at to now_unix_ts
strike_df["updated_at"] = now_unix_ts
result[expiration] = strike_df

return result

0 comments on commit 2085af9

Please sign in to comment.