Trade Ports allow your civilization to conduct trade between the various planets in the system, which earns the player credits.
Trade ports give your empire a constant flow of credits, the galaxy's standard currency. You can optimize trade growth by creating trade routes. Multiple trade ports can be built on a planet that will also increase the income from that particular planet's trade. The Advent are the only race that cannot directly upgrade their base trade income. The Trade Port additionally functions as a refinery for the Advent through Resource Focus. Trade Ports can be built faster depending on how many constructors you have in your gravity well through the Communal Labor ability.
The Transcendia Starbases can be upgraded to function as a Trade Port as well.
The base income rate for a trade port is 1 credit per second. 0.075 credits per second are added to the income for each of your trade ports for each jump in the longest trade route you have. For example, if you have a continuous trade route 4 jumps long, you would earn 1.3 credits per second at each of your ports. Multiple ports at a planet DO stack. You receive income for each of them. However, it is better to spread your ports out, so you expand the length of your longest trade route and boost your income more.
Trade depots send out trade ships to do their work. If a trade ship is destroyed, credits are awarded to the destroying player and the income of the depot goes down until it is replaced in 25 seconds.
In the Entrenchment micro-expansion, Starbases can function as a Trade Port with an upgrade, Trade Facilities for the Argonev Star Base, Merchant Docks for the Transcencia Star Base, and Merchant Cargo Bays for the Orkulus Star Base.
Trade Routes were explained a little bit above. But to go into more detail a Trade Route is established after you place down two trade ports on two adjacent worlds. The more you continue this in a line the more Credits you will recieve per trade port. As breaking the chain is not optimal and can actually lose you income.
Another thing to note is that Trade Routes do not work in triangles. So looking at the image to the bottom left.. You can have a trade port on Planet A and it will go to planet B and any adjacent planets that are off in the distance. However, you cannot have trade ports going from Planet A to Planet C to Planet B. A Breadth First Search algorithm is used to calculate the longest paths.