Skip to content

Commit

Permalink
Added a pandas datetime offset.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHardeep committed Dec 17, 2023
1 parent f822147 commit 0c70778
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pandas import read_csv
from pandas import read_json
from pandas import to_datetime
from pandas.tseries.offsets import DateOffset
from pandas import options
from pyotp import TOTP

Expand Down Expand Up @@ -179,6 +180,7 @@ def on_json_response(response: Response) -> dict[Any, Any]:
Returns:
dict: Json Object received from Response.
"""
print(response.text)
return loads(response.text.strip())


Expand Down Expand Up @@ -366,6 +368,17 @@ def time_delta(datetime_object: datetime,

raise InputError(f"Wrong default: {default}, the possible values are 'sub', 'add'")

def pd_dateoffset(*args, **kwargs) -> DateOffset:
"""
Datetime Increment from Pandas.
Returns:
DateOffset: Pandas DateOffset.
"""
return DateOffset(*args, **kwargs)




@staticmethod
def jsonify_expiry(data_frame: DataFrame) -> dict[Any, Any]:
Expand Down

0 comments on commit 0c70778

Please sign in to comment.