This is a controversial topic.
The answer of ttspeakseason makes sense. I once thumbed up it, but now it said that I was not allowed to do it twice. So I put my answer here.
Despite this, some ones may argue that the explanation above is not very reliable, because they didn't happen at the same time that "东西" being seen in books and "east west market" being established.
Another explanation is that it is a symbolisation with distinctive Chinese flavor. For example, because things happen from spring to winter, so we say "spring winter"(春秋) instead of "history". Similarly, because things grow in the east, west, north, south, so we say "east west" instead of "stuff". I assume that maybe because conventionally, we only pick up the first one or two words instead of the whole. (The normal sequence in Chinese is: east-west-south-north-center)
While streatman's opinion is: Chinese ancestors viewed “the five elements” (mental, wood, water, fire, earth) were corresponded to east, west, south, north, center, respectively. While in these five elements, only mental and wood can be taken as containers. Hence people begun to use "east-west" to imply "things". While I think this explanation is probable made up by modern people. Because to some extent, "mental" and "wood" are only an abstract and general concept, they don't not really refer to mental and wood physically.