本文整理了Java中co.vaughnvernon.tradercommon.quote.Quote.<init>
方法的一些代码示例,展示了Quote.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quote.<init>
方法的具体详情如下:
包路径:co.vaughnvernon.tradercommon.quote.Quote
类名称:Quote
方法名:<init>
暂无
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public Quote withUpdatedPrice(Money aPrice) {
return new Quote(this.tickerSymbol(), aPrice);
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public void createAlgoBuyOrder(
String anOrderId,
String aSymbol,
Money aPrice,
int aQuantity) {
AlgoOrder algoOrder =
new AlgoOrder(
anOrderId,
OrderType.Buy,
new Quote(
new TickerSymbol(aSymbol),
aPrice,
aQuantity));
this.algoOrderRepository().save(algoOrder);
}
代码示例来源: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 testQuoteCopy() throws Exception {
Quote quote = new Quote(new TickerSymbol("GOOG"), new Money("723.41"));
Quote quoteCopy = new Quote(quote);
assertEquals(quote, quoteCopy);
assertNotSame(quote, quoteCopy);
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public void updateStreamingQuoteWith(QuoteBar aQuoteBar) {
StreamingQuote streamingQuote =
this.streamingQuoteRepository()
.streamingQuoteOfSymbol(aQuoteBar.symbol());
if (streamingQuote == null) {
streamingQuote =
new StreamingQuote(
new Quote(
new TickerSymbol(aQuoteBar.symbol()),
aQuoteBar.price()));
} else {
streamingQuote.updateWith(aQuoteBar.price());
}
this.streamingQuoteRepository().save(streamingQuote);
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder buyOrderFixture() {
return new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol(TICKER), PRICE),
NUMBER_OF_SHARES,
new Money("9.99"));
}
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder buyOrderFixture2() {
BuyOrder buyOrder = new BuyOrder(
AccountId.unique(),
new Quote(this.googTickerFixture(), new Money("730.89")),
5,
new Money("12.99"));
return buyOrder;
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder buyOrderFixture1() {
BuyOrder buyOrder = new BuyOrder(
AccountId.unique(),
new Quote(this.googTickerFixture(), new Money("731.30")),
2,
new Money("12.99"));
return buyOrder;
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder buyOrderFixture() {
BuyOrder buyOrder = new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol("GOOG"), new Money("731.30")),
2,
new Money("12.99"));
return buyOrder;
}
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder buyOrderFixture3() {
BuyOrder buyOrder = new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol("MSFT"), new Money("27.71")),
20,
new Money("12.99"));
return buyOrder;
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
@Override
protected void setUp() throws Exception {
this.algoOrderRepository = InMemoryAlgoOrderRepository.instance();
this.vwapAnalyticRepository = InMemoryVWAPAnalyticRepository.instance();
this.vwapTradingService =
new VWAPTradingService(
this.vwapAnalyticRepository,
this.algoOrderRepository);
VWAPAnalytic vwapAnalytic = this.vwapAnalyticAggregate();
this.vwapAnalyticRepository.save(vwapAnalytic);
this.algoOrder =
new AlgoOrder(
UUID.randomUUID().toString(),
OrderType.Buy,
new Quote(new TickerSymbol("ORCL"), new Money("32.50"), 700));
assertTrue(this.algoOrder.hasSharesRemaining());
this.algoOrderRepository.save(this.algoOrder);
super.setUp();
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public void testCreate() throws Exception {
AlgoOrder algoOrder =
new AlgoOrder(
UUID.randomUUID().toString().toUpperCase(),
OrderType.Buy,
new Quote(
new TickerSymbol("GOOG"),
new Money("725.50"),
500));
assertNotNull(algoOrder);
assertFalse(algoOrder.isFilled());
assertTrue(algoOrder.hasSharesRemaining());
assertEquals(new BigDecimal("500"), algoOrder.sharesRemaining());
try {
algoOrder.fill();
fail("Should not be filled and should throw exception.");
} catch (IllegalStateException e) {
// good, ignore
}
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
private BuyOrder[] buyOrderFixture() {
BuyOrder[] buyOrders = new BuyOrder[3];
buyOrders[0] =
new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol("GOOG"), new Money("720.43")),
5,
new Money("9.99"));
buyOrders[1] =
new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol("GOOG"), new Money("720.43")),
7,
new Money("9.99"));
buyOrders[2] =
new BuyOrder(
AccountId.unique(),
new Quote(new TickerSymbol("MSFT"), new Money("27.50")),
10,
new Money("9.99"));
return buyOrders;
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public void testQuotePrice() throws Exception {
Quote quote = new Quote(new TickerSymbol("GOOG"), new Money("723.41"));
assertEquals(quote.price(), new Money("723.41"));
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
public void testQuoteTickerSymbol() throws Exception {
Quote quote = new Quote(new TickerSymbol("GOOG"), new Money("723.41"));
assertEquals(quote.tickerSymbol(), new TickerSymbol("GOOG"));
}
代码示例来源:origin: VaughnVernon/IDDD_NYSE
UUID.randomUUID().toString().toUpperCase(),
OrderType.Buy,
new Quote(
new TickerSymbol("GOOG"),
new Money("725.50"),
代码示例来源: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
UUID.randomUUID().toString().toUpperCase(),
OrderType.Buy,
new Quote(
new TickerSymbol("GOOG"),
new Money("725.50"),
内容来源于网络,如有侵权,请联系作者删除!