Update implemented simuser logs
This commit is contained in:
@ -81,8 +81,9 @@ void MerkelMain::enterAsk()
|
||||
tokens[2],
|
||||
currentTime,
|
||||
tokens[0],
|
||||
OrderBookType::ask
|
||||
OrderBookType::ask
|
||||
);
|
||||
obe.username = "simuser";
|
||||
if(wallet.canFulfillOrder(obe))
|
||||
{
|
||||
std::cout << "Wallet looks good. " << std::endl;
|
||||
@ -122,6 +123,7 @@ void MerkelMain::enterBid()
|
||||
tokens[0],
|
||||
OrderBookType::bid
|
||||
);
|
||||
obe.username = "simuser";
|
||||
if(wallet.canFulfillOrder(obe))
|
||||
{
|
||||
std::cout << "Wallet looks good. " << std::endl;
|
||||
|
||||
@ -134,9 +134,20 @@ std::vector<OrderBookEntry> OrderBook::matchAsksToBids(std::string product, std:
|
||||
if (bid.price >= ask.price)
|
||||
{
|
||||
std::cout << "bid price is right " << std::endl;
|
||||
// sale = new order()
|
||||
// sale.price = ask.price
|
||||
OrderBookEntry sale{ask.price, 0, timestamp, product, OrderBookType::sale};
|
||||
OrderBookEntry sale{ask.price, 0, timestamp, product, OrderBookType::asksale};
|
||||
OrderBookType type = OrderBookType::asksale;
|
||||
if(bid.username == "simuser")
|
||||
{
|
||||
sale.username = "simuser";
|
||||
sale.orderType = OrderBookType::bidsale;
|
||||
}
|
||||
if(ask.username == "simuser")
|
||||
{
|
||||
|
||||
sale.username = "simuser";
|
||||
sale.orderType = OrderBookType::asksale;
|
||||
}
|
||||
|
||||
// # now work out how much was sold and
|
||||
// # create new bids and asks covering
|
||||
// # anything that was not sold
|
||||
|
||||
@ -4,12 +4,14 @@ OrderBookEntry::OrderBookEntry( double _price,
|
||||
double _amount,
|
||||
std::string _timestamp,
|
||||
std::string _product,
|
||||
OrderBookType _orderType)
|
||||
OrderBookType _orderType,
|
||||
std::string _username)
|
||||
: price(_price),
|
||||
amount(_amount),
|
||||
timestamp(_timestamp),
|
||||
product(_product),
|
||||
orderType(_orderType)
|
||||
orderType(_orderType),
|
||||
username(_username)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
enum class OrderBookType{bid, ask, unknown, sale};
|
||||
enum class OrderBookType{bid, ask, unknown, asksale, bidsale};
|
||||
|
||||
class OrderBookEntry
|
||||
{
|
||||
@ -12,7 +12,8 @@ class OrderBookEntry
|
||||
double _amount,
|
||||
std::string _timestamp,
|
||||
std::string _product,
|
||||
OrderBookType _orderType);
|
||||
OrderBookType _orderType,
|
||||
std::string username = "dataset");
|
||||
|
||||
static OrderBookType stringToOrderBookType(std::string s);
|
||||
|
||||
@ -34,4 +35,5 @@ class OrderBookEntry
|
||||
std::string timestamp;
|
||||
std::string product;
|
||||
OrderBookType orderType;
|
||||
std::string username;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user