1
zj
20 hours ago f658569891db433854221b80f0a9fa99608cff64
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
package com.yami.trading.api.dto;
 
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
 
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
 
 
 
@Data
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class OpenAction {
 
    @NotBlank
    private String symbol;
    /**
     * direction "buy":多 "sell":空
     */
    @Pattern(regexp="^(buy|sell)$",message = "请输入正确的方向")
    private String direction;
    /**
     * amount 下单数量(杠杆口径数量)。服务端不再对该数量做二次杠杆换算;
     * 保证金仍按 (价格 × 数量) / 杠杆 计算。
     */
    @NotNull(message = "委托数量(币)必填")
    @DecimalMin(value = "0.01", message = "最小下单0.01个币")
    private BigDecimal amount;
    /**
     * lever_rate 杠杆倍数
     */
    @JsonProperty("lever_rate")
    private  BigDecimal lever_rate;
 
    /**
     * price 限价时必填且有效;市价(opponent)可忽略,服务端以行情为准
     */
    private BigDecimal price;
 
    /**
     * stop_price_profit 止盈触发价格
     */
    @JsonProperty("stop_price_profit")
    private BigDecimal stop_price_profit;
    /**
     * stop_price_loss 止损触发价格
     */
    @JsonProperty("stop_price_loss")
    private BigDecimal stop_price_loss;
    /**
     *price_type 订单报价类型:"limit":限价 "opponent":对手价(市价)
     */
    @NotNull
    @JsonProperty("price_type")
    @Pattern(regexp="^(limit|opponent)$",message = "请输入订单报价类型")
    private String price_type;
    @NotNull
    @JsonProperty("session_token")
    private String session_token;
 
    public void setLever_rate(BigDecimal lever_rate) {
        if(lever_rate == null){
            this.lever_rate =  BigDecimal.ONE;
            return;
        }
        this.lever_rate = lever_rate;
    }
 
    public void setStop_price_profit(BigDecimal stop_price_profit) {
        if(stop_price_profit == null){
            this.stop_price_profit = BigDecimal.ZERO;
            return;
        }
        this.stop_price_profit = stop_price_profit;
    }
 
    public void setStop_price_loss(BigDecimal stop_price_loss) {
        if(stop_price_loss == null){
            this.stop_price_loss = BigDecimal.ZERO;
            return;
        }
        this.stop_price_loss = stop_price_loss;
    }
}