本文整理汇总了C++中price函数的典型用法代码示例。如果您正苦于以下问题:C++ price函数的具体用法?C++ price怎么用?C++ price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: market_history_record
market_history_record(price highest_bid = price(),
price lowest_ask = price(),
share_type volume = 0,
fc::optional<price> recent_average_price = fc::optional<price>())
: highest_bid(highest_bid),
lowest_ask(lowest_ask),
volume(volume),
recent_average_price(recent_average_price)
{}
示例2: market_history_record
market_history_record(price highest_bid = price(),
price lowest_ask = price(),
price opening_price = price(),
price closing_price = price(),
share_type volume = 0)
: highest_bid(highest_bid),
lowest_ask(lowest_ask),
opening_price(opening_price),
closing_price(closing_price),
volume(volume)
{}
示例3: price
int StaticHashTableBuilder::calcBestModulus (){
int bestPrice = price (1);
int bestMod = 1;
for (size_t i = 2; i < 3 * mHashes.size(); i++){
int p = price (i);
if (p < bestPrice){
bestPrice = p;
bestMod = i;
}
}
return bestMod;
}
示例4: main
int main(int argc, char **argv) {
parse_args(argc, argv);
float res = price(n);
printf("Price is: %f\n", res);
for (int i = 0; i < runs; i++) {
start_run();
res = price(n);
end_run();
printf("Price is: %f\n", res);
}
}
示例5: rate
void KEquityPriceUpdateDlg::storePrices()
{
// update the new prices into the equities
MyMoneyFile* file = MyMoneyFile::instance();
QList<MyMoneySecurity> equities = file->securityList();
QTreeWidgetItem* item = 0;
MyMoneyFileTransaction ft;
QString name;
try {
for (int i = 0; i < lvEquityList->invisibleRootItem()->childCount(); ++i) {
item = lvEquityList->invisibleRootItem()->child(i);
// turn on signals before we modify the last entry in the list
MyMoneyFile::instance()->blockSignals(i < lvEquityList->invisibleRootItem()->childCount() - 1);
MyMoneyMoney rate(item->text(PRICE_COL));
if (!rate.isZero()) {
QString id = item->text(ID_COL).toUtf8();
// if the ID has a space, then this is TWO ID's, so it's a currency quote
if (QString(id).contains(" ")) {
QStringList ids = id.split(' ', QString::SkipEmptyParts);
QString fromid = ids[0].toUtf8();
QString toid = ids[1].toUtf8();
name = QString("%1 --> %2").arg(fromid).arg(toid);
MyMoneyPrice price(fromid, toid, QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
file->addPrice(price);
} else
// otherwise, it's a security quote
{
MyMoneySecurity security = MyMoneyFile::instance()->security(id);
name = security.name();
MyMoneyPrice price(id, security.tradingCurrency(), QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
// TODO (Ace) Better handling of the case where there is already a price
// for this date. Currently, it just overrides the old value. Really it
// should check to see if the price is the same and prompt the user.
MyMoneyFile::instance()->addPrice(price);
}
}
}
ft.commit();
} catch (const MyMoneyException &) {
qDebug("Unable to add price information for %s", qPrintable(name));
}
}
示例6: simulation
double MUPD::calc_mu_per_d(
const SharedMember<Consumer::Differentiable> &con,
Member::Lock &lock,
id_t mkt_id,
const allocation &alloc,
const Bundle &b) const {
if (mkt_id == 0)
return con->d(b, money);
auto sim = simulation();
auto mkt = sim->market(mkt_id);
lock.add(mkt);
double mu = 0.0;
// Add together all of the marginal utilities weighted by the output level, since the market may
// produce more than one good, and quantities may not equal 1.
for (auto g : mkt->output_unit)
mu += g.second * con->d(b, g.first);
double q = alloc.quantity.count(mkt_id) ? alloc.quantity.at(mkt_id) : 0;
auto pricing = mkt->price(q);
lock.remove(mkt);
if (!pricing.feasible) {
throw market_exhausted_error(mkt_id);
}
return mu / pricing.marginal * price_ratio(mkt);
}
示例7: main
int main()
{
typedef float T;
double t(0),v(0);
{
std::vector<T> price (128000);
std::vector<T> strike (128000);
std::vector<T> rate (128000);
std::vector<T> time (128000);
std::vector<T> volatility(128000);
std::vector<T> call (128000);
std::vector<T> put (128000);
std::fill(price.begin(),price.end(),1.);
std::fill(strike.begin(),strike.end(),1.);
std::fill(rate.begin(),rate.end(),1.);
std::fill(time.begin(),time.end(),1.);
std::fill(volatility.begin(),volatility.end(),1.);
std::cout << "std::vector\n";
for(int k=0;k<100;++k)
{
nt2::tic();
for(std::size_t i=0;i<price.size();++i)
blackscholes( price[i], strike[i] , rate[i] , time[i] , volatility[i]
, call[i] , put[i]
);
t += nt2::toc(false);
}
std::cout << t/100 << "\n";
}
v = call();
std::cout << "Speed-up: " << t/v << "\n";
}
示例8: run
function run()
{
vars Price = series(price());
vars Trend = series(LowPass(Price,1000));
Stop = 100*PIP;
TakeProfit = 100*PIP;
if(valley(Trend)) {
//plotPriceProfile(50,0);
enterLong();
} else if(peak(Trend)) {
//plotPriceProfile(50,PMINUS);
enterShort();
}
PlotWidth = 1000;
PlotHeight1 = 320;
PlotScale = 4;
//plotDay(Equity,PDIFF);
//plotWeek(Equity,PDIFF);
//plotMonth(Equity,PDIFF);
//plotYear(Equity,PDIFF);
plotTradeProfile(50);
}
示例9: name
void MainWindow::populateStore()
{
int row = 0;
int i = 0;
for(auto item : store) {
QString name(item.first.c_str());
QString price(QString::number(item.second));
QPushButton *button = new QPushButton(name);
QLabel *label = new QLabel("$"+price);
button->setObjectName(name);
label->setObjectName(price);
shopSignalMapper->setMapping(button, name);
connect(button, SIGNAL(clicked()), shopSignalMapper, SLOT(map()));
label->setAlignment(Qt::AlignCenter);
ui->shopLayout->addWidget(button, row, i, Qt::AlignCenter);
ui->shopLayout->addWidget(label, row+1, i, Qt::AlignCenter);
QSize widgetSize(50, 50);
button->setFixedSize(widgetSize);
label->setFixedSize(widgetSize);
i++;
if(i == 9) {
i = 0;
row += 2;
}
}
}
示例10: run
function run()
{
BarPeriod = 240; // 4 hour bars
// calculate the buy/sell signal
vars Price = series(price());
vars DomPeriod = series(DominantPeriod(Price,30));
var LowPeriod = LowPass(DomPeriod,500);
vars HP = series(HighPass(Price,LowPeriod));
vars Signal = series(Fisher(HP,500));
var Threshold = 1.0;
// buy and sell
Stop = 4*ATR(100);
Trail = 4*ATR(100);
if(crossUnder(Signal,-Threshold))
enterLong();
else if(crossOver(Signal,Threshold))
enterShort();
// plot signals and thresholds
plot("DominantPeriod",LowPeriod,NEW,BLUE);
plot("Signal",Signal[0],NEW,RED);
plot("Threshold1",Threshold,0,BLACK);
plot("Threshold2",-Threshold,0,BLACK);
PlotWidth = 600;
PlotHeight1 = 300;
}
示例11: PyInt
void Contract::GetContractRow( PyPackedRow* into )
{
into->SetField( "contractID", new PyInt( contractID() ) );
into->SetField( "issuerID", new PyInt( issuerID() ) );
into->SetField( "issuerCorpID", new PyInt( issuerCorpID() ) );
into->SetField( "type", new PyInt( type() ) );
into->SetField( "availability", new PyInt( avail() ) );
into->SetField( "assigneeID", new PyInt( assigneeID() ) );
into->SetField( "numDays", new PyInt( 0 ) );
into->SetField( "startStationID", new PyInt( startStationID() ) );
into->SetField( "endStationID", new PyInt( endStationID() ) );
into->SetField( "startSolarSystemID", new PyInt( startSolarSystemID() ) );
into->SetField( "endSolarSystemID", new PyInt( endSolarSystemID() ) );
into->SetField( "startRegionID", new PyInt( startRegionID() ) );
into->SetField( "endRegionID", new PyInt( endRegionID() ) );
into->SetField( "price", new PyFloat( price() ) );
into->SetField( "reward", new PyFloat( reward() ) );
into->SetField( "collateral", new PyFloat( collateral() ) );
into->SetField( "title", new PyWString( title().c_str(), title().length() ) );
into->SetField( "description", new PyWString( description().c_str(), description().length() ) );
into->SetField( "forCorp", new PyBool( forCorp() ) );
into->SetField( "status", new PyInt( status() ) );
into->SetField( "acceptorID", new PyInt( acceptorID() ) );
into->SetField( "dateIssued", new PyLong( dateIssued() ) );
into->SetField( "dateExpired", new PyLong( dateExpired() ) );
into->SetField( "dateAccepted", new PyLong( dateAccepted() ) );
into->SetField( "dateCompleted", new PyLong( dateCompleted() ) );
into->SetField( "volume", new PyFloat( volume() ) );
into->SetField( "issuerAllianceID", new PyInt( issuerAllianceID() ) );
into->SetField( "issuerWalletKey", new PyInt( issuerWalletKey() ) );
into->SetField( "acceptorWalletKey", new PyInt( 0 ) );
into->SetField( "crateID", new PyInt( 0 ) );
}
示例12: upc
// Copy Constructor
Good::Good(const Good& other) {
upc(other._upc);
name(other._name);
price(other._price);
qtyNeeded(other._qtyNeeded);
taxed(other._taxed);
quantity(other._quantity);
}
示例13: main
int main(void){
int rep = 0;
for (scanf("%d", &rep); rep > 0; --rep){
double x;
scanf("%lf", &x);
printf("f(%.2lf) = %.2lf\n", x, price(x));
}
return 0;
}
示例14: makePrice
void makePrice(const QString& _currencyid, const QDate& _date, const MyMoneyMoney& _price )
{
MyMoneyFileTransaction ft;
MyMoneyFile* file = MyMoneyFile::instance();
MyMoneySecurity curr = file->currency(_currencyid);
MyMoneyPrice price(_currencyid, file->baseCurrency().id(), _date, _price, "test");
file->addPrice(price);
ft.commit();
}
示例15: upc
// operator=
Item& Item::operator=(const Item& RO){
upc(RO._upc);
name(RO._name);
price(RO._price);
quantity(RO._quantity);
taxed(RO._taxed);
qtyNeeded(RO._qtyNeeded);
return *this;
}