23#include <entt/entt.hpp>
50 using std::vector<Order>::vector;
68 std::map<entt::entity, DescendingSortedOrderList>
sell_orders;
69 std::map<entt::entity, AscendingSortedOrderList>
buy_orders;
78 for (
const Order& order : buy_list) {
79 demand += order.quantity;
87 for (
const Order& order : sell_list) {
88 supply += order.quantity;
void put(const Order &order)
Definition: auction.h:51
SortedOrderList< std::less< Order > > AscendingSortedOrderList
Smallest to greatest
Definition: auction.h:65
bool operator>(const Order &lhs, const Order &rhs)
Definition: auction.h:45
bool operator<(const Order &lhs, const Order &rhs)
Definition: auction.h:43
SortedOrderList< std::greater< Order > > DescendingSortedOrderList
Greatest to smallest
Definition: auction.h:60
double GetDemand(entt::entity good)
Definition: auction.h:75
double GetSupply(entt::entity good)
Definition: auction.h:84
std::map< entt::entity, DescendingSortedOrderList > sell_orders
Definition: auction.h:68
void AddBuyOrder(entt::entity good, Order &&order)
Definition: auction.h:73
std::map< entt::entity, AscendingSortedOrderList > buy_orders
Definition: auction.h:69
void AddSellOrder(entt::entity good, Order &&order)
Definition: auction.h:71
double quantity
Definition: auction.h:34
double price
Price per unit
Definition: auction.h:33
entt::entity agent
The agent that owns this order. Goods sold will go to the agent, money recieved will also go to the a...
Definition: auction.h:40
Order(double price, double quantity, entt::entity agent)
Definition: auction.h:28
Order()
Definition: auction.h:27