程序猿的量化交易之路(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中基本实体 ...
随机推荐
- 读入输出优化_C++
当我们考试时遇到大量的读入或者输出时,这些代码会耗费许多运行程序的时间,导致TL 本来 log2n 的算法因为读入被卡成线性的就太不划算了,所以我们这里要采用读入输出优化 getchar 和 putc ...
- How to Use Instruments in Xcode
http://blog.csdn.net/woaifen3344/article/details/40748075 This is a blog post by iOS Tutorial Team m ...
- C语言高级应用---操作linux下V4L2摄像头应用程序【转】
转自:http://blog.csdn.net/morixinguan/article/details/51001713 版权声明:本文为博主原创文章,如有需要,请注明转载地址:http://blog ...
- MongoDB中$redact操作符的使用
介绍 redact <- redaction 修订/校验,意思是对文档内容进行过滤,选择一些过滤或保留的信息 . access level 存取等级 有三种: - $$DESCEND 返回当前等 ...
- 钩子注入呼出与隐藏DLL窗口
/ MFC_DLL.cpp : 定义 DLL 的初始化例程. // #include "stdafx.h" #include "MFC_DLL.h" #incl ...
- J.U.C并发框架源码阅读(四)CountDownLatch
基于版本jdk1.7.0_80 java.util.concurrent.CountDownLatch 代码如下 /* * ORACLE PROPRIETARY/CONFIDENTIAL. Use i ...
- ()java jdbc连接
测试使用 jdk-8u191-windows-x64.mysql-8.0.12-winx64.mysql-connector-java-8.0.13.jar 查询 import java.sql.*; ...
- Wannafly挑战赛10 D 小H的询问(线段树)
题目链接 Problem D 这个题类似 SPOJ GSS3 做过那个题之后其实就可以秒掉这题了. 考虑当前线段树维护的结点 在那道题的基础上,这个题要多维护几个东西,大概就是左端点的奇偶性,右端点 ...
- localize by triangle note
1.当拟合结果不为1时,取和上次相近的作为结果2.python画三角拟合图bug (3.减小三角拟合波动:对激光雷达数据进行滤波等处理)(4.在计算三角起始和结束位置时,添加用距离值过滤) theta ...
- RTU模式与ASCII模式有什么不同
所有设备必须必须实现 RTU 模式.ASCII 传输模式是选项,即默认设置必须为 RTU 模式. 当设备使用RTU (Remote Terminal Unit) 模式在 Modbus 串行链路通信, ...