Update implemented new version of stringsToOBE

This commit is contained in:
Lev
2021-06-11 13:54:42 -05:00
parent e4df71bcce
commit f00082fdac

View File

@ -63,8 +63,8 @@ OrderBookEntry CSVReader::stringsToOBE(std::vector<std::string> tokens)
price = std::stod(tokens[3]);
amount = std::stod(tokens[4]);
}catch(const std::exception& e){
std::cout << "Bad float! " << tokens[3]<< std::endl;
std::cout << "Bad float! " << tokens[4]<< std::endl;
std::cout << "CSVReader::stringsToOBE Bad float! " << tokens[3]<< std::endl;
std::cout << "CSVReader::stringsToOBE Bad float! " << tokens[4]<< std::endl;
throw;
}
@ -77,3 +77,30 @@ OrderBookEntry CSVReader::stringsToOBE(std::vector<std::string> tokens)
return obe;
}
OrderBookEntry CSVReader::stringsToOBE(std::string priceString,
std::string amountString,
std::string timestamp,
std::string product,
OrderBookType orderType)
{
double price, amount;
try
{
price = std::stod(priceString);
amount = std::stod(amountString);
}
catch(const std::exception& e)
{
std::cout << "CSVReader::stringsToOBE Bad float!" << priceString << std::endl;
std::cout << "CSVReader::stringsToOBE Bad float!" << amountString << std::endl;
throw;
}
OrderBookEntry obe{price,
amount,
timestamp,
product,
orderType};
return obe;
}