16 package emlab.gen.repository;
18 import org.springframework.data.neo4j.annotation.Query;
19 import org.springframework.data.neo4j.annotation.QueryType;
20 import org.springframework.data.neo4j.repository.GraphRepository;
21 import org.springframework.data.repository.query.Param;
22 import org.springframework.stereotype.Repository;
50 @Query(
"START bid=node:__types__(\"className:emlab.gen.domain.market.Bid\") WHERE (bid.time={time}) RETURN bid")
53 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) RETURN bid ORDER BY bid.price desc")
54 Iterable<Bid> findDemandBidsForMarketForTime(@Param(
"market")
DecarbonizationMarket market, @Param(
"time")
long time);
56 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) and (bid.status>=2) RETURN bid")
57 Iterable<Bid> findAllAcceptedDemandBidsForMarketForTime(@Param(
"market")
DecarbonizationMarket market,
58 @Param(
"time")
long time);
74 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) RETURN bid ORDER BY bid.price")
77 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) and (bid.status>=2) RETURN bid")
79 @Param(
"time")
long time);
91 @Query(value =
"g.v(market).in('BIDDINGMARKET').filter{it.time == time}.filter{it.supplyBid == isSupply}", type = QueryType.Gremlin)
93 @Param(
"isSupply")
boolean isSupply);
95 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) and (bid.price <= {price}) RETURN bid ORDER BY bid.price")
97 @Param(
"time")
long time, @Param(
"price")
double price);
108 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) and (bid.price >= {price}) RETURN bid ORDER BY bid.price desc")
110 @Param(
"time")
long time, @Param(
"price")
double price);
112 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) and (bid.price >= {price}) RETURN sum(bid.amount)")
114 @Param(
"time")
long time, @Param(
"price")
double price);
116 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) and (bid.price = {price}) RETURN bid ORDER BY bid.price desc")
118 @Param(
"time")
long time, @Param(
"price")
double price);
120 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) and (bid.price = {price}) RETURN bid ORDER BY bid.price desc")
122 @Param(
"time")
long time, @Param(
"price")
double price);
124 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) and (bid.price = {price}) RETURN sum(bid.amount)")
126 @Param(
"time")
long time, @Param(
"price")
double price);
128 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) RETURN sum(bid.amount)")
129 double calculateTotalDemandForMarketForTime(@Param(
"market")
DecarbonizationMarket market, @Param(
"time")
long time);
131 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=false) and (bid.price >= {price}) RETURN sum(bid.amount)")
133 @Param(
"time")
long time, @Param(
"price")
double price);
135 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) RETURN sum(bid.amount)")
136 double calculateTotalSupplyForMarketForTime(@Param(
"market")
DecarbonizationMarket market, @Param(
"time")
long time);
138 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) RETURN max(bid.price)")
140 @Param(
"time")
long time);
142 @Query(
"START market=node({market}) MATCH (market)<-[:BIDDINGMARKET]-(bid) WHERE (bid.time = {time}) and (bid.supplyBid=true) RETURN min(bid.price)")
144 @Param(
"time")
long time);
Iterable< Bid > findAllBidsForForTime(@Param("time") long time)
Iterable< Bid > findOffersForMarketForTime(@Param("market") DecarbonizationMarket market,@Param("time") long time)
Iterable< Bid > getBidsForMarketForTime(@Param("market") DecarbonizationMarket market,@Param("time") long time,@Param("isSupply") boolean isSupply)
Iterable< Bid > findDemandBidsForMarketForTimeAbovePrice(@Param("market") DecarbonizationMarket market,@Param("time") long time,@Param("price") double price)