本文整理汇总了C++中Stock::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Stock::name方法的具体用法?C++ Stock::name怎么用?C++ Stock::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stock
的用法示例。
在下文中一共展示了Stock::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: market_code
HKU_API std::ostream & operator<<(std::ostream& os, const TradeRecord& record) {
Stock stock = record.stock;
string market_code(""), name("");
if(!stock.isNull()){
market_code = stock.market_code();
#if defined(BOOST_WINDOWS) && (PY_VERSION_HEX >= 0x03000000)
name = utf8_to_gb(stock.name());
#else
name = stock.name();
#endif
}
string strip(", ");
os << std::fixed;
os.precision(4);
os << "Trade(" << record.datetime << strip << market_code
<< strip << name << strip << getBusinessName(record.business)
<< strip << record.planPrice << strip << record.realPrice;
if (record.goalPrice == Null<price_t>()) {
os << strip << "NULL";
} else {
os << strip << record.goalPrice;
}
os << strip << record.number << strip << record.cost.commission
<< strip << record.cost.stamptax << strip << record.cost.transferfee
<< strip << record.cost.others << strip << record.cost.total
<< strip << record.stoploss << strip << record.cash
<< strip << getSystemPartName(record.from) << ")";
os.unsetf(std::ostream::floatfield);
os.precision();
return os;
}
示例2: market
HKU_API std::ostream & operator<<(std::ostream& os, const PositionRecord& record) {
Stock stock = record.stock;
int precision = 2;
std::string market(""), code(""), name("");
if(!stock.isNull()){
market = stock.market();
code = stock.code();
#if defined(BOOST_WINDOWS) && (PY_VERSION_HEX >= 0x03000000)
name = utf8_to_gb(stock.name());
#else
name = stock.name();
#endif
} else {
precision = stock.precision();
}
price_t costPrice = 0.0;
if (record.number != 0.0) {
costPrice = roundEx((record.buyMoney - record.sellMoney)
/ record.number, precision);
}
string strip(", ");
os << std::fixed;
os.precision(precision);
os << "Position(" << market
<< strip << code
<< strip << name
<< strip << record.takeDatetime
<< strip << record.cleanDatetime
<< strip << record.number
<< strip << costPrice
<< strip << record.stoploss
<< strip << record.goalPrice
<< strip << record.totalNumber
<< strip << record.buyMoney
<< strip << record.totalCost
<< strip << record.totalRisk
<< strip << record.sellMoney << ")";
os.unsetf(std::ostream::floatfield);
os.precision();
return os;
}