标签:imp sel 实体 lis tran entity protected ice ons
转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/
Offer:报价。
bid:买方报价
ask:卖方报价
非常easy的一个类。是PriceData的子类。还记得PriceData有什么吧。
时间戳、量、价,
而PriceData又是MarketData的子类,MarketData封装了Market。Market包括市场数据。Exchange,Listing,priceBasis。volumeBasis等。
package org.cryptocoinpartners.schema; import org.joda.time.Instant; import javax.persistence.Entity; import javax.persistence.Transient; /** * Offers represent a bid or ask, usually from a Book. Asks are represented by using a negative volumeCount * * @author Tim Olson */ @Entity public class Offer extends PriceData { /** same as new Offer() */ public static Offer bid(Market market, Instant time, Instant timeReceived, Long priceCount, Long volumeCount) { return new Offer( market, time, timeReceived, priceCount, volumeCount ); } /** same as new Offer() except the volumeCount is negated */ public static Offer ask(Market market, Instant time, Instant timeReceived, Long priceCount, Long volumeCount) { return new Offer( market, time, timeReceived, priceCount, -volumeCount ); } public Offer(Market market, Instant time, Instant timeReceived, Long priceCount, Long volumeCount) { super(time, timeReceived, null, market, priceCount, volumeCount); } @Override public String toString() { return "Offer{" + ", market=" + getMarket() + ", priceCount=" + getPriceCount() + ", volumeCount=" + getVolumeCount() + ‘}‘; } @SuppressWarnings("ConstantConditions") @Transient public Side getSide() { return getVolumeCount() >= 0 ? Side.BUY : Side.SELL; } // JPA protected Offer() {} }
程序猿的量化交易之路(28)--Cointrader之Offer报价实体(15)
标签:imp sel 实体 lis tran entity protected ice ons
原文地址:http://www.cnblogs.com/ljbguanli/p/6816708.html