Add swing trading strategy with RSI signals and Binance integration

- Introduced a new swing trading strategy utilizing the RSI indicator on the ETHBTC pair from Binance.
- Implemented the `SwingEngine` to manage trading logic, including entry and exit conditions based on RSI thresholds.
- Added configuration options for swing direction, trade amount, and RSI parameters in `config.ts`.
- Created new documentation for the swing strategy, detailing its behavior and configuration.
- Enhanced CLI to support the new swing strategy option.
- Added tests for swing logic to ensure correct behavior under various market conditions.
This commit is contained in:
discountry
2026-01-31 16:15:07 +08:00
parent 1d88ddefb5
commit c4559cb0d7
16 changed files with 2369 additions and 5 deletions
+11 -2
View File
@@ -1,6 +1,7 @@
import React, { useMemo, useState } from "react";
import { Box, Text, useInput } from "ink";
import { TrendApp } from "./TrendApp";
import { SwingApp } from "./SwingApp";
import { GuardianApp } from "./GuardianApp";
import { MakerApp } from "./MakerApp";
import { MakerPointsApp } from "./MakerPointsApp";
@@ -14,7 +15,7 @@ import { resolveExchangeId } from "../exchanges/create-adapter";
import { t } from "../i18n";
interface StrategyOption {
id: "trend" | "guardian" | "maker" | "maker-points" | "offset-maker" | "liquidity-maker" | "basis" | "grid";
id: "trend" | "swing" | "guardian" | "maker" | "maker-points" | "offset-maker" | "liquidity-maker" | "basis" | "grid";
label: string;
description: string;
component: React.ComponentType<{ onExit: () => void }>;
@@ -27,6 +28,12 @@ const BASE_STRATEGIES: StrategyOption[] = [
description: t("app.strategy.trend.desc"),
component: TrendApp,
},
{
id: "swing",
label: t("app.strategy.swing.label"),
description: t("app.strategy.swing.desc"),
component: SwingApp,
},
{
id: "guardian",
label: t("app.strategy.guardian.label"),
@@ -70,7 +77,9 @@ export function App() {
const strategies = useMemo(() => {
const next: StrategyOption[] = [...BASE_STRATEGIES];
if (exchangeId === "standx") {
next.splice(3, 0, {
const gridIndex = next.findIndex((s) => s.id === "grid");
const insertAt = gridIndex === -1 ? next.length : gridIndex;
next.splice(insertAt, 0, {
id: "maker-points" as const,
label: t("app.strategy.makerPoints.label"),
description: t("app.strategy.makerPoints.desc"),