4 ms·
In in experience the vast majority of the code of a trading application is dedicated to safety: pre/post trade checks, price checks, open notional, pnl delta li
by gpderetta 7y ago
In in experience the vast majority of the code of a trading application is dedicated to safety: pre/post trade checks, price checks, open notional, pnl delta limits, order rate, fill rate etc. And of course error handling and getting out of unexpected states safely and quickly.
40 lines of JS definitely scare me.
- flyGuyOnTheSly 7y agoAgreed. The bot I am currently working on is pushing 6,000 lines of code, and I feel like it might double in size before it's perfect.
- benj111 7y ago"40 lines of JS definitely scare me" Me too. I suppose it depends how you want to treat this though. As a bot programming challenge this seems fair enough. As something to entrust your or others life savings with? No.
- gridlockd 7y ago> As something to entrust your or others life savings with? No. As first rule, you shouldn't entrust anyone's life savings with a single trader. Forty lines of Javascript to me is far less scary than 40,000 lines. At least with forty lines, I can easily tell what the hell it is trying to do. In this case, it's just example code on how to use the API. Its "strategy" is to attempt to buy low and sell high. It doesn't really get any simpler than that.
- benj111 7y agoI was thinking more of the concept than this particular implementation. This is basically a minimum viable product for others to play around with. If that playing leads to bot trading competitions, fine. If it leads to someone building a 40k line monster and thinking it might be a good idea to entrust it with a meaningful proportion of anyone's savings.... No.
- thomasfromcdnjs 7y agoIt definitely should scare you =D The script is a tutorial to help complete beginners have an understanding of how to write a bot. Though you're right, I should have really made it more clear because it is real money.
- jandrese 7y agoWell, "real" money since we're talking about cryptocurrencies here.
- dcolkitt 7y agoFWIW, I just took a look at our HFT trading system. We specialize in colocated low latency market making in an equity market in a mid-sized country. The following line counts are only for the C++ code directly used in the production system. Doesn't count research, model fitting, ETL pipelines, build systems, etc. 75 kloc - Total line count 10 kloc - Common libraries, utilities, data structures, etc. 10 kloc - Reconstitutes the limit order book from the data feed 10 kloc - General framework (order management, margin tracking, logging, runtime control hooks, etc.) 7 kloc - Safety checks (pre/post trade, price, circuit breakers, etc.) 13k - Adapter for the exchange's datafeed protocol 5k - Adapter for the exchange's order gateway protocol 3k - System for correlating our orders within the datafeed 10k - Signals/alphas 8k - Trading logic Not claiming that other people's systems will necessarily look anything like ours, but my experience jibes with this too. Trading code is only about 10% of the total codebase for a production-ready trading system. Overall strategy-specific code (signals and trading logic) only make up 25% of the codebase, with the rest being all general-purpose "plumbing". Even a tiny inconsequential function that most people never think about- reliably identifying which orders in the data feed belong to us- takes nearly half the amount of code as nearly all the trading logic put together.