转载须注明出自:http://blog.csdn.net/minimicall?

viewmode=contentshttp://cloudtrader.top

货币,Cointrader中基本实体。我们通过代码来学习该实体:

package org.cryptocoinpartners.schema;

import java.util.List;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.NoResultException; import org.cryptocoinpartners.util.PersistUtil; /**
* @author Tim Olson
*/
@Entity //实体
@Cacheable
public class Currency extends Asset {//货币是资产的一种,继承关系 public boolean isFiat() {//是否为法定货币
return fiat;
} public static Currency forSymbol(String symbol) {
return PersistUtil.queryOne(Currency.class, "select c from Currency c where symbol=?1", symbol);
} public static List<String> allSymbols() {
return PersistUtil.queryList(String.class, "select symbol from Currency");
} // JPA
protected Currency() {
} protected void setFiat(boolean fiat) {
this.fiat = fiat;
} // used by Currencies
static Currency forSymbolOrCreate(String symbol, boolean isFiat, double basis) {
try {
return forSymbol(symbol);
} catch (NoResultException e) {
final Currency currency = new Currency(isFiat, symbol, basis);
PersistUtil.insert(currency);
return currency;
}
} // used by Currencies
static Currency forSymbolOrCreate(String symbol, boolean isFiat, double basis, double multiplier) {
try {
return forSymbol(symbol);
} catch (NoResultException e) {
final Currency currency = new Currency(isFiat, symbol, basis, multiplier);
PersistUtil.insert(currency);
return currency;
}
} private Currency(boolean fiat, String symbol, double basis) {
super(symbol, basis);
this.fiat = fiat;
} private Currency(boolean fiat, String symbol, double basis, double multiplier) {
super(symbol, basis);
this.fiat = fiat;
this.multiplier = multiplier;
} private boolean fiat;//是否为法定货币
private double multiplier;//乘数
}

multiplier乘数是一个比較生疏的一个概念。

它的介绍见wikipedia:http://en.wikipedia.org/wiki/Multiplier_(economics)

还是一个比較难的概念。

程序猿的量化交易之路(21)--Cointrader之Currency货币实体(9)的更多相关文章

  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. 程序猿的量化交易之路(29)--Cointrader之Tick实体(16)

    转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrade.top Tick:什么是Tick,在交易平台中很常见,事实上就 单笔交易时某仅仅证券 ...

  4. 程序猿的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)

    转载需注明出处:http://blog.csdn.net/minimicall,http://cloudtrader.top/ 在量化交易系统中.有些事件是远端传来的,比方股票的价格数据等.所以,在这 ...

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

    转载须注明出处:viewmode=contents">http://blog.csdn.net/minimicall?viewmode=contents.http://cloudtra ...

  6. 程序猿的量化交易之路(26)--Cointrader之Listing挂牌实体(13)

    转载须注明出处:http://blog.csdn.net/minimicall? viewmode=contents,http://cloudtrade.top Listing:挂牌. 比方某仅仅股票 ...

  7. 程序猿的量化交易之路(32)--Cointrade之Portfolio组合(19)

    转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ Portfolio:组合,代表的是多个 ...

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

    转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,http://cloudtrade.top/ PriceData:价格数据.价格数据 ...

  9. 程序猿的量化交易之路(18)--Cointrader之Event实体(6)

    转载需注明: 事件,是Esper的重要概念. 这里我们定义个事件类.它是Temporal实体的派生类. 不过对Temporal简单的包装.其代码例如以下: package org.cryptocoin ...

随机推荐

  1. 一个关于Class的小点

    public 是公有 private 是私有 没有写就是private

  2. UML基本架构建模--获取类

     Getting Started 開始 Modeling a system involves identifying the things that are important to your p ...

  3. STM32F030, 使用嘀嗒定时器Systick实现LED闪烁

    本文主要解决两个问题 1 STM32的IO口要反转,怎么实现? 2 嘀嗒定时器systick的配置 解答1: 单片机的口,反转非常easy.sbit led = P1 ^6;  led = ~led; ...

  4. UI组件之AdapterView及其子类(五)ListView组件和ListActivity

    ListView组件是一个显示组件,继承AdapterView基类,前面已经介绍了分别使用ArrayAdapter,SimpleAdapter,扩展BaseAdapter来为LisView提供列表项h ...

  5. php常用知识集锦

    php常用知识集锦 很多位置都有写好的代码,自己做项目的时候可以直接拿来用,而不用自己写,比如现在看到的菜鸟教程. 1.判断是否为空 empty($_POST["name"]) 2 ...

  6. 迭代Iterator的用法

    迭代→遍历: 一个标准化遍历各类容器里面的所有对象的方法类(典型的设计模式) 把访问逻辑从不同类型的集合类中抽象出来,从而避免向客户端暴露集合的内部结构 迭代(Iterator)与枚举(Enumera ...

  7. k8s 架构浅析

    文章目录 目录 Kubernetes 的电梯间演讲 Kubernetes 的核心层级对象 Kubernetes 的组件架构 Kubernetes 的组件通信协议/接口 Kubernetes 的分层架构 ...

  8. [makefile]如何设置不同目录的代码(.c),生成到指定目录下(./debug/.o))

    部分代码跟makefile不在同一目录,有没有好的方法来设置依赖关系,我找到三种方法,但感觉都不完美,下面我会把他列出来并加以说明,不知有没有更好的方法,makefile本身也不是很熟,请大家指教: ...

  9. vue 特定条件下绑定事件

    今天写了个小功能,看起来挺简单,写的过程中发现了些坑.1.div没有disabled的属性,所以得写成button2.disabled在data时,默认是true,使得初始化时,默认置灰按钮,无法点击 ...

  10. 基于 Web 的 Go 语言 IDE - Wide 1.3.0 发布!

    http://symphony.b3log.org/article/1437292757551 欢迎各位提意见.建议,参与到 Wide 开源项目中 :-)