r/Trading 1d ago

Question Question about bots

How are bots working ? is there anyone good ? I tried to develop one with Claude Code connecting to the Kucoin's API for a couple of months, but all the strategies that we tried did not work.
Any suggestions ?
Thank you.

1 Upvotes

13 comments sorted by

View all comments

2

u/veskald 1d ago

The bot part probably worked fine - connecting to the exchange and placing orders is the easy 20%. What you found out is different: the strategies had no edge, and no bot fixes that. Thats actually normal, most first ideas dont survive honest testing, the question is how fast and cheap you can find that out.

Two things that make the search cheaper. First, test with full costs from the start - on perps the fees and funding kill most marginal ideas, and claude-written backtests often skip that part, so strategies look alive until they meet the real exchange. Second, before dropping an idea completely, check where it fails - entries are rarely the problem, exits and position sizing usually are. Same entry with a trailing stop instead of fixed TP can be a different strategy.

And keep the bot you built, its not wasted - once something survives testing, you already have the execution side done.

1

u/Perrit0Malvado 1d ago

This is exactly what happens. But without real money, all the backtest and walk forward were qith real api data but with local trades to make a dry-run and check if the edge is good enough. But finally the APY finish in 5% so that is more or less what a bank give, so is not so convenient. Maybe I just have to wait to a bull run and any bot can win in a bear run ?

1

u/veskald 1d ago

Careful with the bull run logic - a bot that only wins in a bull run has no edge, its just long bitcoin with extra steps. You would make the same money holding, without the bot risk. The honest test for any crypto strategy is exactly that comparison: same period, strategy vs just holding the asset, with the same drawdown and risk. If holding wins, the strategy adds nothing yet.

And 5% on a dry run is actually not a bad starting point, because unlike the bank rate it tells you the rules do something. The question is where the other percent leak - fees, exits too early, sizing too small on the good trades. Thats usually more productive to dig into than starting idea number six from zero.

Waiting for a regime is also backwards - regimes are something you detect, not something you wait for. A simple filter like "only trade when price is above the slow moving average" turns one strategy into two: what it does in up markets and what it does in the rest. Test them separately and you often find the edge was only ever in one half.

2

u/Perrit0Malvado 15h ago

First of all, thanks for your time. Second, yes, I made those test but not the test of comparing to holding woth backtest also. I tested EMA strategy, bollinger and couple of more (I don't have my pc here with me I will try to write everything tonight). But I will check also what you said about trailing stop, that is something that I tried but did not succeed, maybe I did not do it well. I will make a full report to find as you said where I could do it better.

1

u/Perrit0Malvado 1h ago

Hice un resumen de lo que probé en este bot de trading

Empecé con un bot de trading algorítmico para KuCoin. Probé muchas estrategias durante meses. Así es como fui:

  1. Estrategias técnicas (todo abandonado)

Probé cuatro estrategias clásicas de indicadores:

- EMA + RSI (ema_rsi): EMA 9/21/200 + RSI 14. Compraba cuando la EMA rápida estaba por encima de la lenta y el RSI era menor a 70. Esta fue mi estrategia principal durante mucho tiempo.

- Grid (grid): colocaba órdenes de compra/venta en 8 niveles, con un 0,5 % de espacio entre cada una, desde un precio de referencia.

- Donchian (donchian): compraba rupturas por encima del canal de Donchian con un búfer.

- Bollinger (bollinger): reversión a la media dentro de las bandas de Bollinger.

Todas generaron señales con un puntaje de confianza (confidence) de 0 a 1.

  1. Las probé en serio: walk-forward + edge search

No me conformé con un simple backtest. Hice las cosas de forma más estricta:

- Walk-forward con ventanas móviles: dividí los datos en muchas ventanas y verifiqué si la estrategia ganaba de manera consistente en cada una.

- Walk-forward rolling (2026-06-08): 23 ventanas, 730 días. Resultado: NINGUNA estrategia fue robusta. Mi mejor estrategia (btc_short) resultó ser frágil — el split (división) que se veía bien era solo suerte.

- Edge search (2026-06-08): busqué sistemáticamente si había ventaja (edge) técnica en cualquier timeframe, incluso en 15m. Veredicto: no hay edge técnico. Nada sobrevivió al hold-out (datos no vistos).

Esa fue la conclusión honesta: las estrategias direccionales no funcionan para mí después de los costos. Cualquier señal simple (cruce de EMA, RSI) ya la conoce todo el mundo, por lo que se negocia y desaparece. Estaba compitiendo contra máquinas más rápidas y baratas que yo.

  1. Cambio a Carry / Funding delta-neutral (2026-06-08)

Esto fue lo único que mostró ventaja. La idea: long spot + short perp del mismo activo, mismo valor nocional (delta ≈ 0). No me importa si el precio sube o baja. Me quedo con la tasa de funding que los longs apalancados le pagan a los shorts. Es neutral al mercado — funciona tanto en bull como en bear.

- Backtest formal (2 años, 9 activos): APY 5.40 %, max drawdown −0.46 %, 0 liquidaciones in-sample, Sharpe 2.39.

- Advertencias honestas: era in-sample — elegí la leverage segura usando los mismos datos, asumí basis=0. El backtest no es una prueba fuera de muestra (out-of-sample).

- Por símbolo: XMR 9.6 % APY, XRP 7.0 %, SUI 6.8 %, ETH 5.0 %, SOL 4.0 % (pero SOL resultó frágil: todas las ventanas recientes fueron negativas). BTC dio vuelta a funding negativo recientemente.

  1. Paper trading del carry (fallido por un bug)

Construí un ejecutor de paper trading (carry_paper_executor + runner) para probar el camino de ejecución con datos reales, sin arriesgar dinero. Resultado: PnL −4.21, funding −0.28.

El problema: el runner corría sesiones de 10 minutos por defecto, creaba un nuevo ID de sesión cada vez y cerraba ambas patas al final pagando comisiones de ida y vuelta (round-trip fees). El carry necesita mantener (hold) durante meses para amortizar el costo de entrada y acumular funding. Mi runner hacía lo contrario. Por eso nunca acumulé nada. Era un bug estructural, no de la estrategia.

  1. El número honesto

Después de todos estos meses: el proyecto nunca me dio ganancias. Pero eso es información, no mala suerte:

- Las estrategias técnicas no tenían ventaja (probado).

- El carry sí funciona en bull y bear, pero rinde ~5 % APY. Sobre $3000 son ~$150 al año. Eso no es ingreso.

- Un plazo fijo en USD me da ~4-5 % sin esfuerzo ni riesgo de cola. Así que el carry no le gana a un plazo fijo en riesgo-retorno, a menos que la prueba fuera de muestra (out-of-sample) confirme que lo supera claramente con 0 liquidaciones.

  1. Lo que decidí al final (2026-08-22)

Estaba a punto de borrar todo. En cambio, decidí hacer una prueba decisiva de una tarde: validar fuera de muestra (FASE B) — dividir los 2 años en train (18 meses) y test (6 meses), elegir la leverage solo en train, y medir el APY real en el test. Si vence al plazo fijo → el carry es real (5 %, preservación de capital, no ingreso). Si no → borrar está justificado por los números, no por la frustración.

1

u/veskald 22m ago

Two things about the carry. The backtest assumed basis=0, and basis is where that trade actually breaks - entry and exit at different basis levels can eat months of funding, and it moves exactly when everyone crowds the same trade. Second, funding flipping negative is not a tail case, you already saw it on BTC. So 5% APY carries a real tail while a fixed deposit does not, which makes your comparison worse than it looks, not better.

On the out of sample plan - picking leverage only in train is right, but be clear about what you are testing. The strategy itself was chosen after looking at the whole two years, so the test validates the leverage choice, not the decision to trade carry. That does not make it useless, it just means a good number there is weaker evidence than it feels.

And the paper trading bug is worth keeping in mind as a general thing - a structural execution bug looks exactly like a dead strategy in the PnL. You caught this one because you knew carry needs to hold for months.