Example #1
0
 def serializable_dict(self):
     return {
         "type": "Offer",
         "id": self.id,
         "energy": self.energy,
         "energy_rate": self.energy_rate,
         "seller": self.seller,
         "seller_origin": self.seller_origin,
         "time": datetime_to_string_incl_seconds(self.time)
     }
Example #2
0
 def serializable_dict(self) -> Dict:
     return {
         "type": self.__class__.__name__,
         "id": self.id,
         "energy": self.energy,
         "energy_rate": self.energy_rate,
         "time": datetime_to_string_incl_seconds(self.time),
         "attributes": self.attributes,
         "requirements": self.requirements
     }
Example #3
0
 def serializable_dict(self):
     return {
         "type": "Bid",
         "id": self.id,
         "price": self.price,
         "energy": self.energy,
         "energy_rate": self.energy_rate,
         "buyer": self.buyer,
         "buyer_origin": self.buyer_origin,
         "time": datetime_to_string_incl_seconds(self.time)
     }
Example #4
0
 def serializable_dict(self):
     return {
         "type": "Trade",
         "id": self.id,
         "offer_bid_id": self.offer.id,
         "residual_id":
         self.residual.id if self.residual is not None else None,
         "energy": self.offer.energy,
         "energy_rate": self.offer.energy_rate,
         "buyer": self.buyer,
         "buyer_origin": self.buyer_origin,
         "seller_origin": self.seller_origin,
         "seller": self.seller,
         "fee_price": self.fee_price,
         "time": datetime_to_string_incl_seconds(self.time)
     }