From 6874ead88f90d4f3fcfa4a056986ee38c4372ab0 Mon Sep 17 00:00:00 2001 From: idiom-bytes Date: Wed, 13 Dec 2023 17:00:40 -0800 Subject: [PATCH] Removing all TODOs --- pdr_backend/data_eng/plutil.py | 3 --- pdr_backend/trader/approach1/trader_agent1.py | 1 - pdr_backend/trader/approach2/portfolio.py | 4 ---- 3 files changed, 8 deletions(-) diff --git a/pdr_backend/data_eng/plutil.py b/pdr_backend/data_eng/plutil.py index 8b4486331..158a3f1a9 100644 --- a/pdr_backend/data_eng/plutil.py +++ b/pdr_backend/data_eng/plutil.py @@ -76,7 +76,6 @@ def save_rawohlcv_file(filename: str, df: pl.DataFrame): df = df.select(columns) if os.path.exists(filename): # append existing file - # TO DO: Implement parquet-append with pyarrow cur_df = pl.read_parquet(filename) df = pl.concat([cur_df, df]) df.write_parquet(filename) @@ -109,7 +108,6 @@ def load_rawohlcv_file(filename: str, cols=None, st=None, fin=None) -> pl.DataFr Polars does not have an index. "timestamp" is a regular col and required for "datetime" (1) Don't specify "datetime" as a column, as that'll get calc'd from timestamp - TO DO: Fix (1), save_rawohlcv_file already saves out dataframe. Either don't save datetime, or save it and load it so it doesn't have to be re-computed. """ # handle cols @@ -138,7 +136,6 @@ def load_rawohlcv_file(filename: str, cols=None, st=None, fin=None) -> pl.DataFr df = transform_df(df) # postconditions, return - # TO DO: Helper to go from np<->pl schema/dtypes assert "timestamp" in df.columns and df["timestamp"].dtype == pl.Int64 assert "datetime" in df.columns and df["datetime"].dtype == pl.Datetime diff --git a/pdr_backend/trader/approach1/trader_agent1.py b/pdr_backend/trader/approach1/trader_agent1.py index 15c395491..b0ab26f90 100644 --- a/pdr_backend/trader/approach1/trader_agent1.py +++ b/pdr_backend/trader/approach1/trader_agent1.py @@ -84,7 +84,6 @@ async def do_trade(self, feed: Feed, prediction: Tuple[float, float]): print(f" [Previous Order] {self.order}") print(f" [Closing Order] {order}") - # TO DO - Calculate PNL (self.order - order) self.order = None ### Create new order if prediction meets our criteria diff --git a/pdr_backend/trader/approach2/portfolio.py b/pdr_backend/trader/approach2/portfolio.py index a2f2c6e30..00732b4cc 100644 --- a/pdr_backend/trader/approach2/portfolio.py +++ b/pdr_backend/trader/approach2/portfolio.py @@ -64,12 +64,9 @@ class Position: """ @description Has an open and and a close order minimum - TO DO - Support many buy/sell orders, balance, etc... """ def __init__(self, order: Order): - # TO DO - Have N open_orders, have N close_orders - # TO DO - Move from __init__(order) to open(order) self.open_order: Order = order self.close_order: Optional[Order] = None self.state: OrderState = OrderState.OPEN @@ -79,7 +76,6 @@ def __init__(self, order: Order): def __str__(self): return f"<{self.open_order}, {self.close_order}, {self.__class__}>" - # TO DO - Only callable by portfolio def close(self, order: Order): self.close_order = order self.state = OrderState.CLOSED