Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. std::string OptimalRates::getAskChain(Currency from, Currency to)
  2. {
  3.     size_t i = m_indexes[from];
  4.     size_t j = m_indexes[to];
  5.     size_t m = m_hop_number - 1;
  6.  
  7.     std::ostringstream oss;
  8.  
  9.     PDEBUG("XXX: Find bid chain from " << i << " to " << j);
  10.  
  11.     if (m_rates[m][i][j].isEmpty()) {
  12.         PDEBUG("XXX: There is no path");
  13.         return std::string("No cross rate");
  14.     }
  15.  
  16.     size_t child = i;
  17.     PDEBUG("XXX: child " << child);
  18.  
  19.     while (m >= 0 && m < m_hop_number) {
  20.         if (m_children[m][child][j].getValue() != child) {
  21.             oss << m_currencies[child] << "-";
  22.         }
  23.  
  24.         child = m_children[m--][child][j].getValue();
  25.         PDEBUG("XXX: child " << child);
  26.     }
  27.  
  28.     oss << m_currencies[child];
  29.  
  30.     return oss.str();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement