Sunan Ibn Majah, Book 12, Hadith 2346 (In-Book)

It was narrated from Umar bin Muhammad bin 'Ali bin abi Talib, from his father, that his grandfather said: 'The Messenger of Allah said: 'Dinar for Dinar, Dirham for Dirham, with no increase between them. Whoever has need of silver, let him trade gold for it, and whoever has need of gold, let him trade silver for it, and let the transaction be done on the spot."'

حَدَّثَنَا أَبُو إِسْحَاقَ الشَّافِعِيُّ، إِبْرَاهِيمُ بْنُ مُحَمَّدِ بْنِ الْعَبَّاسِ حَدَّثَنِي أَبِي، عَنْ أَبِيهِ الْعَبَّاسِ بْنِ عُثْمَانَ بْنِ شَافِعٍ، عَنْ عُمَرَ بْنِ مُحَمَّدِ بْنِ عَلِيِّ بْنِ أَبِي طَالِبٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ الدِّينَارُ بِالدِّينَارِ وَالدِّرْهَمُ بِالدِّرْهَمِ لاَ فَضْلَ بَيْنَهُمَا فَمَنْ كَانَتْ لَهُ حَاجَةٌ بِوَرِقٍ فَلْيَصْطَرِفْهَا بِذَهَبٍ وَمَنْ كَانَتْ لَهُ حَاجَةٌ بِذَهَبٍ فَلْيَصْطَرِفْهَا بِالْوَرِقِ وَالصَّرْفُ هَاءَ وَهَاءَ ‏" ‏ ‏.‏

sunnah.com