Recent

Author Topic: get the value of the dollar in each currency of each country  (Read 4220 times)

Ericktux

  • Sr. Member
  • ****
  • Posts: 252
get the value of the dollar in each currency of each country
« on: November 28, 2021, 04:32:50 am »
good night brothers, does anyone know how to get the updated price of the dollar in the currency of each country?
for example to obtain the public IP I have seen that a website is consulted and a result is received.
If someone has any idea please help me.

jamie

  • Hero Member
  • *****
  • Posts: 5141
Re: get the value of the dollar in each currency of each country
« Reply #1 on: November 28, 2021, 10:53:48 pm »
I am sure by now you will find it kind of hard to simply down load a single file which would nice of course if you could find a reliable link to do so..


Have a look here. It is an example of getting the current exchange rates

 Of course you need to understand C a little and a little XML.

https://www.codementor.io/@dewetvanthomas/tutorial-currency-converter-application-for-c-121yicb1es
The only true wisdom is knowing you know nothing

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1817
  • Former Delphi 1-7, 10.2 user
Re: get the value of the dollar in each currency of each country
« Reply #2 on: November 29, 2021, 01:35:11 am »
Be aware that the terms of use for all the currency websites I've used explicitly forbid the automatic or manual systematic extraction of their data.
Lazarus 2.3, FPC 3.3.1 macOS 12.1 x86_64 Xcode 13.2
Lazarus 2.3, FPC 3.3.1 macOS 12.1 aarch64 Xcode 13.2
Lazarus 2.3, FPC 3.2.2 FreeBSD 13.0 amd64 VM
Lazarus 2.3, FPC 3.2.2 FreeBSD 12.2 amd64 VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 VM
Lazarus 2.0.10 FPC 3.2.0 Win10 amd64 VM

kapibara

  • Hero Member
  • *****
  • Posts: 549
Re: get the value of the dollar in each currency of each country
« Reply #3 on: November 29, 2021, 05:30:47 am »
Maybe it's overkill, but using Python within Lazarus is a very powerful way of getting and updating any kind of data from the web. You could install Python4Lazarus (maintained by Alexey), write a python script and run it within a Lazarus application. From Python you could even have the script start a (headless, invisible) browser that manages logins, and then saves your data to disk. Some components in Python4Lazarus have events so you can get a notice when certain things has taken place within the script while it is running. https://github.com/Alexey-T/Python-for-Lazarus

There is a learning curve for doing this, but if the data is difficult to get it could be worth it. I use Spyder 4.0 to write and test scripts, it has code-completion. If you go this route, I suggest installing something like Spyder, write a python script that successfully grabs data and then run it from Lazarus. You probably want to parse, check and save the data in a database and being a beginner in Python I prefer doing that using Lazarus and Object Pascal.
« Last Edit: November 29, 2021, 05:42:36 am by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 21.10 - 64 bit

wp

  • Hero Member
  • *****
  • Posts: 9175
Re: get the value of the dollar in each currency of each country
« Reply #4 on: November 29, 2021, 07:00:47 pm »
does anyone know how to get the updated price of the dollar in the currency of each country?
I have a small program for this on my github: https://github.com/wp-xyz/ExchangeRates
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Ericktux

  • Sr. Member
  • ****
  • Posts: 252
Re: get the value of the dollar in each currency of each country
« Reply #5 on: December 02, 2021, 03:57:12 am »
Thank you all very much, especially to WP, your example runs perfect, I already believe my "APP ID" and the program works very well, thank you very much.   :) :)
« Last Edit: December 02, 2021, 03:59:28 am by Ericktux »

 

TinyPortal © 2005-2018