Update exposed gotoNextTimeframe and overloaded enterAsk and enterBid
This commit is contained in:
@ -170,9 +170,10 @@ void MerkelMain::printWallet()
|
|||||||
std::cout << wallet.toString() << std::endl;
|
std::cout << wallet.toString() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerkelMain::gotoNextTimeframe()
|
void MerkelMain::gotoNextTimeframe(bool silent)
|
||||||
{
|
{
|
||||||
std::cout << "Going to next time frame. " << std::endl;
|
if(!silent)
|
||||||
|
std::cout << "Going to next time frame. " << std::endl;
|
||||||
for (std::string p : orderBook.getKnownProducts())
|
for (std::string p : orderBook.getKnownProducts())
|
||||||
{
|
{
|
||||||
std::cout << "matching " << p << std::endl;
|
std::cout << "matching " << p << std::endl;
|
||||||
@ -180,7 +181,8 @@ void MerkelMain::gotoNextTimeframe()
|
|||||||
std::cout << "Sales: " << sales.size() << std::endl;
|
std::cout << "Sales: " << sales.size() << std::endl;
|
||||||
for (OrderBookEntry &sale : sales)
|
for (OrderBookEntry &sale : sales)
|
||||||
{
|
{
|
||||||
std::cout << "Sale price: " << sale.price << " amount " << sale.amount << std::endl;
|
if(!silent)
|
||||||
|
std::cout << "Sale price: " << sale.price << " amount " << sale.amount << std::endl;
|
||||||
if (sale.username == "simuser")
|
if (sale.username == "simuser")
|
||||||
{
|
{
|
||||||
// update the wallet
|
// update the wallet
|
||||||
@ -238,7 +240,7 @@ void MerkelMain::processUserOption(int userOption)
|
|||||||
}
|
}
|
||||||
if (userOption == 6)
|
if (userOption == 6)
|
||||||
{
|
{
|
||||||
gotoNextTimeframe();
|
gotoNextTimeframe(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,22 +22,26 @@ public:
|
|||||||
/** returns a vector of all bids orders for the current time */
|
/** returns a vector of all bids orders for the current time */
|
||||||
std::vector<OrderBookEntry> getCurrentBids();
|
std::vector<OrderBookEntry> getCurrentBids();
|
||||||
|
|
||||||
void enterAsk();
|
/** matches bids and asks, proceeds to the next time frame */
|
||||||
|
void gotoNextTimeframe(bool silent);
|
||||||
|
void enterAsk(OrderBookEntry newAsk);
|
||||||
|
void enterBid(OrderBookEntry newBid);
|
||||||
private:
|
private:
|
||||||
void printMenu();
|
void printMenu();
|
||||||
void printHelp();
|
void printHelp();
|
||||||
void printMarketStats();
|
void printMarketStats();
|
||||||
|
void enterAsk();
|
||||||
void enterBid();
|
void enterBid();
|
||||||
void printWallet();
|
void printWallet();
|
||||||
void gotoNextTimeframe();
|
|
||||||
int getUserOption();
|
int getUserOption();
|
||||||
void init(); // initialization function for user interaction
|
void init(); // initialization function for user interaction
|
||||||
void processUserOption(int userOption);
|
void processUserOption(int userOption);
|
||||||
|
|
||||||
std::string currentTime;
|
std::string currentTime;
|
||||||
|
|
||||||
OrderBook orderBook{"20200317.csv"};
|
OrderBook orderBook{"../../../../111.csv"};
|
||||||
|
//OrderBook orderBook{"20200317.csv"};
|
||||||
//OrderBook orderBook{"20200601.csv"};
|
//OrderBook orderBook{"20200601.csv"};
|
||||||
Wallet wallet;
|
Wallet wallet;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user