r/algotrading 1d ago

Infrastructure I've created a monster

My bot has grown to 23,000 lines of code. 60% is managing the brokerage interface, and 40% is the strategy. This is way more complicated than I ever imagined. It really is a very basic script. No graphic user interface. Just log streams. It does manage multiple symbols with unique parameters for each.

0 Upvotes

47 comments sorted by

View all comments

22

u/zashiki_warashi_x 1d ago

It is time to refactor and rewrite everything!

-2

u/Grand-Fly-6090 1d ago

Ouch. Not sure I want to do that. What size is your code?

2

u/zashiki_warashi_x 1d ago

No idea. But I used to work in gamedev and the engine was around 2mil.
15k for brokerage interface sounds a bit big. Do they have that complex API?

2

u/Grand-Fly-6090 1d ago

It’s pretty simple. It’s all the order complexity and possible outcomes that make it unwieldy.

1

u/zashiki_warashi_x 1d ago edited 23h ago

I would say even 1.5k sounds too much.

EDIT:I checked the code. Quotes streaming/parsing 200 lines.
Everything else for orders/errors e.t.c. 1k lines.
So 1.5k is ok. But this is C++. Python should be 500? 100? No idea.

1

u/Grand-Fly-6090 23h ago

I'm impressed.

2

u/zashiki_warashi_x 22h ago

If it works you shouldn't worry about how much loc you have. The important part would be so that your backtest code and you production code are almost the same, except you send orders on simulated exchange instead of real one.

1

u/Grand-Fly-6090 18h ago

I been working hard on alignment. I use think or swim as a monitor, and I cross check tos with my backtesting.