This code and paired youtube video go over getting the price of Algorand on-chain using a smart contract via testnet.
There is also a method from which you can input an amount of USD eg; $1000 and receive an output that is the equivalent amount in Algorand.
Note that the scaling factors were adjusted post-recording for a more accurate decimal representation.
See "4_without_contract.py" for executing the same logic without writing a smart contract!
https://nodely.io/docs/free/start
See Algo-Learn Tutorial Series for other videos on building things like Marketplaces, Staking Smart contracts, and NFT modifying contracts— while also learning everything you need to write your own smart contracts! Website: https://algo-learn.com/ Youtube Playlist: https://youtube.com/playlist?list=PLfEzhqrD5SJ05tfER-CbtSPdh2C8znO_D&si=DWlTijooR0joDQRu