lumibot 4.2.2__py3-none-any.whl → 4.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lumibot might be problematic. Click here for more details.

@@ -288,7 +288,8 @@ class ThetaDataBacktestingPandas(PandasData):
288
288
  )
289
289
 
290
290
  expected_last_dt = self.to_default_timezone(current_dt).replace(hour=0, minute=0, second=0, microsecond=0) - timedelta(days=1)
291
- target_index = pd.date_range(end=expected_last_dt, periods=requested_length, freq="D", tz=self.tzinfo)
291
+ expected_last_dt_utc = expected_last_dt.astimezone(pytz.UTC)
292
+ target_index = pd.date_range(end=expected_last_dt_utc, periods=requested_length, freq="D", tz=pytz.UTC).tz_convert(self.tzinfo)
292
293
 
293
294
  # DEBUG-LOG: Target index details
294
295
  logger.debug(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lumibot
3
- Version: 4.2.2
3
+ Version: 4.2.3
4
4
  Summary: Backtesting and Trading Library, Made by Lumiwealth
5
5
  Home-page: https://github.com/Lumiwealth/lumibot
6
6
  Author: Robert Grzesik
@@ -14,7 +14,7 @@ lumibot/backtesting/interactive_brokers_rest_backtesting.py,sha256=5HJ_sPX0uOUg-
14
14
  lumibot/backtesting/pandas_backtesting.py,sha256=m-NvT4o-wFQjaZft6TXULzeZBrskO_7Z-jfy9AIkyAY,388
15
15
  lumibot/backtesting/polygon_backtesting.py,sha256=u9kif_2_7k0P4-KDvbHhaMfSoBVejUUX7fh9H3PCVE0,12350
16
16
  lumibot/backtesting/thetadata_backtesting.py,sha256=Xcz5f-4zTkKgWWcktNzItH2vrr8CysIMQWKKqLwugbA,345
17
- lumibot/backtesting/thetadata_backtesting_pandas.py,sha256=14XMsbQCa3uE_iS2nvTlGUXkn9kvI0cDSE8mqdKnDEg,51750
17
+ lumibot/backtesting/thetadata_backtesting_pandas.py,sha256=3ltwnxqAw4xXG2VOk14G_vpVHAVdnGl10SsveoMoJF0,51844
18
18
  lumibot/backtesting/yahoo_backtesting.py,sha256=LT2524mGlrUSq1YSRnUqGW4-Xcq4USgRv2EhnV_zfs4,502
19
19
  lumibot/brokers/__init__.py,sha256=MGWKHeH3mqseYRL7u-KX1Jp2x9EaFO4Ol8sfNSxzu1M,404
20
20
  lumibot/brokers/alpaca.py,sha256=VQ17idfqiEFb2JCqqdMGmbvF789L7_PpsCbudiFRzmg,61595
@@ -142,7 +142,7 @@ lumibot/traders/trader.py,sha256=KMif3WoZtnSxA0BzoK3kvkTITNELrDFIortx1BYBv8s,967
142
142
  lumibot/trading_builtins/__init__.py,sha256=vH2QL5zLjL3slfEV1YW-BvQHtEYLCFkIWTZDfh3y8LE,87
143
143
  lumibot/trading_builtins/custom_stream.py,sha256=8_XiPT0JzyXrgnXCXoovGGUrWEfnG4ohIYMPfB_Nook,5264
144
144
  lumibot/trading_builtins/safe_list.py,sha256=IIjZOHSiZYK25A4WBts0oJaZNOJDsjZL65MOSHhE3Ig,1975
145
- lumibot-4.2.2.dist-info/licenses/LICENSE,sha256=fYhGIyxjyNXACgpNQS3xxpxDOaVOWRVxZMCRbsDv8k0,35130
145
+ lumibot-4.2.3.dist-info/licenses/LICENSE,sha256=fYhGIyxjyNXACgpNQS3xxpxDOaVOWRVxZMCRbsDv8k0,35130
146
146
  tests/__init__.py,sha256=3-VoT-nAuqMfwufd4ceN6fXaHl_zCfDCSXJOTp1ywYQ,393
147
147
  tests/conftest.py,sha256=UBw_2fx7r6TZPKus2b1Qxrzmd4bg8EEBnX1vCHUuSVA,3311
148
148
  tests/fixtures.py,sha256=wOHQsh1SGHnXe_PGi6kDWI30CS_Righi7Ig7vwSEKT4,9082
@@ -234,7 +234,7 @@ tests/test_quiet_logs_requirements.py,sha256=YoUooSVLrFL8TlWPfxEiqxvSj4d8z6-qg58
234
234
  tests/test_session_manager.py,sha256=1qygN3aQ2Xe2uh4BMPm0E3V8KXLFNGq5qdL8KkZjef4,11632
235
235
  tests/test_strategy_methods.py,sha256=j9Mhr6nnG1fkiVQXnx7gLjzGbeQmwt0UbJr_4plD36o,12539
236
236
  tests/test_thetadata_backwards_compat.py,sha256=RzNLhNZNJZ2hPkEDyG-T_4mRRXh5XqavK6r-OjfRASQ,3306
237
- tests/test_thetadata_helper.py,sha256=pcEPu-9kQYp4cn5xmhU1-28DfT-GRu_nUuUMb1xi7nA,58088
237
+ tests/test_thetadata_helper.py,sha256=l77ksu70knZBudfrMAOwT9zJ91AxX5UgazqvYSrotqM,59346
238
238
  tests/test_thetadata_pandas_verification.py,sha256=MWUecqBY6FGFslWLRo_C5blGbom_unmXCZikAfZXLks,6553
239
239
  tests/test_tradier.py,sha256=iCEM2FTxJSzJ2oLNaRqSx05XaX_DCiMzLx1aEYPANko,33280
240
240
  tests/test_tradier_data.py,sha256=1jTxDzQtzaC42CQJVXMRMElBwExy1mVci3NFfKjjVH0,13363
@@ -280,7 +280,7 @@ tests/backtest/test_thetadata.py,sha256=xWYfC9C4EhbMDb29qyZWHO3sSWaLIPzzvcMbHCt5
280
280
  tests/backtest/test_thetadata_comprehensive.py,sha256=-gN3xLJcJtlB-k4vlaK82DCZDGDmr0LNZZDzn-aN3l4,26120
281
281
  tests/backtest/test_thetadata_vs_polygon.py,sha256=dZqsrOx3u3cz-1onIO6o5BDRjI1ey7U9vIkZupfXoig,22831
282
282
  tests/backtest/test_yahoo.py,sha256=2FguUTUMC9_A20eqxnZ17rN3tT9n6hyvJHaL98QKpqY,3443
283
- lumibot-4.2.2.dist-info/METADATA,sha256=yjZcnAmbXlQQj4ZEDPZNoWndZHusYMdY8nluNGVQP-0,12092
284
- lumibot-4.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
285
- lumibot-4.2.2.dist-info/top_level.txt,sha256=otUnUjDFVASauEDiTiAzNgMyqQ1B6jjS3QqqP-WSx38,14
286
- lumibot-4.2.2.dist-info/RECORD,,
283
+ lumibot-4.2.3.dist-info/METADATA,sha256=6a_FNEVEmL6ZbCA_h71_vSc1HAThL2gMk1aG1vuZv9Q,12092
284
+ lumibot-4.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
285
+ lumibot-4.2.3.dist-info/top_level.txt,sha256=otUnUjDFVASauEDiTiAzNgMyqQ1B6jjS3QqqP-WSx38,14
286
+ lumibot-4.2.3.dist-info/RECORD,,
@@ -1408,6 +1408,46 @@ class TestThetaDataChainsCaching:
1408
1408
  assert time2 < time1 * 0.1, f"Cache not working: time1={time1:.2f}s, time2={time2:.2f}s (should be 10x faster)"
1409
1409
  print(f"✓ Cache speedup: {time1/time2:.1f}x faster ({time1:.2f}s -> {time2:.4f}s)")
1410
1410
 
1411
+
1412
+ def test_finalize_day_frame_handles_dst_fallback():
1413
+ tz = pytz.timezone("America/New_York")
1414
+ utc = pytz.UTC
1415
+ frame_index = pd.date_range(
1416
+ end=tz.localize(datetime.datetime(2024, 10, 31, 16, 0)),
1417
+ periods=5,
1418
+ freq="D",
1419
+ )
1420
+ frame = pd.DataFrame(
1421
+ {
1422
+ "open": [100 + i for i in range(len(frame_index))],
1423
+ "high": [101 + i for i in range(len(frame_index))],
1424
+ "low": [99 + i for i in range(len(frame_index))],
1425
+ "close": [100.5 + i for i in range(len(frame_index))],
1426
+ "volume": [1000 + i for i in range(len(frame_index))],
1427
+ },
1428
+ index=frame_index,
1429
+ )
1430
+
1431
+ data_source = ThetaDataBacktestingPandas(
1432
+ datetime_start=utc.localize(datetime.datetime(2024, 10, 1)),
1433
+ datetime_end=utc.localize(datetime.datetime(2024, 11, 5)),
1434
+ username="user",
1435
+ password="pass",
1436
+ use_quote_data=False,
1437
+ )
1438
+
1439
+ current_dt = utc.localize(datetime.datetime(2024, 11, 4, 13, 30))
1440
+ result = data_source._finalize_day_frame(
1441
+ frame,
1442
+ current_dt,
1443
+ requested_length=len(frame_index),
1444
+ timeshift=None,
1445
+ asset=Asset("TSLA"),
1446
+ )
1447
+
1448
+ assert result is not None
1449
+ assert len(result) == len(frame_index)
1450
+
1411
1451
  def test_chains_strike_format(self):
1412
1452
  """Test strikes are floats (not integers) and properly converted."""
1413
1453
  username = os.environ.get("THETADATA_USERNAME")