Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/polo okex candle data catch up #4723

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
package org.knowm.xchange.okex.service;

public enum OkexCandleStickPeriodType {
CANDLE_STICK_1M(1, "1m"),
CANDLE_STICK_3M(3, "3m"),
CANDLE_STICK_5M(5, "5m"),
CANDLE_STICK_15M(15, "15m"),
CANDLE_STICK_30M(30, "30m"),
CANDLE_STICK_1H(60, "1H"),
CANDLE_STICK_2H(2 * 60, "2H"),
CANDLE_STICK_4H(4 * 60, "4H");
private final long periodInSecs;
private final String fieldValue;
OkexCandleStickPeriodType(long periodInMinutes, String fieldValue) {
this.periodInSecs = periodInMinutes * 1000;
this.fieldValue = fieldValue;
}
static OkexCandleStickPeriodType getPeriodTypeFromSecs(long periodInSecs) {
OkexCandleStickPeriodType result = null;
for (OkexCandleStickPeriodType period : OkexCandleStickPeriodType.values()) {
if (period.periodInSecs == periodInSecs) {
result = period;
break;
}
CANDLE_STICK_1M(1, "1m"),
CANDLE_STICK_3M(3, "3m"),
CANDLE_STICK_5M(5, "5m"),
CANDLE_STICK_15M(15, "15m"),
CANDLE_STICK_30M(30, "30m"),
CANDLE_STICK_1H(60, "1H"),
CANDLE_STICK_2H(2 * 60, "2H"),
CANDLE_STICK_4H(4 * 60, "4H");
private final long periodInSecs;
private final String fieldValue;
OkexCandleStickPeriodType(long periodInMinutes, String fieldValue) {
this.periodInSecs = periodInMinutes * 60;
this.fieldValue = fieldValue;
}
return result;
}
public static long[] getSupportedPeriodsInSecs() {
long[] result = new long[OkexCandleStickPeriodType.values().length];
int index = 0;
for (OkexCandleStickPeriodType period : OkexCandleStickPeriodType.values()) {
result[index++] = period.periodInSecs;
static OkexCandleStickPeriodType getPeriodTypeFromSecs(long periodInSecs) {
OkexCandleStickPeriodType result = null;
for (OkexCandleStickPeriodType period : OkexCandleStickPeriodType.values()) {
if (period.periodInSecs == periodInSecs) {
result = period;
break;
}
}
return result;
}
return result;
}
public String getFieldValue() {
return fieldValue;
}
}
public static long[] getSupportedPeriodsInSecs() {
long[] result = new long[OkexCandleStickPeriodType.values().length];
int index = 0;
for (OkexCandleStickPeriodType period : OkexCandleStickPeriodType.values()) {
result[index++] = period.periodInSecs;
}
return result;
}
public String getFieldValue() {
return fieldValue;
}
}