co.vaughnvernon.tradercommon.quote.Quote.valueOfPricedShares()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中co.vaughnvernon.tradercommon.quote.Quote.valueOfPricedShares方法的一些代码示例,展示了Quote.valueOfPricedShares的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quote.valueOfPricedShares方法的具体详情如下:
包路径:co.vaughnvernon.tradercommon.quote.Quote
类名称:Quote
方法名:valueOfPricedShares

Quote.valueOfPricedShares介绍

暂无

代码示例

代码示例来源:origin: VaughnVernon/IDDD_NYSE

public Money valueOfOrderedShares() {
  return this.quote().valueOfPricedShares(this.quantityOfSharesOrdered());
}

代码示例来源:origin: VaughnVernon/IDDD_NYSE

public BuyOrder placeBuyOrder(
    TickerSymbol aTickerSymbol,
    Money aPrice,
    int aNumberOfShares,
    Money anOrderFee) {
  Quote quote = new Quote(aTickerSymbol, aPrice);
  Money totalCost = anOrderFee.addedTo(quote.valueOfPricedShares(aNumberOfShares));
  if (totalCost.isGreaterThan(this.cashBalance())) {
    // TODO: Charge credit card for order
    throw new IllegalStateException("Cash balance is too low for this buy order.");
  }
  return new BuyOrder(
      this.accountId(),
      quote,
      aNumberOfShares,
      anOrderFee);
}

代码示例来源:origin: VaughnVernon/IDDD_NYSE

public void testValueOfPricedShares() throws Exception {
    Quote quote = new Quote(new TickerSymbol("GOOG"), new Money("723.41"));

    assertEquals(new Money("2893.64"), quote.valueOfPricedShares(4));

    assertEquals(quote.price().multipliedBy(4), quote.valueOfPricedShares(4));
  }
}

代码示例来源:origin: VaughnVernon/IDDD_NYSE

public Holding holdingOfFilledOrder() {
  if (!this.isFilled()) {
    throw new IllegalStateException("Order must be filled before Holding can be queried.");
  }
  Holding holding = this.holding;
  if (holding == null) {
    int sharesOrdered = this.execution().quantityOfSharesOrdered();
    Money totalValue = this.quote().valueOfPricedShares(sharesOrdered);
    holding = new Holding(
          this.accountId(),
          this.orderId(),
          this.quote().tickerSymbol(),
          sharesOrdered,
          totalValue,
          this.execution().filledDate());
    this.setHolding(holding);
  }
  return holding;
}

相关文章