Recent

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

Ericktux

  • Sr. Member
  • ****
  • Posts: 257
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.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1969
  • Former Delphi 1-7, 10.2 user
Re: get the value of the dollar in each currency of each country
« Reply #1 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.3.1 x86_64 Xcode 13.3.1
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.3.1

kapibara

  • Hero Member
  • *****
  • Posts: 561
Re: get the value of the dollar in each currency of each country
« Reply #2 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: 9578
Re: get the value of the dollar in each currency of each country
« Reply #3 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: 257
Re: get the value of the dollar in each currency of each country
« Reply #4 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