Live data from Hacker News

I Wrote a High-Frequency Trading Platform in D

dlang.org

1–10 of 16 posts

Re: I Wrote a High-Frequency Trading Platform in D

#2
D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get started. Would love to see how this trading platform is implemented, but I doubt source is available. I've seen Walter Bright posting on here from time to time, and get a good impression of him from his comments. Anyone else have experience with D they'd like to share?

Re: I Wrote a High-Frequency Trading Platform in D

#3

D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get st…

It's basically C++ done right. Much more easy to learn than C or C++ and be productive in it from day one. It won't become boring or annoying like Go, because the language is loaded with features and there's always something new to learn. It's garbage collected, so you don't need to worry too much abot allocating and freeing memory, but it's helpful to have an insight and understand how it works (there are articles about it on dlang.org). Of course, one could also disable it. Of course Go has many more good quality libraries for just about anything you could dream of, but D interfaces very well with existing C and C++ libraries.

Re: I Wrote a High-Frequency Trading Platform in D

#4

D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get st…

D is an excellent mix of good design decisions, metaprogramming (your macros can run arbitrary code at compile time, a la zig), and a nice standard library. They also have some of the best API-building libraries available, and the compiler has the ability to run source code almost as if it were interpreted and it caches binaries under /tmp/ to avoid work if the source is unchanged.

Re: I Wrote a High-Frequency Trading Platform in D

#5

D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get st…

D is an excellent mix of good design decisions, metaprogramming (your macros can run arbitrary code at compile time, a la zig), and a nice standard library. They also have some of the best API-building libraries available, and the compiler has the ability to run source code almost as if it were interpreted and it caches binaries under /tmp/ to avoid work if the source is unchanged.

Yeah, I was poking around in the compiler source and noticed a D file with the #! prefix so it could be executed in interpreted mode. Just like tcc does, except I guess it would work for any valid D program, unlike tcc which won't compile all C code. That's a great feature to have. I do get the impression from looking at it at a distance that it's well designed.

Re: I Wrote a High-Frequency Trading Platform in D

#6
post #3

D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get st…

It's basically C++ done right. Much more easy to learn than C or C++ and be productive in it from day one. It won't become boring or annoying like Go, because the language is loaded with features and there's always something new to learn. It's garbage collected, so you don't need to worry too much abot allocating and freeing memory, but it's helpful to have an insight and understand how it works (there are articles a…

I'm a C guy and have played around with C++ back in the day, but have come to despise the language, with all of its increasing complexity, warts, design flaws, and footguns. I'm highly suspicious of Rust and Go as well. I prefer the C way of doing things, with no garbage collector, though I do tire sometimes of all the extra grunt work that goes into implementing anything in C. Looks like D has a lot of features geared toward making development faster, without loading up with too much complexity like C++. Just read about the 'better C' mode which sounds interesting. I like that it's made to integrate seamlessly with C libraries. Are there any good examples of larger programs or libs written in D you could point me towards, so I can learn by example the 'D way' of doing things?

Re: I Wrote a High-Frequency Trading Platform in D

#7

D is an interesting language, but I don't really know much about it. Seems like the first time I ever heard of D was in a BBS files listing back in the 90s. That must have been right around when it first came out. Since then I hear about it from time to time, but never checked it out, until yesterday, when I happen to have finally downloaded the compiler. I'm now looking for code samples, tutorials and such to get st…

Unless that was the very late 90s that might not have been D, since D was born roughly in 2000 ish I think.

Anyway D is a good language. It pays my bills.

You take from D what you bring. If you basically want to write C++ with nicer OOP you can, if you want to write heavy-metaprogramming functional code then you can as well.

The only thing I would say is that D is a language that does take a little programming experience to really appreciate.

Re: I Wrote a High-Frequency Trading Platform in D

#8
post #3

Earlier quoted context omitted.

It's basically C++ done right. Much more easy to learn than C or C++ and be productive in it from day one. It won't become boring or annoying like Go, because the language is loaded with features and there's always something new to learn. It's garbage collected, so you don't need to worry too much abot allocating and freeing memory, but it's helpful to have an insight and understand how it works (there are articles a…

I'm a C guy and have played around with C++ back in the day, but have come to despise the language, with all of its increasing complexity, warts, design flaws, and footguns. I'm highly suspicious of Rust and Go as well. I prefer the C way of doing things, with no garbage collector, though I do tire sometimes of all the extra grunt work that goes into implementing anything in C. Looks like D has a lot of features gear…

I wouldn't bother with betterC. Use the language as it's intended to be used first.

Re: I Wrote a High-Frequency Trading Platform in D

#9
> I had to work with fixed-size ASCII strings that are not NUL-terminated and are, instead, padded with spaces at the end.

When I have strings on performance-critical paths, unless they’re too long for a good reason, I sometimes pad them with \0 and limiting them to 16- or 32-bytes length. This way I can pass strings in a vector register by value (i.e. __m128i or __m256i data type in C++), and they’re very efficient to deal with. For instance, comparing them for equality only takes two instructions, vpxor and vptest (_mm_xor_si128 and _mm_testz_si128 intrinsics for 16-byte vectors), that’s 3-4 cycles of latency, an order of magnitude better than comparing traditional C or C++ strings.

I don’t have any experience with dlang though, not sure how easy or hard to implement that in D.

Re: I Wrote a High-Frequency Trading Platform in D

#10
post #3

Earlier quoted context omitted.

It's basically C++ done right. Much more easy to learn than C or C++ and be productive in it from day one. It won't become boring or annoying like Go, because the language is loaded with features and there's always something new to learn. It's garbage collected, so you don't need to worry too much abot allocating and freeing memory, but it's helpful to have an insight and understand how it works (there are articles a…

I'm a C guy and have played around with C++ back in the day, but have come to despise the language, with all of its increasing complexity, warts, design flaws, and footguns. I'm highly suspicious of Rust and Go as well. I prefer the C way of doing things, with no garbage collector, though I do tire sometimes of all the extra grunt work that goes into implementing anything in C. Looks like D has a lot of features gear…

I'm a D newbie myself. Existing larger programs usually use advanced language functionality (like pure functions, generics, templates), which is a bit overhelming when learning a new programming language. You can use this resources page and pick up whatever interests you:

https://github.com/dlang-community/awesome-d

If you insist dissecting existing code, the Hunt library is well commented and seems more approachable. It uses OOP and some templates.

Post reply on HN