zyy
2025-12-29 645f40f5f61f8fa217ef01b5b2aaaf687b173577
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
package com.yami.trading.bean.item.domain;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.hankcs.hanlp.HanLP;
import com.yami.trading.common.domain.BaseEntity;
import com.yami.trading.common.lang.LangUtils;
import com.yami.trading.common.util.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
 
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Locale;
 
/**
 * 产品Entity
 *
 * @author lucas
 * @version 2023-03-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_item")
public class Item extends BaseEntity {
    /**
     * 外汇
     */
    public final static String forex = "forex";
 
    /**
     * 指数
     */
    public final static String indices = "indices";
 
    /**
     * 大宗商品
     */
    public final static String commodities = "commodities";
 
    /**
     * 贵金属
     */
    public static final String UK_METALS = "UK-metals";
 
    /**
     * 虚拟货币
     */
    public final static String cryptos = "cryptos";
 
    /**
     * 美股
     */
    public final static String US_STOCKS = "US-stocks";
 
    /**
     * 美股ETF
     */
    public final static String US_ETF = "US-ETF";
 
    /**
     * 港股
     */
    public final static String HK_STOCKS = "HK-stocks";
 
    public final static String TW_STOCKS = "TW-stocks";
 
    public final static String MY_STOCKS = "MY-stocks";
 
    /**
     * 港股
     */
    public final static String A_STOCKS = "A-stocks";
    /**
     * 日股
     */
    public final static String JP_STOCKS = "JP-stocks";
    /**
     * 印度股
     */
    public final static String INDIA_STOCKS = "INDIA-stocks";
 
    /**
     * 英国股票
     */
    public final static String UK_STOCKS = "UK-stocks";
    /**
     * 德国股票
     */
    public final static String DE_STOCKS = "DE-stocks";
    /**
     * 巴西股票
     */
    public final static String BZ_STOCKS = "BZ-stocks";
    /**
     * 加拿大股票
     */
    public final static String CAD_STOCKS = "CAD-stocks";
    /**
     * 法国股股票
     */
    public final static String FR_STOCKS = "FR-stocks";
 
    public final static String SG_STOCKS = "SG-stocks";
 
 
 
    /**
     * 全球ETF
     */
    public final static String CATEGORY_GLOBAL = "global";
 
    /**
     * 黄金ETF
     */
    public final static String CATEGORY_GOLD = "gold";
 
 
    /**
     * 人工智能ETF
     */
    public final static String CATEGORY_AI = "ai";
 
    /**
     * 能源ETF
     */
    public final static String CATEGORY_ENERGY = "energy";
 
    private static final long serialVersionUID = 1L;
 
 
    public static List<String> types = Lists.newArrayList(forex, commodities, cryptos, indices, US_STOCKS, HK_STOCKS, UK_STOCKS,
            A_STOCKS, TW_STOCKS, JP_STOCKS, INDIA_STOCKS, UK_STOCKS, DE_STOCKS, BZ_STOCKS,
            CAD_STOCKS, FR_STOCKS, SG_STOCKS,MY_STOCKS);
 
    private String name;
 
    private String enName;
 
    @NotBlank
    private String symbol;
 
    /**
     * 数据源编码
     */
    private String symbolData;
 
    /**
     * 最小浮动
     */
    private double pips;
 
    /**
     * 最小浮动金额(以交易金额计算)
     */
    private double pipsAmount;
 
    private double adjustmentValue;
 
    /**
     * 每张金额
     */
    private double unitAmount;
 
    /**
     * 每张手续费
     */
    private double unitFee;
 
    /**
     * 合约手续费  百分比设置
     */
    private double unitPercentage;
 
    /**
     * 市场
     */
    private String market;
 
    /**
     * 小数位精度
     */
    private int decimals;
 
    /**
     * 交易量倍数
     */
    private double multiple;
 
 
    /**
     * 借贷利率
     */
    private double borrowingRate;
 
    /**
     * 币种全称
     */
    private String symbolFullName;
 
    private String type;
 
    private String category;
 
    private String openCloseType;
 
    private String fake;
 
    /**
     * 板块
     */
    private String board;
 
    /**
     * 默认: 999999
     */
    private String sorted;
 
    @ApiModelProperty("报价货币")
    private String quoteCurrency;
 
    @ApiModelProperty("前端显示状态,1显示,0不显示")
    private String showStatus;
    @ApiModelProperty("交易状态,1显示,0不显示")
    private String tradeStatus;
 
    @ApiModelProperty("状态,1启用,0禁止")
    private String enable;
    @ApiModelProperty("市价买,1是,0否")
    private String canBuyAtMarketPrice;
    @ApiModelProperty("市价卖,1是,0否")
    private String canSellAtMarketPrice;
    @ApiModelProperty("限价可买,1是,0否")
    private String limitCanBuy;
    @ApiModelProperty("限价可卖,1是,0否")
    private String limitCanSell;
    @TableField(exist = false)
    private boolean isOpen;
 
    //默认激活,一直采集的
    public final static String DEFAULT_ACTIVE = "default_active";
    //被动激活,一直采集的
    public final static String ACTIVE = "active";
    // 冻结,不采集的
    public final static String FREEZE = "freeze";
 
    // default_active 默认激活,active激活,freeze 冻结
    private String crawlStatus;
 
    public String getName() {
        if (LangUtils.hasLang()) {
            if (LangUtils.isTWItem()) {
                return HanLP.convertToTraditionalChinese(name);
            }
            if (LangUtils.isEnItem() && StringUtils.isNotEmpty(enName)) {
                return enName;
            }
        }
        return name;
    }
 
    /**
     * 数字货币采集数据源的名称
     */
    private String remarks;
 
    /**
     * 股票代码 用于第三方采集K线跟行情
     */
    private String stockCode;
 
    private Integer marketImpact;
 
    private Integer reboundSet;
 
    private Integer autosecond;
 
    @TableField(exist = false)
    private double nowPrice;
 
 
 
    @JsonIgnore
    public String getSourceName() {
        return name;
    }
 
    public boolean isActive() {
        return StrUtil.toString(crawlStatus).toLowerCase(Locale.ROOT).contains("active");
    }
}