Blog
Side Project venezuela integrationsJan 19, 2024 - 7 MIN READ
Using the official exchange rate in Venezuela's e-commerce

Using the official exchange rate in Venezuela's e-commerce

Published an open-source scraper that solves daily manual exchange-rate entry for Venezuelan e-commerce teams

PythonFastAPIWeb ScrapingREST API
Iván Álvarez

Iván Álvarez

Situation

TL;DR

Venezuelan e-commerce platforms are required by law to invoice in bolívares while most catalog pricing stays in USD. Manual daily exchange-rate entry is error-prone and not scalable. This post walks through the scraping approach, a simple FastAPI microservice that can be deployed anywhere, and when you'd actually use it vs. a third-party rate API.

Context

Venezuela's e-commerce sector is expected to grow thanks to increasing internet penetration, an evolving legal framework, and banks that now provide more secure transactions 1. After the pandemic, business boomed; the law requires invoices in the national currency (Bs.), but most products and transactions are advertised in USD. Let's look at two examples:

Librería La Alegría is a bookstore and stationery store that offers over 15,000 products related to office supplies, school items, art supplies, technical and school books, games, and more. The store also provides a cultural center for the city with workshops for children and events 2.

Its tech stack is an Odoo instance. There's no mobile app and billing happens directly in-store. A quick search indicates there are three extensions and one of them is free, but it might not be open source—I couldn't find a repo.

Tu Zona Market is an online marketplace that connects local vendors with customers. The platform offers a range of products, including groceries, electronics, and home appliances, and provides a seamless shopping experience in two states 3.

They appear to use Angular with what looks like an Express backend, although I can't be certain. To stay compliant they need a few things:

  1. A web scraper: a program that extracts data from a website by parsing its HTML code.
  2. RESTful APIs with minimal code and high performance.
  3. Database storage for historical data (for returns, refunds, and the like).

If you use a service like Exchange Rate API you can get the daily exchange rate, but you could get rate-limited quickly.

Solution

Decision: API service or scheduled job?

You have two paths here:

OptionTrade-offChose
Third-party exchange rate API (e.g., exchangerate-api.com)You pay per request or per month; rate-limited on free tier; adds a dependency
Build your own scraper + microserviceRuns on your infrastructure; handles bursts free; full control of the rate feed

For Venezuelan platforms, the scraper wins: the Banco Central publishes daily, regulation requires the official rate, and you avoid external rate limits. Deploy it on the infrastructure you already have.

Implementation

If you have hardware

Creating a web scraper and using it with crawlab as storage in MongoDB is a great solution.

If you don't

A simple web scraper built in Python with FastAPI can be useful for a software developer who wants to access and analyze the financial data from the official website of Banco Central de Venezuela.

By using a web scraper built in Python with FastAPI, you can:

  • Automate the process of fetching the latest exchange rates from the Banco Central de Venezuela website.
  • Convert the scraped data into JSON format, which can be stored, transmitted, and processed by various applications and tools.
  • Create a custom API that exposes the scraped data as endpoints, which can be accessed by other developers or users who need the data for their own purposes.
  • Apply data analysis, visualization, or machine learning techniques to the scraped data, using the rich set of libraries and packages available in Python.

I published a starter implementation in this repo.

Let me know if you have any questions.

References

Outcome

The BCV scraper is now published as an open-source starter repo. It eliminates a recurring manual task (daily copy-paste of exchange rates) and becomes a building block for any Venezuelan e-commerce or SaaS platform that needs rate compliance. Developers can fork it, customize it for their needs, and deploy it on the infrastructure they already have.

References

Photo by Frederick Medina on Unsplash

Footnotes

  1. E-commerce in Venezuela. https://www.lloydsbanktrade.com/en/market-potential/venezuela/ecommerce.
  2. Librería La Alegría. https://www.librerialaalegria.com.ve/.
  3. Tu Zona Market. https://tuzonamarket.com/.