程序猿的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)
转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrader.top/
在量化交易系统中。有些事件是远端传来的,比方股票的价格数据等。所以,在这一节我们定义了一个远端事件实体。
它是一个基类。并不单独生成数据表。
详细代码例如以下:
package org.cryptocoinpartners.schema; import javax.annotation.Nullable;
import javax.persistence.Basic;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient; import org.hibernate.annotations.Type;
import org.joda.time.Instant; @MappedSuperclass
public abstract class RemoteEvent extends Event { /**
* @return the time when this event object was created. it may be later than getTime() due to transmission delays
*/
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentInstantAsMillisLong")
@Basic(optional = false)
public Instant getTimeReceived() {
return timeReceived;
} @Transient
public long getTimestampReceived() {
return timestampReceived;
} @Basic(optional = true)
public String getRemoteKey() {
return remoteKey;
} @Override
public void publishedAt(Instant instant) {
super.publishedAt(instant);
if (timeReceived == null)
timeReceived = instant;
this.timestampReceived = timeReceived.getMillis(); } protected RemoteEvent(Instant time, @Nullable String remoteKey) {
this(time, Instant.now(), remoteKey);
} protected RemoteEvent(Instant time, Instant timeReceived, @Nullable String remoteKey) {
super(time);
this.remoteKey = remoteKey;
this.timeReceived = timeReceived;
this.timestampReceived = timeReceived.getMillis();
} // JPA
protected RemoteEvent() {
} protected void setTimeReceived(Instant timeReceived) {
this.timeReceived = timeReceived;
this.timestampReceived = timeReceived.getMillis();
} protected void setRemoteKey(@Nullable String remoteKey) {
this.remoteKey = remoteKey;
} private Instant timeReceived;
private long timestampReceived;
private String remoteKey;
}
程序猿的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)的更多相关文章
- 程序猿的量化交易之路(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 ...
- 程序猿的量化交易之路(29)--Cointrader之Tick实体(16)
转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrade.top Tick:什么是Tick,在交易平台中很常见,事实上就 单笔交易时某仅仅证券 ...
- 程序猿的量化交易之路(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中基本实体 ...
随机推荐
- Mybatis注解的使用
一.mybatis 简单注解 关键注解词 : @Insert : 插入sql , 和xml insert sql语法完全一样 @Select : 查询sql, 和xml select sql语法完全一 ...
- 调试钩取技术 - 记事本WriteFile() API钩取
@author: dlive 0x01 简介 本章将讲解前面介绍过的调试钩取技术,钩取记事本的kernel32!WriteFile() API 调试钩取技术能进行与用户更具有交互性(interacti ...
- fatal error LNK1104: 无法打开文件“LIBC.lib”错误(转)
原文转自 http://blog.csdn.net/qq1028850792/article/details/41546043 方法一: 用VS2005重新编译某个工程的发生了链接错误,现在把这个解决 ...
- Cocoa Pods 'No such file or Directory' Error
http://stackoverflow.com/questions/27727998/cocoa-pods-no-such-file-or-directory-error 0down votefav ...
- urb数据结构【转】
转自:http://blog.csdn.net/myarrow/article/details/7025065 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 一 transf ...
- Java错误随手记
一.Eclipse启动时提示: An internal error occurred during: "Initializing Java Tooling" 1.关闭Eclipse ...
- AC日记——The Meeting Place Cannot Be Changed codeforces 780b
780B - The Meeting Place Cannot Be Changed 思路: 二分答案: 代码: #include <cstdio> #include <cstrin ...
- spring jpa data笔记
tomcat启动Maven项目的时候总抛出这样的错误: Error creating bean with name 'org.springframework.boot.autoconfigure.or ...
- Tarjan缩点+LCA【p2783】有机化学之神偶尔会做作弊
Description 你翻到那一题:给定一个烃,只含有单键(给初中生的一个理解性解释:就是一堆碳用横线连起来,横线都是单条的). 然后炎魔之王拉格纳罗斯用他的火焰净化了一切环(???).所有的环状碳 ...
- 差分【p3948】 数据结构
顾z 你没有发现两个字里的blog都不一样嘛 qwq 题目描述-->p3948 数据结构 分析 其实这题完全没有分析的 qwq. 只是因为写了差分数组相关知识,所以顺便写一下题解 qwq. 对于 ...