程序猿的量化交易之路(29)–Cointrader之Tick实体(16)[通俗易懂]

程序猿的量化交易之路(29)–Cointrader之Tick实体(16)

大家好,又见面了,我是全栈君。

转载需注明出处: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;//报价单}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/116329.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Excel中VBA编程学习笔记(一)「建议收藏」

    Excel中VBA编程学习笔记(一)「建议收藏」1、注释及编码规则注释:单引号:可以位于句子结尾或者单独一行; Rem:单独一行 编码规则:如果VB中的关键字是由多个英文字母组成,则系统自动将每个单词的首字母转换成大写字母,其余字母一律转换成小写字母。 对于用户自定义的变量名、过程名、函数名,VB以第一次定义的为准,以后输入的自动转换成首次的形式。 如果在同一行写多条语句,语句间要用冒号“:”隔开。例如:Form1…

    2022年6月1日
    124
  • 海思hi3516ev100开发板_海思V200

    海思hi3516ev100开发板_海思V2001安装ubunu14我的ubuntu14如下#uname-aLinuxubuntu4.4.0-142-generic#168~14.04.1-UbuntuSMPSatJan1911:26:28UTC2019x86_64x86_64x86_64GNU/Linux2软件包安装步骤1.配置默认使用bash执行sudodpkg-recon…

    2022年9月23日
    0
  • 在form里面,放了四个UEditor,怎么在后台分别获取它们值

    在form里面,放了四个UEditor,怎么在后台分别获取它们值

    2021年9月18日
    56
  • 雷电模拟器opengl版本过低_tx模拟器安卓

    雷电模拟器opengl版本过低_tx模拟器安卓上图说明你的显卡暂不支持模拟器,遇到这个问题,主要是3种原因:1、你的电脑没有显卡解决方案:这个问题若不换电脑硬件是暂时无解的,只能等待我们模拟器支持集成显卡了2、你的电脑显卡确实不支持OpenGL2.0解决方案:这个问题只能通过更换显卡来解决了上图说明你的显卡暂不支持模拟器,遇到这个问题,主要是3种原因:1、你的电脑没有显卡解决方案:这个问题若不换电脑硬件是暂时无解的,只能等待我们模拟器…

    2022年10月8日
    0
  • 正确解决 Invalid module format[通俗易懂]

    正确解决 Invalid module format[通俗易懂]原言 http://blog.csdn.net/dreamtdp/article/details/8036419实现 功能:在PC的LINUX实现驱动测试,不用在2440上测试解决insmod:errorinserting’hello.ko’:-1Invalidmoduleformat第一次写Linux驱动,环境搭建了好久,第一次可能是由于GCC的版本问题,编译

    2022年8月28日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号