Calculated: Trade Ports vs. Refineries
1 Tradeport (all fast)
income is 1.6 cred/s. That's the default if it's just one ( I know, I know, they pay off quicker when in a trade line, but this is just a base start). For my calculations I'm going to use 2 cred/sec. That's about a 3-4 planet chain on all fast.
I use 1 resource = 4.5 cred
750 cred + 100 metal + 125 crystal = 1762.5 cred
1762.5/2 = 881.25 sec or 14.7 minutes. That's the slowest it will take for a tradeport to pay itself on all fast if you've built up a 3-4 planet chain.
Now a refinery costs
1500 cred + 125 metal + 175 crystal = 2850 cred
Now, the best I can tell after looking at the entity file, a refinery will give you (and this is on all fast) .08 * 1.2 resource per second, or .096 resource per second PER MINE ( all fast gives you 20% more income on fast than the set default on slow).
So how many mines do we need for the refinery to pay itself off in 14.7 minutes? It needs to generate 3.23 cred/sec, or .564 resource per second.
Refineries are not affected by allegiance factors.
This comes out to a refinery needs 6 mines near it to be worth it. Finding that isn't too hard. What's ideal is to look for planets with a minimum of 3 (4 is preferable, I've seen up to 8 phase lanes before) phase lanes and put 3 refineries there. They will pay themselves off. They just cost more to get, so it's risk/reward building.
If you're Vasari you're selling ur extra resources for creds. I don't know how much of a difference this makes, because losing 50% of their worth in trade undoubtably has a big effect. How big though, I don't know.