mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 16:28:06 +00:00
- 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.
25 lines
1.3 KiB
Markdown
25 lines
1.3 KiB
Markdown
无论在任何交易所或者平台运行,都遵循以下逻辑:
|
|
|
|
无论交易任何交易对,都参照 ETHBTC 数据进行交易
|
|
|
|
从binance现货接口获取 ETHBTC 交易对 4 小时k线数据,rest 接口获取历史数据,获取500条即可
|
|
|
|
订阅ws获取最新一根K线的数据
|
|
|
|
参考 trading-signals 库,计算 RSI 指标,RSI 参数为 14
|
|
|
|
我们的策略仅单边做空,但需要预留配置,可以支持单边做多,单边做空,双向交易
|
|
|
|
下面针对单边做空的情况进行说明
|
|
|
|
RSI 指标上穿 70 时,进入等待做空状态,后续当 RSI 指标下穿 70 时,执行做空开仓操作
|
|
|
|
如果对应的平台支持挂止损 stop loss,则在开仓的同时需要挂一个开仓成本价上涨 5% 的止损单,止损百分比可以设置参数调整,同时也需要有实时监控的止损逻辑,如果在持仓状态下,当前交易对比开仓价格上涨超过 5% ,则执行主动的市价止损操作
|
|
|
|
策略需要实时监控当前的交易对ticker数据、orderbook数据,open orders、position,支持ws的全都使用ws数据实时更新
|
|
|
|
在有仓位的情况下,如果发现 ETHBTC 的 RSI 指标下穿 30,则进入等待平空状态,如果后续 RSI 指标上穿 30,并且确认仓位有盈利,则执行平空操作
|
|
|
|
如此循环往复
|
|
|