Is there a guide on how to set up Submarkets on existing worlds? I wanna make a special shop that only sell a few specific ships on some core worlds.
I don't think so, but to get you started:
1) Make a new class that extends BaseSubmarketPlugin and create the logic to do what you want. For an example, see: com\fs\starfarer\api\impl\campaign\submarkets\BlackMarketPlugin.java (This is a good reference point for doing lots of things with the BaseSubmarketPlugin.)
2) Add an entry in Submarkets.csv (starsector-core\data\campaign) which points to your plugin. (Note: Your version of the csv from a mod standpoint must match the path of vanilla's csv and share the same name in order to merge into the games list of submarkets.)
3) Now the submarket is available with an id. My recommendation would be to add that id to the Submarkets enum in case you need it in enum form for other methods, but for adding a submarket to the MarketAPI of an entity you can just use the id I believe.
4) Create a script to find the markets you want through their entity ids and add the new submarket to them.
5) Add the script to your mod plugin - onNewGameAfterEconomyLoad() or onNewGame() is probably the best place.
(EDIT: More informative in this format and I may expand it. For any details of any component of the explanation - or any additional clarification - post here or PM me!)