转载需注明出处: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. android handler looper thread

    在线程中调用包含创建handler方法的时候,会报错,提示: “need call Looper.prepare()” -- 在创建之前,调用Looper.prepare()方法来创建一个looper ...

  2. mysql字符串连接,重复等字符串函数总结

    mysql concat()函数 MySQL的concat函数可以连接一个或者多个字符串,如 select concat('10'); 输出 10 select concat('11','22','3 ...

  3. 数学之路-python计算实战(15)-机器视觉-滤波去噪(归一化块滤波)

    # -*- coding: utf-8 -*- #code:myhaspl@myhaspl.com #归一化块滤波 import cv2 import numpy as np fn="tes ...

  4. Android 应用程序签名

    本文主要介绍Android应用程序签名的相关理论知识以及怎样公布Android应用程序. 1.签名的概念 为大家所熟知的日常生活中的签名,它是代表某个人的特殊标记,用于唯一标识某个人.而Android ...

  5. PHP - 子类使用父类的构造函数

    /* * 子类使用父类中的构造方法. */ //父类方法 class Person { //父类中的构造方法 function __construct(){ echo '这是父类中的构造方法!'; } ...

  6. Tomcat 7最大并发连接数的正确修改方法(转)

    几乎所有的中文网页都介绍,要修改Tomcat的默认最大并发连接数,应该进行如下设置(实际上这些步骤是错误的): -------------------------------------------- ...

  7. fzu 1911 Construct a Matrix(矩阵快速幂+规律)

    题目链接:fzu 1911 Construct a Matrix 题目大意:给出n和m,f[i]为斐波那契数列,s[i]为斐波那契数列前i项的和.r = s[n] % m.构造一个r * r的矩阵,只 ...

  8. 基于visual Studio2013解决C语言竞赛题之1085相邻之和素数

        题目 解决代码及点评 /************************************************************************/ /* ...

  9. codility上的问题(18) Rho 2012

    从正整数1开始,产生一个数列,数列中的每个数是之前出现过的任意两个数的和(可以相等),问产生正整数A,需要的数列长度至少是多少?返回这样一个最短的序列. 例如A=42 可以这样[1, 2, 3, 6, ...

  10. 简易的sniffer程序

    真的非常简易,这个程序不过抓一些发送到本机的数据包,然后显示出来它们的一些信息罢了.      程序很easy!       #include <WinSock2.h> #include ...