@@ -924,7 +924,7 @@ class TestRequestDataIntraday:
924
924
@pytest .mark .filterwarnings ("ignore:Prices from Yahoo are missing for:UserWarning" )
925
925
@pytest .mark .filterwarnings ("ignore:A value is trying to be set on a:FutureWarning" )
926
926
@pytest .mark .filterwarnings ("ignore:'S' is deprecated:FutureWarning" )
927
- def test_request_from_left_limit (self ):
927
+ def test_request_from_left_limit (self , one_min ):
928
928
"""Test data requests from left limit.
929
929
930
930
The Yahoo API appears to exhibit flaky behaviour when requesting
@@ -953,8 +953,10 @@ def test_request_from_left_limit(self):
953
953
if not rl < table .pt .last_ts :
954
954
# <= bi.as_minutes as rl is 'now' + bi and that bi can all be
955
955
# trading minutes beyond the right of the last indice
956
+ # + one_min to provide for processing between getting calendar
957
+ # and evaluating minutes
956
958
num_mins = len (cal .minutes_in_range (table .pt .last_ts , rl ))
957
- assert num_mins <= bi .as_minutes
959
+ assert num_mins <= bi .as_minutes + 1
958
960
else :
959
961
ll = prices .limit_daily
960
962
assert table .pt .first_ts == prices .cc .date_to_session (ll , "next" )
@@ -979,8 +981,10 @@ def test_request_from_left_limit(self):
979
981
if not rl < table .pt .last_ts :
980
982
# <= bi.as_minutes as rl is 'now' + bi and that bi can all be
981
983
# trading minutes beyond the right of the last indice
984
+ # + one_min to provide for processing between getting calendar
985
+ # and evaluating minutes
982
986
num_mins = len (cal .minutes_in_range (table .pt .last_ts , rl ))
983
- assert num_mins <= bi .as_minutes
987
+ assert num_mins <= bi .as_minutes + 1
984
988
else :
985
989
ll = prices .limit_daily
986
990
assert table .pt .first_ts == prices .cc .date_to_session (ll , "next" )
@@ -1000,7 +1004,10 @@ def verify_limit_intraday_bi(self, prices: m.PricesYahoo):
1000
1004
len_mins = []
1001
1005
for cal in prices .calendars_unique :
1002
1006
len_mins .append (len (cal .minutes_in_range (prices .limits [bi ][0 ], limit )))
1003
- assert (1 + bi .as_minutes ) == min (len_mins )
1007
+ # NB the number of trading minutes will be less than 1 + bi during the
1008
+ # period between a session close and one bi prior to that close (unless
1009
+ # calendar 24h)
1010
+ assert (1 + bi .as_minutes ) >= min (len_mins )
1004
1011
1005
1012
def test_prices_us (self , pricess ):
1006
1013
"""Verify return from specific fixture."""
0 commit comments