Skip to content

Commit

Permalink
Correct the create_future_markets duration starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan754 committed Dec 14, 2021
1 parent de53945 commit ac78925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gsy_e/models/market/future.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def create_future_markets(self, current_market_time_slot: DateTime,
if not GlobalConfig.FUTURE_MARKET_DURATION_HOURS:
return
future_time_slot = current_market_time_slot.add(minutes=slot_length.total_minutes())
most_future_slot = (future_time_slot +
most_future_slot = (current_market_time_slot +
duration(hours=GlobalConfig.FUTURE_MARKET_DURATION_HOURS))
while future_time_slot <= most_future_slot:
if (future_time_slot not in self.slot_bid_mapping and
Expand Down
6 changes: 3 additions & 3 deletions tests/market/test_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_create_future_markets(future_market):
for buffer in [future_market.slot_bid_mapping,
future_market.slot_offer_mapping,
future_market.slot_trade_mapping]:
assert len(buffer.keys()) == 5
assert len(buffer.keys()) == 4
future_time_slot = DEFAULT_CURRENT_MARKET_SLOT.add(
minutes=DEFAULT_SLOT_LENGTH.total_minutes())
most_future_slot = (future_time_slot +
Expand All @@ -130,10 +130,10 @@ def test_delete_old_future_markets(future_market):
time_slot=time_slot)
future_market.trades.append(trade)

count_orders_in_buffers(future_market, 5)
count_orders_in_buffers(future_market, 4)
first_future_market = next(iter(future_market.slot_bid_mapping))
future_market.delete_orders_in_old_future_markets(first_future_market)
count_orders_in_buffers(future_market, 4)
count_orders_in_buffers(future_market, 3)

@staticmethod
def test_offer_is_posted_correctly(future_market):
Expand Down

0 comments on commit ac78925

Please sign in to comment.