转载需注明出处:http://blog.csdn.net/minimicallhttp://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)的更多相关文章

  1. 程序猿的量化交易之路(13)--Cointrader类图(1)

    转载须注明出处:http://blog.csdn.net/minimicall? viewmode=contents, htpp://cloudtrader.top 今天開始正式切入到Cointrad ...

  2. 程序猿的量化交易之路(20)--Cointrader之Assert实体(8)

    转载需说明出处:http://blog.csdn.net/minimicall, http://cloudtrade.top 不论什么可交易的都能够称之为Assert,资产.其类代码例如以下: pac ...

  3. 程序猿的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)

    转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrader.top/ 在量化交易系统中.有些事件是远端传来的,比方股票的价格数据等.所以,在这 ...

  4. 程序猿的量化交易之路(30)--Cointrader之ConfigUtil(17)

    转载须注明出处:viewmode=contents">http://blog.csdn.net/minimicall?viewmode=contents.http://cloudtra ...

  5. 程序猿的量化交易之路(26)--Cointrader之Listing挂牌实体(13)

    转载须注明出处:http://blog.csdn.net/minimicall? viewmode=contents,http://cloudtrade.top Listing:挂牌. 比方某仅仅股票 ...

  6. 程序猿的量化交易之路(32)--Cointrade之Portfolio组合(19)

    转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ Portfolio:组合,代表的是多个 ...

  7. 程序猿的量化交易之路(27)--Cointrader之PriceData价格数据(14)

    转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ PriceData:价格数据.价格数据 ...

  8. 程序猿的量化交易之路(18)--Cointrader之Event实体(6)

    转载需注明: 事件,是Esper的重要概念. 这里我们定义个事件类.它是Temporal实体的派生类. 不过对Temporal简单的包装.其代码例如以下: package org.cryptocoin ...

  9. 程序猿的量化交易之路(21)--Cointrader之Currency货币实体(9)

    转载须注明出自:http://blog.csdn.net/minimicall? viewmode=contents,http://cloudtrader.top 货币,Cointrader中基本实体 ...

随机推荐

  1. 基于visual Studio2013解决C语言竞赛题之0801信息输出

     题目

  2. 浙江大学PAT上机题解析之3-05. 求链式线性表的倒数第K项

    给定一系列正整数,请设计一个尽可能高效的算法,查找倒数第K个位置上的数字. 输入格式说明: 输入首先给出一个正整数K,随后是若干正整数,最后以一个负整数表示结尾(该负数不算在序列内,不要处理). 输出 ...

  3. iostat查看io情况(监控Linux的8种方式)

    查看TPS和吞吐量信息[root@controller ~]#iostat -d -k 1 10Device:         tps    kB_read/s    kB_wrtn/s    kB_ ...

  4. SharePoint 2013的100个新功能之搜索(二)

    一:名称建议 人员搜索中新的“名称建议”功能,微软引入了一种简单.直观的方式来根据名称找到用户.输入一个或多个字符,查看全部以其开头的名称,在所有的用户描述数据库都可用,在人员索引中也因此一样可用.该 ...

  5. 基于visual Studio2013解决C语言竞赛题之1043求末尾0个数

       题目 解决代码及点评 /* 43. 求n!的末尾有多少个零.可以通过检查n!含有多少个10的因数来求它末尾零的个数. 因为10=2×5,在n!中含有2的因数显然多于含有5的因数. 一 ...

  6. hihocoder1302 最长回文子串

    hihocoder1302 最长回文子串 先贴代码 所有的上面的提示已经交代的好清楚了…… #include <iostream> #include <cstring> #in ...

  7. Linux下sed,awk,grep,cut,find学习笔记

    awk awk是一种程序语言,对文档资料的处理具有很强的功能.awk擅长从格式化报文或从一个大的文本文件中抽取数据. awk的命令格式为: awk [-F filed-separator] “comm ...

  8. vim的ex模式用法

    本文出自   http://blog.csdn.net/shuangde800 本文是在学习<使用vi编辑器, Lamb & Robbins编著>时在evernote写的其中一章笔 ...

  9. gdb 远程qemu-arm调试

    把 c 编译成 arm 指令的可运行文件 /usr/bin/arm-linux-gnueabi-g++ hello.cpp cat hello.cpp #include <stdio.h> ...

  10. 来推荐个免费的PPT演示工具--ZohoShowTime

    事实上这个不算新产品了,这次是做了一些大的改进.上次在Zoho的全球用户大会上,全程演讲都是用的这个工具.Zoho这点非常好啊.自己的产品自己带头用.个人认为它最大的用处就是.离得远的观众能够在自己的 ...