Update implemented new version of stringsToOBE
This commit is contained in:
@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user