There's a bunch of ways that this could be done.
First, you gotta decide what you wanna use as input. A trade building with spells? Chat commands? Dialog buttons?
Lets say that you go with chat command.
Then you'd have to decide the usability flow of a trade. This could be open trading with any players in your team, or a specific offer to a specific team member. The ladder is probably simpler to develop, so lets say you go with that.
So, lets say that player 1 red wants to trade 500 lumber for 1000 gold to his ally, player 2 blue.
The chat command that starts it, could be something like: "/trade 2 500 L 1000 G"
If you break that into space separated substrings, you have player 1 wanting to trade with player 2, his offer (500), of the currency "Lumber"(L) for 1000 of the currency "Gold"(G).
This trade request is then saved using 1 of a variety of methods, such as a hashtable, dynamic arrays, or etc.
Then player 2 has to either accept or decline the trade offer, either by referring to it using a trade ID, or by causing the system itself to only allow 1 active offer at a time.
Then, if player 2 should decide to accept this trade, the trade system should attempt to complete it, checking the required conditions first. This should probably include checking to see if the players actually have the required resources.
That's just 1 example of how this can be done. It's also possible to use a shop building as the interface. This would make the system much simpler to learn for the players, but would likely limit its flexibility, or be clunky to use for specific trade requests.
Another option is an "auction house" type deal, where you deposit X amount of resources to a listing with Y as the unit price. Then people can buy out your listed resources in whatever quantity they might want.