程序猿的量化交易之路(29)--Cointrader之Tick实体(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//在数据库中会创建数据表Tick
public 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;//报价单
}
程序猿的量化交易之路(29)--Cointrader之Tick实体(16)的更多相关文章
- 程序猿的量化交易之路(13)--Cointrader类图(1)
转载须注明出处:http://blog.csdn.net/minimicall? viewmode=contents, htpp://cloudtrader.top 今天開始正式切入到Cointrad ...
- 程序猿的量化交易之路(20)--Cointrader之Assert实体(8)
转载需说明出处:http://blog.csdn.net/minimicall, http://cloudtrade.top 不论什么可交易的都能够称之为Assert,资产.其类代码例如以下: pac ...
- 程序猿的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)
转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrader.top/ 在量化交易系统中.有些事件是远端传来的,比方股票的价格数据等.所以,在这 ...
- 程序猿的量化交易之路(30)--Cointrader之ConfigUtil(17)
转载须注明出处:viewmode=contents">http://blog.csdn.net/minimicall?viewmode=contents.http://cloudtra ...
- 程序猿的量化交易之路(26)--Cointrader之Listing挂牌实体(13)
转载须注明出处:http://blog.csdn.net/minimicall? viewmode=contents,http://cloudtrade.top Listing:挂牌. 比方某仅仅股票 ...
- 程序猿的量化交易之路(32)--Cointrade之Portfolio组合(19)
转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ Portfolio:组合,代表的是多个 ...
- 程序猿的量化交易之路(27)--Cointrader之PriceData价格数据(14)
转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ PriceData:价格数据.价格数据 ...
- 程序猿的量化交易之路(18)--Cointrader之Event实体(6)
转载需注明: 事件,是Esper的重要概念. 这里我们定义个事件类.它是Temporal实体的派生类. 不过对Temporal简单的包装.其代码例如以下: package org.cryptocoin ...
- 程序猿的量化交易之路(21)--Cointrader之Currency货币实体(9)
转载须注明出自:http://blog.csdn.net/minimicall? viewmode=contents,http://cloudtrader.top 货币,Cointrader中基本实体 ...
随机推荐
- wince下GetManifestResourceStream得到的Stream是null的解决
问题的引入 在编程过程中遇到下面这样一个问题: 有这样一个方法: public static AlphaImage CreateFromResource(string imageResourceNam ...
- GitLab 之 Linux十分钟快装
原文链接:http://www.cnblogs.com/highsea90/p/5191340.html 先把 Shell 命令贴出来,楼主以 CentOS release 6.5 (Final) 6 ...
- MSSQL - 备份和还原数据库
SQL语句备份和还原数据库:http://blog.csdn.net/liuhelong/article/details/3335687 1.MSSQL - SqlServer:此数据库处于单用户模式 ...
- xcode APP 打包以及提交apple审核详细流程(新版本更新提交审核)
链接地址:http://blog.csdn.net/mad1989/article/details/8167529 打包发布APP流程真机测试和APP发布流程APP提交审核流程真机测试打包发布上传出错 ...
- 王立平--eclipse向svnserver上传项目
1.team-->share project watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzQyNTUyNw==/font/5a6L5L2 ...
- 推荐国内外优秀+免费CDN加速站点及公共cdn加速库
-----------------------------------------------------------------免费CDN加速站点 1.CloudFlare CloudFlare可能 ...
- Android中贝塞尔曲线的绘制方法
贝塞尔曲线,很多人可能不太了解,什么叫做贝塞尔曲线呢?这里先做一下简单介绍:贝塞尔曲线也可以叫做贝济埃曲线或者贝兹曲线,它由线段与节点组成,节点是可拖动的支点,线段像可伸缩的皮筋.一般的矢量图形软件常 ...
- 《Java虚拟机原理图解》1.3、class文件里的訪问标志、类索引、父类索引、接口索引集合
讲完了class文件里的常量池,我们就相当于克服了class文件里最麻烦的模块了.如今,我们来看一下class文件里紧接着常量池后面的几个东西:訪问标志.类索引.父类索引.接口索引集合. 1. 訪问标 ...
- MSSQL - 因为数据库正在使用,所以无法获得对数据库的独占访问权。
关于“因为数据库正在使用,所以无法获得对数据库的独占访问权”的最终解决方案 今天在使用SQL Server2005对某个数据库进行还原操作的时候,出现了如上问题,“因为数据库正在使用,所以无法获得 ...
- PHP学习之-Mongodb在Windows下安装及配置
Mongodb在Windows下安装及配置 1.下载 下载地址:http://www.mongodb.org/ 建议下载zip版本. 2.安装 下载windows版本安装就和普通的软件一样,直接下一步 ...