Skip to content

Commit

Permalink
feat(dca-form): implement IndicatorValue field for Entry Conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Oct 27, 2024
1 parent c2a943b commit 03ffe29
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/types/src/indicators/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./candle.js";
export * from "./indicators.js";
export * from "./indicator-value.js";
20 changes: 20 additions & 0 deletions packages/types/src/indicators/indicator-value.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BarSize } from "../common/index.js";

/**
* Used in forms in custom fields with React Query Builder
*/
export type IndicatorValue = {
/**
* Numeric string.
*/
indicatorValue: string;
/**
* Numeric string.
*/
periods: string;
timeframe: BarSize;
};

export const isIndicatorValue = (value: any): value is IndicatorValue => {
return value?.indicatorValue !== undefined && value?.periods !== undefined && value?.timeframe !== undefined;
};
5 changes: 1 addition & 4 deletions packages/types/src/indicators/indicators.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { BarSize } from "../common/enums.js";

export type IndicatorName = "SMA5" | "SMA10" | "SMA15" | "SMA30" | "RSI";
export type IndicatorBarSize = Extract<
BarSize,
"1m" | "5m" | "10m" | "15m" | "30m" | "1h" | "4h" | "1d"
>;
export type IndicatorBarSize = Extract<BarSize, "1m" | "5m" | "10m" | "15m" | "30m" | "1h" | "4h" | "1d">;
export type IndicatorsResult<I extends IndicatorName> = {
[K in I]: number;
};
2 changes: 1 addition & 1 deletion pro
Submodule pro updated from b0869a to 009a63

0 comments on commit 03ffe29

Please sign in to comment.