Earlier quoted context omitted.
Not if we disallow it. We have laws in place to try and prevent a lot of natural actions of markets.
Instant biggest black market of all time, corruption skyrockets, only the richest people get fair deals on investments.
C++ patterns for low-latency applications including high-frequency trading
91–100 of 240 posts
Re: C++ patterns for low-latency applications including high-frequency trading
#92Earlier quoted context omitted.
Non-bitcoin transactions are just a couple of entries in various databases. Mining bitcoin is intense number crunching. HFT makes the financial markets a tiny bit more accurate by resolving inconsistencies (for example three pairs of currencies can get out of whack with one another) and obvious mispricings (for various definitions of "obvious")
That's a nice fairy tale that they probably tell their kids when asked, but what the profitable firms are doing at the cutting edge is inducing responses in the other guys' robots, in a phase that the antagonist controls, then trading against what they know is about to happen. It is literally market manipulation. A way to kill off this entire field of endeavor is to charge a tax on cancelled orders.
You have to allow strategies that can induce other strategies as by definition those also increase liquidity. It’s a difficult problem to explain to anyone except the very few people who can understand the extremely complicated feedback loops that result from bots fighting bots, however the regulators actually have access to counterparty tagged exchange event data and what is found when this is analyzed is that the net cost for liquidity that is extracted by market makers and short term traders from longer term participants is continuously decreasing not increasing. The system is becoming more and more efficient and not less. This is good for markets and the economy. There are also less people working in financial markets per capita than ever before, granted those who are might include a higher percentage of highly skilled and specialized and educated individuals than previously, which some might argue might be better used in some other industry, but that is rightfully not what the market wants.
There is absolutely no logical reason to “kill off this entire field” those sentiments are purely envy based reactions from those who don’t understand what is happening.
Re: C++ patterns for low-latency applications including high-frequency trading
#93Earlier quoted context omitted.
That's a nice fairy tale that they probably tell their kids when asked, but what the profitable firms are doing at the cutting edge is inducing responses in the other guys' robots, in a phase that the antagonist controls, then trading against what they know is about to happen. It is literally market manipulation. A way to kill off this entire field of endeavor is to charge a tax on cancelled orders.
Yep and what's worse is many hft firms aren't in the market-making business at all but actually REMOVE liquidity.
Re: C++ patterns for low-latency applications including high-frequency trading
#94> The noted efficiency in compile-time dispatch is due to decisions about function calls being made during the compilation phase. By bypassing the decision-making overhead present in runtime dispatch, programs can execute more swiftly, thus boosting performance. The other benefit with compile-time dispatch is that when the compiler can statically determine which function is being called, it may be able to inline the…
AFAIK, the speedup is almost never function call overhead. As you mention at the tail end, it's all about the compiler optimizations being able to see past the dynamic branch. Good JITs support polymorphic inlining. My (somewhat dated) experience for C++ is that PGO is the solve for this, but it's not widely used. Instead people tend to avoid dynamic dispatch altogether in performance sensitive code.
I think the more general moral of the story is to avoid all kinds of unnecessary dynamic branching in hot sections of code in any language unless you have strong/confidence your compiler/JIT is seeing through it.
Re: C++ patterns for low-latency applications including high-frequency trading
#95Earlier quoted context omitted.
That's a nice fairy tale that they probably tell their kids when asked, but what the profitable firms are doing at the cutting edge is inducing responses in the other guys' robots, in a phase that the antagonist controls, then trading against what they know is about to happen. It is literally market manipulation. A way to kill off this entire field of endeavor is to charge a tax on cancelled orders.
If one outlawed / disincentivized hostile the bot behavior you described, there would still be the opportunity to do the good and profitable things I described.
Re: C++ patterns for low-latency applications including high-frequency trading
#96Earlier quoted context omitted.
foo(const bar&) is ideal if you precisely wish to bar ownership. If (and in many kinds of projects, invariably it's more like when) you later decide to share ownership, or if nullptr is an option, then it's no good. foo(std::shared_ptr ) is copy-constructed as part of your function call (bumping the refcount) unless copy elision is both available and allowed. It's only ideal if you almost always pass newly instantiat…
foo(const bar&) is ideal if you precisely wish to bar ownership. What? invariably it's more like when) you later decide to share ownership, shared_ptr shouldn't even be necessary for keeping track of single threaded scope based ownership. As for shared_ptrs being very rare, uh, no. We use them by the truckload. To each their own! You might want to look into that, you shouldn't need to count references in single threa…
The context you're missing is in your post's GP. That poster holds a std::shared_ptr (for whatever perfectly valid reason) and wishes to pass it to foo(). However, he declares it as foo(const bar &) because the callee does not need to share in the ownership of the shared_ptr. That means it gets called as foo(*p.get()).
> scope based ownership
That's the incorrect assumption that you came to. Obviously if bar is only used for stack-based scope variables, no shared_ptr is needed.
Re: C++ patterns for low-latency applications including high-frequency trading
#97Earlier quoted context omitted.
All the java libs that you use can never do an allocation -- ever!. So you don't really get that much benefit to the java ecosystem (other than IDE's). You have to audit the code you use to make sure allocations never happen during the critical path. Fifteen years ago, the USN's DDX software program learned this the hard way when they needed a hard real time requirement in the milliseconds.
In my experience: Allocation is OK, but garbage collection is bad.
shared_ptr is a much better solution for garbage collection. One I wish that java had implemented.
Re: C++ patterns for low-latency applications including high-frequency trading
#98Earlier quoted context omitted.
OTOH, it might be a net negative in latency if you're icache limited. Depends on the access pattern among other things, of course.
Yup, you always have to measure. Though my impression is that compilers tend to be fairly conservative about inlining so that don't risk the inlining being a pessimization.
So, statistics and heuristics.
Re: C++ patterns for low-latency applications including high-frequency trading
#99Is there any good reason for high-frequency trading to exist? People often complain about bitcoin wasting energy, but oddly this gets a free pass despite this being a definite net negative to society as far as I can tell.
A net negative to society, but a positive for the wealthiest.
No.
When your passive index fund manager rebalances every month because “NVDA is now overweighted in VTI, QQQ” the manager does not care about the bid/ask spread.
When VTI is $1.6 trillion, even a $0.01 difference in price translates to a loss $60 million for the passive 401k, IRA, investors.
HFT reduces the bid/ask spread, and “gives this $60 million back” to the passive investors for every $0.01 price difference, every month. Note that VTI mid price at time of writing is $272.49.
Re: C++ patterns for low-latency applications including high-frequency trading
#100Is there any good reason for high-frequency trading to exist? People often complain about bitcoin wasting energy, but oddly this gets a free pass despite this being a definite net negative to society as far as I can tell.