Skip to content

Commit

Permalink
Removed un-needed prints
Browse files Browse the repository at this point in the history
dummy change

Signed-off-by: Haochi Li <[email protected]>
  • Loading branch information
haochili committed Aug 6, 2024
1 parent 4720a25 commit 05626f8
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 31 deletions.
5 changes: 0 additions & 5 deletions lumibot/backtesting/backtesting_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,9 @@ def _update_datetime(self, update_dt, cash=None, portfolio_value=None):
new_datetime = self.datetime + timedelta(seconds=update_dt)
else:
new_datetime = update_dt
print(f"\n backtesting_broker.py _update_datetime, new_datetime {new_datetime}")
self.data_source._update_datetime(new_datetime, cash=cash, portfolio_value=portfolio_value)
print(
f"\n backtesting_broker.py _update_datetime, self.data_source.get_datetime() {self.data_source.get_datetime()}")
if self.option_source:
self.option_source._update_datetime(new_datetime, cash=cash, portfolio_value=portfolio_value)
print(
f"\n backtesting_broker.py _update_datetime, self.option_source.get_datetime() {self.option_source.get_datetime()}")
logging.info(f"Current backtesting datetime {self.datetime}")

# =========Clock functions=====================
Expand Down
10 changes: 0 additions & 10 deletions lumibot/backtesting/polygon_backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def _update_pandas_data(self, asset, quote, length, timestep, start_dt=None):
# Download data from Polygon
try:
# Get data from Polygon
date_time_now = self.get_datetime()
# print(f"\npolygon_backtesting.py:before extracting data from helper: time:{date_time_now}\n")
df = polygon_helper.get_price_data_from_polygon(
self._api_key,
asset_separated,
Expand All @@ -134,7 +132,6 @@ def _update_pandas_data(self, asset, quote, length, timestep, start_dt=None):
timespan=ts_unit,
quote_asset=quote_asset,
)
# df.to_csv(f"polygon_csv/{date_time_now}_{asset.strike}_{asset.expiration}_{asset.right}_polygon.csv")
except BadResponse as e:
# Assuming e.message or similar attribute contains the error message
formatted_start_datetime = start_datetime.strftime("%Y-%m-%d")
Expand Down Expand Up @@ -172,14 +169,10 @@ def _update_pandas_data(self, asset, quote, length, timestep, start_dt=None):

if (df is None) or df.empty:
return
# print(f"\npolygon_backtesting.py:after extracting data from helper: time:{self.get_datetime()}\n")
data = Data(asset_separated, df, timestep=ts_unit, quote=quote_asset)
# print(f"\npolygon_backtesting.py:after data packing: time:{self.get_datetime()}\n")
pandas_data_update = self._set_pandas_data_keys([data])
# print(f"\npolygon_backtesting.py:after update keys: time:{self.get_datetime()}\n")
# Add the keys to the self.pandas_data dictionary
self.pandas_data.update(pandas_data_update)
# print(f"\npolygon_backtesting.py:after update data: time:{self.get_datetime()}\n")
if PolygonDataBacktesting.MAX_STORAGE_BYTES:
self._enforce_storage_limit(self.pandas_data)

Expand All @@ -195,11 +188,8 @@ def _pull_source_symbol_bars(
):
# Get the current datetime and calculate the start datetime
current_dt = self.get_datetime()
# print(f"\npolygon_backtesting.py:_pull_source_symbol_bars current_dt:{current_dt}\n")
# Get data from Polygon
self._update_pandas_data(asset, quote, length, timestep, current_dt)
# print(
# f"\npolygon_backtesting.py:_pull_source_symbol_bars calls super()._pull_source_symbol_bars,current_dt:{current_dt}\n")
return super()._pull_source_symbol_bars(
asset, length, timestep, timeshift, quote, exchange, include_after_hours
)
Expand Down
1 change: 0 additions & 1 deletion lumibot/data_sources/data_source_backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def get_datetime_range(self, length, timestep="minute", timeshift=None):
return start_date, end_date

def _update_datetime(self, new_datetime, cash=None, portfolio_value=None):
print("Updating datetime to", new_datetime)
self._datetime = new_datetime
print_progress_bar(
new_datetime,
Expand Down
4 changes: 0 additions & 4 deletions lumibot/data_sources/pandas_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ def get_last_price(self, asset, quote=None, exchange=None):

def get_last_prices(self, assets, quote=None, exchange=None, **kwargs):
result = {}
print(f"\nPandasData get_last_prices, before results, time: {self.get_datetime()}")
for asset in assets:
result[asset] = self.get_last_price(asset, quote=quote, exchange=exchange)
print(f"\nPandasData get_last_prices after results, time: {self.get_datetime()}")
return result

def find_asset_in_data_store(self, asset, quote=None):
Expand Down Expand Up @@ -250,7 +248,6 @@ def _pull_source_symbol_bars(

now = self.get_datetime()
try:
print(f"\npandas_data.py:_pull_source_symbol_bars calls data.get_bars, will select 2 bars, time:{now}")
res = data.get_bars(now, length=length, timestep=timestep, timeshift=timeshift)
print(f"\npandas_data.py:_pull_source_symbol_bars after data.get_bars, time:{now}")
# Return None if data.get_bars returns a ValueError
Expand Down Expand Up @@ -417,7 +414,6 @@ def get_historical_prices(

if not timestep:
timestep = self.get_timestep()
print(f"\npandas_data.py:get_historial prices calls self._pull_source_symbol_bars\n")
response = self._pull_source_symbol_bars(
asset,
length,
Expand Down
6 changes: 0 additions & 6 deletions lumibot/strategies/_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,7 @@ def _update_portfolio_value(self):
elif asset.asset_type == "option":
asset_is_option = True
assets.append(asset)
print(f"\n_strategy.py before using broker to get_last_prices, broker time: {self.broker.datetime}\n")
if self.broker.option_source and asset_is_option:
print(
f"\n_strategy.py Found option source in broker, and asset type is 'option', time: {self.broker.datetime}\n")
prices = self.broker.option_source.get_last_prices(assets)
else:
prices = self.broker.data_source.get_last_prices(assets)
Expand Down Expand Up @@ -515,11 +512,8 @@ def _update_portfolio_value(self):
else:
multiplier = asset.multiplier if asset.asset_type in ["option", "future"] else 1
portfolio_value += float(quantity) * price * multiplier
print(f"quantity: {quantity}, price: {price}, multiplier: {multiplier}")
print(f"portfolio_value += {float(quantity)} * {price} * {multiplier}")
print(f"portfolio_value: {portfolio_value}")
self._portfolio_value = portfolio_value

return portfolio_value

def _update_cash(self, side, quantity, price, multiplier):
Expand Down
3 changes: 0 additions & 3 deletions lumibot/strategies/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3088,10 +3088,7 @@ def get_historical_prices(
asset = self.crypto_assets_to_tuple(asset, quote)
if not timestep:
timestep = self.broker.data_source.MIN_TIMESTEP
print(f"\nstrategy.py:get_historial prices: time: {self.broker.datetime}")
if self.broker.option_source and asset.asset_type == "option":
print(
f"\nSTRATEGY: Found option source in broker, and asset type is 'option', expiry:{asset.expiration}, strike:{asset.strike}, right:{asset.right}")
return self.broker.option_source.get_historical_prices(
asset,
length,
Expand Down
2 changes: 0 additions & 2 deletions lumibot/tools/thetadata_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ def get_price_data(
if not missing_dates:
# df_all.index = df_all.index + pd.Timedelta(hours=THETA_SUMMER_TIME_SHIFT) - pd.Timedelta(minutes=1)
if is_summer_time(start):
print(f"Today's date is in Daylight Saving Time (Summer Time)")
df_all.index = df_all.index + pd.Timedelta(hours=THETA_SUMMER_TIME_SHIFT) - pd.Timedelta(minutes=1)
else:
print(f"Today's date is in Standard Time (Winter Time)")
df_all.index = df_all.index + pd.Timedelta(hours=THETA_WINTER_TIME_SHIFT) - pd.Timedelta(minutes=1)
return df_all

Expand Down

0 comments on commit 05626f8

Please sign in to comment.