The formation of the International Settlement (foreign concession areas) in Shanghai was the result of the Treaty of Nanking of 1842 (which ended the First Opium War) and subsequent agreements between the Chinese and foreign governments were crucial to the development of foreign trade in China and of the foreign community in Shanghai. The market for securities trading in Shanghai begins in the late 1860s. The first shares list appeared in June 1866 and by then Shanghai's International Settlement had developed the conditions conducive to the emergence of a share market: several banks, a legal framework for joint-stock companies, and an interest in diversification among the established trading houses (although the trading houses themselves remained partnerships).