News for hackers. Stuff that matters.
Re:They say that stocks go down during the day and up at night by TeMPOraL on Tuesday February 07, 2023 @04:04AM (#34690424)
> I am only left with one question which I did not find answered anywhere yet - what exactly does day and night mean in the context of the whole world trading?

While we're at it, I have a related question: why do the exchanges even "open" and "close"? Surely in our globalized digital economy, it's not just "day" and "night" that are meaningless, but the very concept of "opening hours" itself.

Re:They say that stocks go down during the day and up at night by erfgh on Tuesday February 07, 2023 @04:08AM (#34690440)
Probably due to labor unions.
Re:They say that stocks go down during the day and up at night by techdragon on Tuesday February 07, 2023 @04:51AM (#34690720)
Actually, it’s mostly down to the computers now. Having downtime is advantageous to the primary customers of the stock market. If you have the same “off and on” times as your competitors you can ensure your operations are structured in such a way that you don’t have to deal with a whole class of systemic risks, no need to roll out up’s to FPGA powered acceleration devices live where the smallest mistakes can cost money for every second they are wrong let alone if they are broken … to more mundane things like being able to reprocess the data trading data and analyse performance vs other prediction models… effectively the downtime is for the high frequency traders and the algorithm traders and all the players paying for direct access to the stock market for their computer systems… it’s effective a digital cage match from bell ring to closing time and it’s in the best interests of all the competitors to only have to fight the same 8-12 hours in the cage, lest it becomes a much more expensive 24/7 war of attrition.
Re:They say that stocks go down during the day and up at night by andy_jensen on Tuesday February 07, 2023 @04:52AM (#34690728)
Yea, and people who drive electric cars!
Re:They say that stocks go down during the day and up at night by twic on Tuesday February 07, 2023 @04:53AM (#34690736)
I'd be interested to know how you came to that conclusion.
Re:They say that stocks go down during the day and up at night by bobthepanda on Tuesday February 07, 2023 @06:06AM (#34691248)
As a profession, Wall Street traders could not be farther from unionized.
Re:They say that stocks go down during the day and up at night by cmcconomy on Tuesday February 07, 2023 @12:18PM (#34695628)
the stock market has "gone woke"
Re:They say that stocks go down during the day and up at night by twic on Tuesday February 07, 2023 @04:52AM (#34690723)
Historically, it's because exchanges were real places that people went to, and it would be expensive and pointless to run them all night.

These days, there is a trend towards opening hours getting longer (eg [1]).

But there is still value to limited hours. Off the top of my head:

1. Liquidity gets concentrated. If there is a fixed amount of end-user demand (inflows into pension funds, oil production to hedge), then shorter hours means sort of 'denser' trading, which in turn means more quantity on the books, tighter prices, and better efficiency.

2. Trading is still done under human direction, or at least under human supervision, so shorter hours are less demanding on staffing. It's possible to run a productive soybean trading desk with two people at the moment. You'd need six people if trading was round the clock, and those people aren't cheap. Or else desks don't trade the whole day, and they miss out on opportunities, and other participants get less competition, and so worse efficiency.

3. Closing the market gives participants time to do various kinds of admin related to trading. Options markets close earlier than their corresponding futures markets, so that options market makers can get their position cleanly hedged. Bond markets close before repo desk traders go to the pub, so that bond trades can get financed.

[1] https://www.eurex.com/resource/blob/2845114/ae56de359f7a578e...

Re:They say that stocks go down during the day and up at night by devnullbrain on Tuesday February 07, 2023 @05:20AM (#34690921)
>Closing the market gives participants time to do various kinds of admin related to trading.

Trading firms can restart their software to fix the memory leaks.

Re:They say that stocks go down during the day and up at night by cwillu on Tuesday February 07, 2023 @06:31AM (#34691380)
Just another generation in the garbage collector.
Re:They say that stocks go down during the day and up at night by dahfizz on Tuesday February 07, 2023 @08:57AM (#34692768)
If anyone is wondering, this is not a joke. Some of the trading systems I've worked on were designed to be restarted every night. The memory didn't "leak", but was designed this way - preallocate all the memory you could need, and its "freed" when you restart at night.
Re:They say that stocks go down during the day and up at night by planede on Tuesday February 07, 2023 @09:28AM (#34693168)
> preallocate all the memory you could need

Well, why did they have to restart if they never made any further allocations? This does not add up.

Re:They say that stocks go down during the day and up at night by dahfizz on Tuesday February 07, 2023 @09:53AM (#34693517)
Because the memory fills up. You pre-allocate a million orders, and send 800k orders a day, leaving only 200k free slots. You're going to run out mid day tomorrow if you don't restart.
Re:They say that stocks go down during the day and up at night by planede on Tuesday February 07, 2023 @10:36AM (#34694133)
Ah, OK. But I would characterize this as an internal allocator that never deallocates. You might as well replace `malloc` and `free` to do the same, and just allocate within the program normally.

Just because you "preallocate" it doesn't mean that you don't implement a poor man's allocator inside the preallocated buffer.

Re:They say that stocks go down during the day and up at night by dahfizz on Tuesday February 07, 2023 @11:43AM (#34695058)
Sure, but calling malloc at runtime is slow and maintaining an allocator isn't very useful if you can just restart the app every night. YAGNI ;)
Re:They say that stocks go down during the day and up at night by JamesSwift on Tuesday February 07, 2023 @10:47AM (#34694283)
That just sounds like a memory leak with more words. Is the memory reclaimed/reclaimable? No? Ok then it leaked. If the system were able to reclaim the memory from the order, you wouldn't need to restart it. The memory arena strategy doesnt change that.
Re:They say that stocks go down during the day and up at night by TeMPOraL on Wednesday February 08, 2023 @06:27PM (#34717220)
It's still a fine strategy. One "formal" name for it I've heard is "null garbage collector". It may feel dirty, but it's pragmatic: if the program runs in cycles with well-defined starts and ends, restarting it reclaims all memory and brings the program to a well-known state.
Re:They say that stocks go down during the day and up at night by LgWoodenBadger on Tuesday February 07, 2023 @11:48AM (#34695138)
I buy all the groceries I need for a week. That's realistically achievable (cost, cargo capacity of my vehicle, storage capacity at home, etc.).

I buy all the groceries I need from now until the end of time. That's not realistically achievable, from any perspective.

Allocating all the memory you need for a day is realistically achievable. Allocating all the memory you need until the end of time is not realistically achievable.

Re:They say that stocks go down during the day and up at night by recursive on Tuesday February 07, 2023 @01:19PM (#34696708)
The grocery analogy doesn't work. When you're "done" with a particular "grocery", it's gone. It doesn't exist anymore. When you're done using a block of memory, you can use it again and again and again. Assuming you remembered to free it. Groceries work more like write-once memory.

Still sounds like a leak to me.

Re:They say that stocks go down during the day and up at night by TeMPOraL on Wednesday February 08, 2023 @06:34PM (#34717310)
It's a "leak" only if it creates problems for you, such as slowdown or risk of running out of memory. In this case, there are no such problems - memory use and execution time are both bounded. The memory gets automatically reclaimed when the program restarts (that's the job of the OS, and if it fails at it, you can always reboot the machine).

It's a perfectly fine way of engineering a system.

There's also a variant of this that's been used on missiles - basically, you put enough RAM on the weapon to guarantee it'll hit its target or run out of fuel before running out of memory.

Re:They say that stocks go down during the day and up at night by twic on Tuesday February 07, 2023 @10:12AM (#34693798)
Restarting software once a day to work around memory leaks is real amateur-hour stuff. Mine does it every 10-20 minutes.
Re:They say that stocks go down during the day and up at night by TeMPOraL on Wednesday February 08, 2023 @06:38PM (#34717356)
The real pros generalized this concept into so-called "supervision trees" - building your system as a hierarchy, where whenever a program misbehaves in any way, it gets restarted by a higher-level program, which itself will also be restarted if it can't get a handle on things, recursively to the top of hierarchy.

(Yes, talking about Erlang/OTP here.)

Re:They say that stocks go down during the day and up at night by none_to_remain on Tuesday February 07, 2023 @11:44AM (#34695068)
Yep.

I once was tracking a white whale of a memory leak. Along the way I was able to optimize memory usage of the leaked objects. So I got to the point where I thought maybe the leak was caused by simultaneous read, update, and delete operations on a single key, but by then I'd improved memory usage such that weekly, rather than nightly restarts were needed. The futures markets at the time were 24/7 but with a maintenance period on the weekends, so my boss just told me to leave it and let the restarts garbage collect.

Re:They say that stocks go down during the day and up at night by toyg on Tuesday February 07, 2023 @06:56AM (#34691577)
> You'd need six people if trading was round the clock, and those people aren't cheap.

That's not a good argument. If there were more openings for that kind of position, more people would apply, and average remunerations would get lower.

The real problem is that this would effectively distribute wealth (and access to wealth) more widely, and the ruling classes can't have that as a matter of principle.

Re:They say that stocks go down during the day and up at night by TheCoelacanth on Tuesday February 07, 2023 @09:52AM (#34693510)
Higher demand leading to lower prices? That's an interesting hypothesis.
Re:They say that stocks go down during the day and up at night by toyg on Tuesday February 07, 2023 @11:22AM (#34694750)
It's not a hypothesis, it's how the mass-market works. Take computation: as demand rose and rose, prices fell and fell. And yes, the education and career systems have commonalities with manufacturing.
Re:They say that stocks go down during the day and up at night by rfrey on Tuesday February 07, 2023 @11:57AM (#34695302)
In computation, the supply rose much faster (faster chips, cloud computing) than demand until the advent of widespread ML. And I haven't noticed the price falling much in the last few years.
Re:They say that stocks go down during the day and up at night by twic on Tuesday February 07, 2023 @10:15AM (#34693836)
Hiring six traders instead of two does not strike me as a form of wealth redistribution effective enough to warrant the attention of the all-powerful Illuminati, although i'll ask them next time i see them just in case.
Re:They say that stocks go down during the day and up at night by vjk800 on Tuesday February 07, 2023 @05:56AM (#34691182)
The world of finance is full of anachronisms like this. Exchanges are also closed on various bank holidays which are different in every country.
Re:They say that stocks go down during the day and up at night by em500 on Tuesday February 07, 2023 @06:17AM (#34691305)
Yup, that's why I think that stories about the benefits of having HFTs providing micro-second liquidity are bunk. Even without holidays and weekends, large stock exchanges only operate 7 hours per day, with a 17 hour gap of non-liquidity every day.
Re:They say that stocks go down during the day and up at night by jjoonathan on Tuesday February 07, 2023 @07:09AM (#34691672)
It's not an anachronism. Liquid markets behave verrry differently from illiquid markets.

In liquid markets, "AAPL is $141.23" makes sense. It means that you can expect to buy and sell almost as much AAPL as you want at very close to that price because there are loads of buyers and sellers near that price. You can pretend that AAPL stocks have a price like a lamp at home depot: "I would like 2 AAPL please" is a safe thing to say.

In illiquid markets, "AAPL is $141.23" does not make sense. "I would like 2 AAPL please" is not safe at all. There are bids and offers, but not necessarily a lot of them, and not necessarily near each other. If you were to place the "2 AAPL please" order (or something related like "$500 of AAPL please"), you might find that you have purchased 1 AAPL for $141.23 and 1 AAPL for $299.57 because there was a big gap in the order book. The price abstraction completely breaks down and you have to "haggle" with bids and offers directly.

"Ok," you might say, "liquidity is important, but surely we can just let the bots provide liquidity at night?" The problem is that markets are adversarial and bots can't really deal with "attacks" as well as humans (or at least the humans staking the money don't trust them to). There is all sorts of craziness that a market-making bot can't handle, and if you encourage people to rely exclusively on market-making bots then they can be taken advantage of (oh no, AAPL is down 50%, better sell, wtf, price shot right back up, rage).

It's safer and smarter to just have everyone agree on convenient blocks of time to crowd into the market. During those periods of time the market can be assumed liquid. The price abstraction works.

"But I'm a big boy and I want to live in the danger zone, let me trade at night!" Go right ahead. It's not only possible, it's readily available and people do it all the time. You can probably request some degree of after-hours trading from your brokerage right this minute. It's usually pretty easy -- usually you just have to ask for them to enable permission and promise that you know what a limit order is. Usually market orders are disabled, too, because they know that plenty of people would hit "accept," shoot themselves in the foot, and complain anyway :)

Re:They say that stocks go down during the day and up at night by vjk800 on Tuesday February 07, 2023 @01:51PM (#34697232)
Bots wouldn't be required to provide liquidity during night hours. People living on the other side of the world will do just fine. We live in a global world now and people can buy stocks wherever using the internet, not just in the physical exchange like in the old days.
Re:They say that stocks go down during the day and up at night by jjoonathan on Wednesday February 08, 2023 @09:39PM (#34719087)
...and they can trade after hours just like anyone else who jumps through the minor hoops, yet crazy price action after hours is still an observational facts.
Re:They say that stocks go down during the day and up at night by toast0 on Tuesday February 07, 2023 @12:01PM (#34695372)
> Exchanges are also closed on various bank holidays which are different in every country

You can't settle on a bank holiday, because the banks are closed. If you trade on a day you can't settle, you're going to have two days of trading settling on the same day later, which is going to be weird.

Re:They say that stocks go down during the day and up at night by turbonaut on Tuesday February 07, 2023 @01:46PM (#34697155)
Weird or not, it happens in spot foreign exchange.

For example, if there’s a US holiday on a Friday then EUR/USD trades conducted on the Wednesday and Thursday would both typically settle Monday.

Re:They say that stocks go down during the day and up at night by vjk800 on Tuesday February 07, 2023 @01:52PM (#34697261)
I count banks as part of the world of finance. Why do bank transactions need to stop during bank holidays? They are done by computers nowadays.
Re:They say that stocks go down during the day and up at night by toast0 on Tuesday February 07, 2023 @03:08PM (#34698690)
Because the bank is on holiday. That's right there in the name.
Re:They say that stocks go down during the day and up at night by andreareina on Tuesday February 07, 2023 @07:27AM (#34691832)
I don't know if it's the reason, but I understand that a lot of market-moving news is released after close so that participants have time to digest it and decide whether their positions still make sense. The next day's opening auction will deal with the increased volatility better (see the story about the NYSE "forgetting" to hold the opening auction and the resulting chaos)
Re:They say that stocks go down during the day and up at night by dahfizz on Tuesday February 07, 2023 @08:54AM (#34692722)
Nobody just presses "start" on their trading algo and takes a nap the rest of the day. Even market makers, who have a simple and easily-automatable trading strategy, have a team of traders constantly tweaking the parameters to their algos.

I guess they could hire a second and third shift, but they also could have done that back when stocks were traded on paper and over the phone. The will just isn't there.