export type TradeAlgorithmResult = {
[key: string]: Array<unknown>
positions: Array<Position>
}
export type TradeAlgorithm = (props?: unknown) => (candles: Array<Candle>) => TradeAlgorithmResult
export type RSIReversalAlgorithmProps = {
rsiLength: number
smaLength: number
}
export const rsiReversalAlgorithm: TradeAlgorithm = ({ rsiLength, smaLength }: RSIReversalAlgorithmProps) => {
return (candles) => {
// ...
}
}
This gives the error:
Type '({ rsiLength, smaLength }: RSIReversalAlgorithmProps) => (candles: Candle[]) => { positions: Position[]; rsiValues: number[]; smaValues: number[]; }' is not assignable to type 'TradeAlgorithm'.
Types of parameters '__0' and 'props' are incompatible.
Type 'unknown' is not assignable to type 'RSIReversalAlgorithmProps'.ts(2322)
How do I fix this?