Пример #1
0
 def create_agent_object(owner, higher_market, lower_market, is_spot_market):
     agent_constructor_arguments = {
         "owner": owner,
         "higher_market": higher_market,
         "lower_market": lower_market,
         "min_offer_age": ConstSettings.IAASettings.MIN_OFFER_AGE
     }
     if is_spot_market:
         if ConstSettings.IAASettings.MARKET_TYPE == 1:
             if ConstSettings.IAASettings.AlternativePricing.PRICING_SCHEME != 0:
                 return OneSidedAlternativePricingAgent(**agent_constructor_arguments)
             else:
                 return OneSidedAgent(**agent_constructor_arguments)
         elif ConstSettings.IAASettings.MARKET_TYPE == 2:
             return TwoSidedPayAsBidAgent(
                 **agent_constructor_arguments,
                 min_bid_age=ConstSettings.IAASettings.MIN_BID_AGE
             )
         elif ConstSettings.IAASettings.MARKET_TYPE == 3:
             return TwoSidedPayAsClearAgent(
                 **agent_constructor_arguments,
                 min_bid_age=ConstSettings.IAASettings.MIN_BID_AGE
             )
     else:
         return BalancingAgent(**agent_constructor_arguments)
Пример #2
0
 def create_agent_object(owner, higher_market, lower_market,
                         is_spot_market):
     agent_constructor_arguments = {
         "owner": owner,
         "higher_market": higher_market,
         "lower_market": lower_market,
         "min_offer_age": ConstSettings.IAASettings.MIN_OFFER_AGE
     }
     if is_spot_market:
         if ConstSettings.IAASettings.MARKET_TYPE == 1:
             if ConstSettings.IAASettings.AlternativePricing.PRICING_SCHEME != 0:
                 return OneSidedAlternativePricingAgent(
                     **agent_constructor_arguments)
             else:
                 return OneSidedAgent(**agent_constructor_arguments)
         elif ConstSettings.IAASettings.MARKET_TYPE == 2:
             return TwoSidedAgent(
                 **agent_constructor_arguments,
                 min_bid_age=ConstSettings.IAASettings.MIN_BID_AGE)
         else:
             raise WrongMarketTypeException(
                 f'Wrong market type setting flag '
                 f'{ConstSettings.IAASettings.MARKET_TYPE}')
     else:
         return BalancingAgent(**agent_constructor_arguments)
Пример #3
0
def iaa2():
    lower_market = FakeMarket([Offer('id', 2, 2, 'other', 2)], m_id=123)
    higher_market = FakeMarket([], m_id=234)
    owner = FakeArea('owner')
    owner.future_market = lower_market
    iaa = OneSidedAgent(owner=owner, lower_market=lower_market, higher_market=higher_market)
    iaa.event_tick()
    iaa.owner.current_tick += 2
    iaa.event_tick()
    return iaa
Пример #4
0
def iaa():
    lower_market = FakeMarket([Offer('id', 1, 1, 'other')])
    higher_market = FakeMarket([Offer('id2', 3, 3, 'owner'), Offer('id3', 0.5, 1, 'owner')])
    owner = FakeArea('owner')
    iaa = OneSidedAgent(owner=owner,
                        higher_market=higher_market,
                        lower_market=lower_market)
    iaa.event_tick()
    iaa.owner.current_tick = 14
    iaa.event_tick()
    return iaa
Пример #5
0
def iaa_grid_fee():
    lower_market = FakeMarket([Offer('id', 1, 1, 'other')], transfer_fee_ratio=0.1,
                              transfer_fee_const=2)
    higher_market = FakeMarket([Offer('id2', 3, 3, 'owner'), Offer('id3', 0.5, 1, 'owner')],
                               transfer_fee_ratio=0.1, transfer_fee_const=2)
    owner = FakeArea('owner')
    iaa = OneSidedAgent(owner=owner,
                        higher_market=higher_market,
                        lower_market=lower_market)
    iaa.event_tick()
    iaa.owner.current_tick = 14
    iaa.event_tick()
    return iaa
Пример #6
0
def iaa_grid_fee():
    lower_market = FakeMarket([Offer('id', pendulum.now(), 1, 1, 'other', 1)],
                              transfer_fees=TransferFees(grid_fee_percentage=0.1,
                                                         transfer_fee_const=2))
    higher_market = FakeMarket([Offer('id2', pendulum.now(), 3, 3, 'owner', 3),
                                Offer('id3', pendulum.now(), 0.5, 1, 'owner', 0.5)],
                               transfer_fees=TransferFees(grid_fee_percentage=0.1,
                                                          transfer_fee_const=2))
    owner = FakeArea('owner')
    iaa = OneSidedAgent(owner=owner,
                        higher_market=higher_market,
                        lower_market=lower_market)
    iaa.event_tick()
    iaa.owner.current_tick = 14
    iaa.event_tick()
    return iaa