转载须注明出自: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. Python的递归深度

    RuntimeError: maximum recursion depth exceeded while calling a Python object 大意是调用 Python 对象时超出最大深度限 ...

  2. 看云-git类的书籍写作

    看云-git类的书籍写作 https://www.kancloud.cn/explore 测试一本:https://www.kancloud.cn/stono/b001/501901

  3. 普通androidproject转换为C/C++project之后,再还原成androidproject的解决方式

    我们在调试android程序时,可能会把androidproject转换成C/C++project,或者Add Native Support.可是,我们怎么把C/C++project还原成普通的and ...

  4. [BZOJ 3884][欧拉定理]上帝与集合的正确使用方法

    看看我们机房某畸形写的题解:http://blog.csdn.net/sinat_27410769/article/details/46754209 此题为popoQQQ神犇所出,在此orz #inc ...

  5. MVC发送邮件

    <> 发送邮件报错说明 发送邮件 假设发送人的邮箱username与邮箱password都没有填写错误:假设报:參数或变量中有语法错误. server响应为:mail from addre ...

  6. 0x31 质数

    poj2689 算根号R的质数,然后把L~R区间(这个很小啊)的合数判下 #include<cstdio> #include<iostream> #include<cst ...

  7. 英语发音规则---S字母

    英语发音规则---S字母 一.总结 一句话总结: 1.S 在音节开头或清辅音前 /s/? sit /sɪt/ vt.& vi.坐 seat /si:t/ n.席位 sell /sel/ vt. ...

  8. UESTC--1262--Memory(dfs)

    Memory Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %lld & %llu SubmitStatus De ...

  9. 院校-德国:亚琛工业大学(RWTH)

    ylbtech-院校-德国:亚琛工业大学(RWTH) 1.返回顶部 1. 亚琛工业大学(RWTH)成立于1870年,是德国著名理工类大学之一,也是世界顶尖理工类大学之一 ,长久以来被誉为“欧洲的麻省理 ...

  10. sdwebimage缓存图片

    当使用SDWebImage时,如果用相同图片名的图片替换掉了原始缓存的图片,当再次请求的时候,还是使用的缓存图片,图片不会发生改变 原因:图片在NSCache中是以absolute url作为key存 ...