程序员的量化交易之路(29)--Cointrader之Tick实体(16)
来源:互联网 发布:java自行车是高端的吗 编辑:程序博客网 时间:2024/05/01 13:16
转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrade.top
Tick:什么是Tick,在交易平台中非常常见,其实就 单笔交易时某只证券的基本数据。
我们通过代码来学习吧:
package org.cryptocoinpartners.schema;import javax.annotation.Nullable;import javax.persistence.Entity;import javax.persistence.ManyToOne;import javax.persistence.Transient;import org.joda.time.Instant;/** * A Tick is a point-in-time snapshot of a Market's last price, volume and most recent Book *一个Tick是某一时刻某个交易品的最新交易价格、量和最新的报价单列表 * @author Tim Olson */@Entity//在数据库中会创建数据表Tickpublic class Tick extends PriceData implements Spread {//继承自PriceData,一些市场的数据就包含了。 public Instant getStartInstant() { return startInstant; } @Transient public Instant getEndInstant() { return getTime(); } @ManyToOne public Book getLastBook() { return lastBook; } /** @return null if no book was found prior to the window */ @Override @Transient public @Nullable Offer getBestBid() { return lastBook == null ? null : lastBook.getBestBid(); } /** @return null if no book was found prior to the window */ @Override @Transient public @Nullable Offer getBestAsk() { return lastBook == null ? null : lastBook.getBestAsk(); } public Tick(Market market, Instant startInstant, Instant endInstant, @Nullable Long lastPriceCount, @Nullable Long volumeCount, Book lastBook) { super(endInstant, null, market, lastPriceCount, volumeCount); this.startInstant = startInstant; this.lastBook = lastBook; } @Override public String toString() { return String.format("Tick{%s last:%g@%g bid:%s ask:%s}", getMarket(), getVolumeAsDouble(), getPriceAsDouble(), getBestBid(), getBestAsk()); } // JPA protected Tick() { } protected void setStartInstant(Instant startInstant) { this.startInstant = startInstant; } protected void setLastBook(Book lastBook) { this.lastBook = lastBook; } private Instant startInstant; private Book lastBook;//报价单}
0 0
- 程序员的量化交易之路(29)--Cointrader之Tick实体(16)
- 程序员的量化交易之路(17)--Cointrader之Temporal实体(5)
- 程序员的量化交易之路(18)--Cointrader之Event实体(6)
- 程序员的量化交易之路(19)--Cointrader之Bar实体(7)
- 程序员的量化交易之路(20)--Cointrader之Assert实体(8)
- 程序员的量化交易之路(21)--Cointrader之Currency货币实体(9)
- 程序员的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)
- 程序员的量化交易之路(25)--Cointrader之MarketData市场数据实体(12)
- 程序员的量化交易之路(26)--Cointrader之Listing挂牌实体(13)
- 程序员的量化交易之路(28)--Cointrader之Offer报价实体(15)
- 程序员的量化交易之路(15)--Cointrader之EntityBase类(3)
- 程序员的量化交易之路(27)--Cointrader之PriceData价格数据(14)
- 程序员的量化交易之路(30)--Cointrader之ConfigUtil(17)
- 程序员的量化交易之路(31)--cointrader之Balance现金(18)
- 程序员的量化交易之路(13)--Cointrader类图(1)
- 程序员的量化交易之路(14)--Cointrader数据表(2)
- 程序员的量化交易之路(22)--Cointrader值货币集合Currencies(10)
- 程序员的量化交易之路(1)----规划开篇
- 在WebView加载页面时添加cookies
- [Unity实战]框选效果
- Longest Common Prefix
- 【JavaScript】复选框的全选、反选,判断哪些复选框被选中
- VC如何改变编辑框的背景颜色方法
- 程序员的量化交易之路(29)--Cointrader之Tick实体(16)
- linux-进程监控
- 黑马程序员_面向对象(1)
- C中的volatile用法
- 主流浏览器CSS3和HTML5兼容性详细清单
- 七月建博展你来不来,不来你亏了!
- Linux 下鼠标对应的文件
- 黑马程序员--关于一些错误的解决办法
- CSS3仿GooglePlay菜单