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

置换矩阵、转置矩阵以及向量空间、子空间 置换矩阵、转置矩阵以及向量空间、子空间导读置换矩阵 导读 MIT矩阵分析课程之后的的二篇笔记。 阅读详情

转载须注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrade.top/

PriceData:价格数据。价格数据是市场数据的子类。

具体代码如下:

package org.cryptocoinpartners.schema;

import java.math.BigDecimal;

import javax.annotation.Nullable;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import org.joda.time.Instant;

/**
 * Superclass for any MarketData which contains a price and volume, such as an Offer or a Trade ???靠,这个有问题。不过整个平台的代码其实很垃圾。
 *
 * @author Tim Olson
 */
@MappedSuperclass
public abstract class PriceData extends MarketData {

    /**
     * @param time when the pricing event originally occured 
     * @param remoteKey the exchange's unique ID for the pricing event (to prevent duplicates)
     * @param market which Market this pricing is for
     * @param priceCount relative to the Market's quoteBasis
     * @param volumeCount relative to the Market's volumeBasis
     */
    public PriceData(Instant time, @Nullable String remoteKey, Market market, @Nullable Long priceCount, @Nullable Long volumeCount) {
        super(time, remoteKey, market);
        this.priceCount = priceCount;
        this.volumeCount = volumeCount;
    }

    public PriceData(Instant time, @Nullable String remoteKey, Market market, @Nullable BigDecimal price, @Nullable BigDecimal volume) {
        super(time, remoteKey, market);
        this.priceCount = DiscreteAmount.roundedCountForBasis(price, market.getPriceBasis());
        this.volumeCount = DiscreteAmount.roundedCountForBasis(volume, market.getVolumeBasis());
    }

    /**
     * @param time when the pricing event originally occured
     * @param remoteKey the exchange's unique ID for the pricing event (to prevent duplicates)
     * @param market which Market this pricing is for
     * @param priceCount relative to the Market's quoteBasis
     * @param volumeCount relative to the Market's volumeBasis
     */
    public PriceData(Instant time, Instant timeReceived, @Nullable String remoteKey, Market market, @Nullable Long priceCount, @Nullable Long volumeCount) {
        super(time, timeReceived, remoteKey, market);
        this.priceCount = priceCount;
        this.volumeCount = volumeCount;
    }

    public PriceData(Instant time, Instant timeReceived, @Nullable String remoteKey, Market market, @Nullable BigDecimal price, @Nullable BigDecimal volume) {
        super(time, timeReceived, remoteKey, market);
        this.priceCount = DiscreteAmount.roundedCountForBasis(price, market.getPriceBasis());
        this.volumeCount = DiscreteAmount.roundedCountForBasis(volume, market.getVolumeBasis());
    }

    public @Nullable
    Long getPriceCount() {
        return priceCount;
    }

    public @Nullable
    Long getVolumeCount() {
        return volumeCount;
    }

    @Transient
    @Nullable
    public DiscreteAmount getPrice() {
        if (priceCount == null)
            return null;
        if (price == null)
            price = new DiscreteAmount(priceCount, getMarket().getPriceBasis());
        return price;
    }

    @Transient
    @Nullable
    public Double getPriceAsDouble() {
        Amount price = getPrice();
        return price == null ? null : price.asDouble();
    }

    @Transient
    @Nullable
    public Double getPriceCountAsDouble() {
        Long price = getPriceCount();
        return price == null ? null : price.doubleValue();
    }

    @Transient
    @Nullable
    public Double getVolumeCountAsDouble() {
        Long volume = getVolumeCount();
        return volume == null ? null : volume.doubleValue();
    }

    @Transient
    @Nullable
    public BigDecimal getPriceAsBigDecimal() {
        Amount price = getPrice();
        return price == null ? null : price.asBigDecimal();
    }

    @Transient
    @Nullable
    public DiscreteAmount getVolume() {
        if (volumeCount == null)
            return null;
        if (volume == null)
            volume = new DiscreteAmount(volumeCount, getMarket().getVolumeBasis());
        return volume;
    }

    @Transient
    @Nullable
    public Double getVolumeAsDouble() {
        Amount volume = getVolume();
        return volume == null ? null : volume.asDouble();
    }

    @Transient
    @Nullable
    public BigDecimal getVolumeAsBigDecimal() {
        Amount volume = getVolume();
        return volume == null ? null : volume.asBigDecimal();
    }

    // JPA
    protected PriceData() {
        super();
    }

    protected void setPriceCount(Long priceCount) {
        this.priceCount = priceCount;
    }

    protected void setVolumeCount(Long volumeCount) {
        this.volumeCount = volumeCount;
    }

    private DiscreteAmount price;//价
    private DiscreteAmount volume;//量
    private Long priceCount;
    private Long volumeCount;
}



NVIDIA驱动装好了,Gazebo为啥还是卡?手把手教你用optirun搞定GPU加速 本文详细解析了NVIDIA驱动安装后Gazebo仍卡顿的原因,并提供三步精准诊断与GPU加速实战方案。通过optirun快速启用GPU加速,解决OpenGL与显示服务器的配置问题,显著提升仿真性能。适用于ROS、PX4等开发环境,帮助用户充分利用显卡性能。 阅读详情

相关推荐

硬件单板类机考复习提纲

6、 功率晶体管低导通损耗时处于的状态(饱和状态、放大状态、截止状态)(放大器的采样频率特性)总结:元器件特性(电阻、电容、二极管、三极管、晶体、晶振、MOS、磁珠等)信号质量问题产生根因(单调性、边沿过缓、毛刺、回沟、抖动等)3、 几种电容容量范围大小(超级电容、钽电容、陶瓷电容、铝电容)66、背板连接器接触设计的接触顺序(先导向、再地针、最后信号针)28、逻辑电平接口的特性(CMOS、TTL、ECL、PECL)76、差分电平(lvpecl、RS-422/485、cml)

2303_79562407的博客 1万+

程序员的量化交易之路(14)--Cointrader数据表(2)

Cointrader表结构 转载须注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrader.top 设置(setup) Install Java Install Maven Install MySql Create a database using mysq...

weixin_34372728的博客 171

内网渗透—横向移动&IPC横移&Impacket套件&CS插件

以上便是IPC横移的知识。最后,以上仅为个人的拙见,如何有不对的地方,欢迎各位师傅指正与补充,有兴趣的师傅可以一起交流学习。

2301_76227305的博客 1890

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

转载需注明出处:http://blog.youkuaiyun.com/minimicall,http://cloudtrade.top Tick:什么是Tick,在交易平台中非常常见,其实就 单笔交易时某只证券的基本数据。 我们通过代码来学习吧: package org.cryptocoinpartners.schema; import javax.annotation.Nullable; impor

MiniMicall的专栏 2374

KEPServerEX与三菱iQ-R系列PLC通讯

KEPServerEX与三菱iQ-R系列PLC通讯Mitsubishi Ethernet北京东方鼎晨科技有限公司目 录1. 前言2. 三菱PLC端相关设置3. Kepware端相关设置KEPServerEX是美国PTC Kepware公司生产的具有行业性的连接平台,KEPServerEX支持150多种通讯协议,用于向您的所有应用程序提供单一来源的工业自动化数据。该平台的设计使用户能够通过一个直观的用户界面来连接、管理、监视和控制不同的自动化设备和软件应用程序。KEPServerEX利用OPC(自动化产业的互

qq_28768521的博客 8097

ENVI与Sarscape协同处理哨兵一号数据的完整流程解析

本文详细解析了利用ENVI与Sarscape软件协同处理哨兵一号(Sentinel-1)SAR数据的完整工作流程。从环境搭建、数据导入与裁剪,到核心的DEM辅助多时相配准、斑点噪声滤波,再到最终的地理编码与辐射定标,提供了标准化的操作指南与实用技巧,帮助用户高效地将原始雷达数据转化为可用于分析的地理编码产品。

weixin_29251131的博客 339

程序员的量化交易之路(28)--Cointrader之Offer报价实体(15)

转载须注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrade.top/ Offer:报价。 bid:买方报价 ask:卖方报价 很简单的一个类。是PriceData的子类。还记得PriceData有什么吧。 时间戳、量、价, 而PriceData又是MarketData的子类,Market

MiniMicall的专栏 2116

华为防火墙双ISP出口实战:如何用策略路由实现电信联通流量自动切换(附配置截图)

本文详细解析了华为防火墙在双ISP环境下的智能选路技术,通过策略路由与健康检测的深度应用,实现电信联通流量的自动切换。文章包含实战配置截图,帮助企业解决切换延迟、路径劣化等核心挑战,提升业务连续性。

backprop5master的博客 643

程序员的量化交易之路(1)----规划开篇

其实,一直对量化交易有一定的理解和情节。早在中大读研究生的时候实验室师兄,已经去了中国平安核心投资团队,做高频交易研究的国源师兄的影响,就开始对金融世界产生了浓厚的兴趣。看了丁磊编著的《量化投资--策略与技术》和艾琳.奥尔德里奇的《高频交易》,反复的看,但是都入不了味,现在回过头来想,一个连股都不炒的人怎么可能入味呢。对一些金融的基本概念都不懂。 2013年7月出社会工作后,在10月份确

MiniMicall的专栏 1万+

NLP自然语言处理:神经网络语言模型(NNLM)

目录 一、传统语言模型 1.1 稀疏性 1.2泛化能力差 二、神经网络语言模型 2.1 前馈神经网络模型(FFLM) 2.2 循环神经网络模型(RNNLM) 2.2.1循环神经网络模型示例 2.2.2RNN语言模型训练过程 2.2.3RNN语言模型反向传播 2.2.4语言模型评估 语言模型的构建目的是为了对语言中的各要素的分布进行估计,具有较长的研究历史和广泛...

陈宸的博客 1万+

双重机器学习 stata教程 手把手教学

双重机器学习(DDML)的stata教程

weixin_59030591的博客 1万+

程序员的量化交易之路(33)--QuantConnect之案例1

转载需注明:http://blog.youkuaiyun.com/minimicall ,http://cloudtrade.top/ 分析Cointrader有一定层度了,发现它毕竟不是一个产品,没有得到验证。在架构、编码等方面都非常的不规范。 想编写一个云交易平台,任道而重远。我们需要参照一些成熟的架构。 Quantopian的zipline不行,因为我就是看到它不行,所以才去分析Cointrade

MiniMicall的专栏 7596

微信小程序 - 实现身份证OCR识别人像面与国徽面并提取字段信息,详解从手机相册选取或打开摄像头拍照上传身份证正反面图片ocr文字识别数据填充表单(提供免费纯前端ocr识别插件+百度OCR识别API)

微信小程序身份证识别,微信小程序身份证拍照、上传并OCR识别,微信小程序实现OCR扫描识别,微信小程序识别身份证免费插件,微信小程序实现身份证识别功能。ocr识别插件。微信身份证拍照后进行ocr识别,微信小程序OCR扫描识别身份证,OCR身份证实名认证+图片上传+拍照上传图片,微信小程序之身份证照片正反上传,小程序OCR身份证识别,微信小程序实现文字识别-ocr插件,微信小程序利用百度AI实现扫描身份证获取信息功能,基于微信小程序OCR插件实现身份证拍照、上传并OCR识别的示例demo,将上传的照片传到服务

🏆 前端领域优质创作者 8135

程序员的量化交易之路(2)----Esper文档学习之技术概览(1)

转载请注明出处:http://blog.youkuaiyun.com/minimicall/ 在接下来的20个工作日中,我将坚持翻译或者略翻译Esper的官方文档。 为什么需要学习Esper,因为我们需要理解复合事件处理 Complex Event Processing (CEP)。在量化交易系统中,CEP是必不可少的。它负责处理海量的实时事件。 关于CEP更多知识,大家可以翻阅网络相关资料。我

MiniMicall的专栏 6406

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

程序员的量化交易(34)--QuantConnect_Lean如何定义Indicator指标2

转载需注明出处:http://blog.youkuaiyun.com/minimicall,http://cloudtrade.top/ 指标(Indicator)由三大关键组件组成: 1. 实现你指标的类 2. 在ACAlgorithm基类中的Helper方法,用于简化对你指标实现的调用。 3. 测试方法用于测试指标的表现。 为了实现一个指标,上述所有组件需要实现。下面的教程会带你浏览这些

MiniMicall的专栏 5807

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

程序员的量化交易之路(10)--金融概念Stop-limit Order

转载需注明:http://blog.youkuaiyun.com/minimicall,http://cloudtrade.top Market Order: 市价订单。就是如果你下单后,基本上会马上执行的,该订单价格就是下单后的市场价格。 Limit order:限价订单。这个也容易理解,就是限定一个价格买入和卖出。比如某股票市价可能是15,你希望大跌后买入,你想设定10刀,这时候就用limit

MiniMicall的专栏 5585

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

程序员的量化交易之路(3)--Esper事件Event(2)

第二章 EventPresentation 事件描述 欢迎转载学习,但转载须注明出处:http://blog.youkuaiyun.com/minimicall,尊重劳动成果,版权归我。 这一章用于说明事件描述和建模的方法。   Esper 使用event type(事件类型)来描述事件的类型信息。 你的应用可以在Esper启动时或者在运行时通过API或者EPL语法来添加事件类型。具体参见16.4节

MiniMicall的专栏 4188

程序员的量化交易之路(35)--Lean之DataFeed数据槽3

转载需注明出处:http://blog.youkuaiyun.com/minimicall,http://cloudtrade.top/ Lean引擎的模块划分非常的规范。其中DataFeed是数据槽,就是供应数据的模块。 1. IDataFeed 接口 模块的接口为: namespace QuantConnect.Lean.Engine.DataFeeds { /// //

MiniMicall的专栏 3484

程序员的量化交易之路(9)--金融系统概念basis

转载需注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents , http://cloudtrade.top basis:基差 常见的几个概念有: Adjusted basis, the net cost of an asset after adjusting for various tax-related i

MiniMicall的专栏 3479

程序员的量化交易之路(23)--金融概念Margin保证金

转载需要注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrade.top Margin:保证金 英文解释:http://www.investopedia.com/terms/m/margin.asp 我们把它贴上,并加上我个人的翻译。(翻译不好莫怪) DEFINITION OF 'MARGIN'(m

MiniMicall的专栏 3354

程序员的量化交易之路(39)--Lean之BacktestingRealTimeHandler回测实时时间事件处理7

转载需注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrade.top/上一节已经说明了实时事件和处理接口。这一节需要说明回测里面的实时事件处理。主要是开启一个新的线程来处理定时事件。例如每天开市的时候的事件和每天闭市时候触发的事件。还有你可以定义任意一个给定时间的事件。下面我们通过代码来说 明问题/* *

MiniMicall的专栏 3266

程序员的量化交易之路(4)--Esper之事件(3)

欢迎转载学习,但转载须注明出处:http://blog.youkuaiyun.com/minimicall,尊重劳动成果,版权归我。 这一节中我们继续学习Esper的事件部分内容。 对应官方的文档为2.4-2.5 2.4 碎片及碎片类型(Fragment and Fragment Type) 有些情况,一个事件的某个属性本身又是一个事件。Esper对这种称作为fragment(碎片)和碎片类型

MiniMicall的专栏 3150

程序员的量化交易之路(7)--金融概念Positon

转载需说明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents Position 仓: long postion:多头 open long position :开多头仓 close long poition :  平(闭)多头仓 short positon:空头 open short position :开空头仓 close

MiniMicall的专栏 3027

程序员的量化交易之路(8)---金融概念Listing&delisting

转载需注明来源:http://blog.youkuaiyun.com/minimicall?viewmode=contents http://cloudtrade.top/ Listing:挂牌交易 Delisting:停止上市交易(退市)

MiniMicall的专栏 2913

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

转载须注明出处:http://blog.youkuaiyun.com/minimicall?viewmode=contents,http://cloudtrade.top/ 一个完整的系统,必然会涉及到配置文件。配置文件可以是xml、属性文件等形式。大多数而言我们并不需要重写配置读取解析模块,只需要使用开源的即可,这里使用的是apapche.commons.configuration的。 我们这里要说的是

MiniMicall的专栏 2846
上一篇: 程序员的量化交易之路(26)--Cointrader之Listing挂牌实体(13)
下一篇: 程序员的量化交易之路(28)--Cointrader之Offer报价实体(15)
minimicall
博客等级 码龄18年 407粉丝 174原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值