| | |
| | | private final BigDecimal marginRatioLimit; |
| | | private final BigDecimal contractMultiplier; |
| | | private final PnLPriceMode unrealizedPnlPriceMode; |
| | | private final BigDecimal maxPosSize; |
| | | private BigDecimal step; |
| | | |
| | | private OkxConfig(Builder builder) { |
| | | this.apiKey = builder.apiKey; |
| | |
| | | this.marginRatioLimit = builder.marginRatioLimit; |
| | | this.contractMultiplier = builder.contractMultiplier; |
| | | this.unrealizedPnlPriceMode = builder.unrealizedPnlPriceMode; |
| | | this.maxPosSize = builder.maxPosSize; |
| | | } |
| | | |
| | | // ==================== WS 地址 ==================== |
| | |
| | | public BigDecimal getOverallTp() { return overallTp; } |
| | | public BigDecimal getMaxLoss() { return maxLoss; } |
| | | public String getQuantity() { return quantity; } |
| | | public BigDecimal getMaxPosSize() { return maxPosSize; } |
| | | public int getGridQueueSize() { return gridQueueSize; } |
| | | |
| | | // ==================== 风险控制 ==================== |
| | |
| | | |
| | | public BigDecimal getContractMultiplier() { return contractMultiplier; } |
| | | public PnLPriceMode getUnrealizedPnlPriceMode() { return unrealizedPnlPriceMode; } |
| | | |
| | | public BigDecimal getStep() { return step; } |
| | | public void setStep(BigDecimal step) { this.step = step; } |
| | | |
| | | // ==================== 环境 ==================== |
| | | |
| | |
| | | private BigDecimal marginRatioLimit = new BigDecimal("0.2"); |
| | | private BigDecimal contractMultiplier = new BigDecimal("1"); |
| | | private PnLPriceMode unrealizedPnlPriceMode = PnLPriceMode.LAST_PRICE; |
| | | private BigDecimal maxPosSize = new BigDecimal("10"); |
| | | |
| | | public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } |
| | | public Builder secretKey(String secretKey) { this.secretKey = secretKey; return this; } |
| | |
| | | public Builder isProduction(boolean isProduction) { this.isProduction = isProduction; return this; } |
| | | public Builder contractMultiplier(BigDecimal contractMultiplier) { this.contractMultiplier = contractMultiplier; return this; } |
| | | public Builder unrealizedPnlPriceMode(PnLPriceMode mode) { this.unrealizedPnlPriceMode = mode; return this; } |
| | | public Builder maxPosSize(BigDecimal maxPosSize) { this.maxPosSize = maxPosSize; return this; } |
| | | |
| | | public OkxConfig build() { |
| | | return new OkxConfig(this); |