Skip to content

Cuban market

Summary

This Neuron allows you to get the latest data on the Cuban market, having two main endpoints: the currency exchange prices and the products prices. The data is obtained from different sources, such as Telegram groups and websites, and it is updated dialy. Find below the details of each endpoint:

  1. Curency Exchange API allows you to get the latest currency exchange prices between every possible combination of currencies that are used in Cuba, such as CUP, MLC, USD and EUR. The prices are different to the official ones, so it's called the unofficial market prices. To obtain the price of a currency exchange, the neuron uses a modified median to get the final price between many prices obtained. Also, it has a selling price and a buying price that are finally combined into a final price. The minimum and maximum prices are also provided, as well as the volume of the announces.

  2. Products Prices API allows you to get the latest prices of the most common products in Cuba, such as food, drinks, etc. The prices are obtained from different websites that sell these products or announce them. To get the price of a product the API uses a median between different prices from this sources, grouped by the measure unit of the product. In this case, it's also provided minimum price, maximum price and the volume.

Info

Note that the same product can have different measure units, so the price is provided for each of them. Also, the prices are shown in CUP (Cuban Pesos).

Warning

The prices are not official, so they can vary a lot from the official ones and it's possible to find different prices in other sources. This API is intended to give an idea of the prices in the Cuban market, but it's not an oficial source by a cuban financial institution.

Use Cases

Here are some key use cases for the Cuban Market Data Neuron:

  • Access to Cuban Market Data: Get access to the latest data on the Cuban market, including currency exchange prices and product prices.
  • Financial Analysis: Make a financial analysis of the Cuban market, to know the prices in the unofficial market, and to compare them with the official ones.
  • Predictive Analysis: Predict the prices in the future to make decisions based on them.
  • Financial Planning: Plan the financial resources based on the prices of the products and the currency exchange.
  • Market Comparison: Know the differences between the prices of the products in Cuba and other countries.
  • Trend Analysis: Evaluate trends in the market to make better financial decisions.

API & Endpoints

/v2/currency_exchange

GET /v2/currency_exchange

This endpoint allows you to get the latest currency exchange prices between the currencies used in Cuba.

Headers:

Authorization: Bearer YOUR_ACCESS_TOKEN

This header must be included in every request to authenticate the user.

  • Header name: Authorization
  • Header format: Bearer <your_token>

If omitted or incorrect, the server will respond with a 401 Unauthorized error.

Parameters:

  • period: The period of time between the prices. Can be day, week, month, quarter or year.
  • date_from: The start date of the period. Format: YYYY-MM-DD. This parameter is optional.
  • date_to: The end date of the period. Format: YYYY-MM-DD. This parameter is optional.
Info

The date_from and date_to parameters are optional. If the date_to parameter is not provided, the current date will be used. If the date_from parameter is not provided, the period will be one week before the date_to parameter.

Example using Python and requests
import requests
import json

url = f"{api_url}/v2/currency_exchange"
headers = {
    "Authorization": f"Bearer {YOUR_ACCESS_TOKEN}"
}
params = {
    "period": "day",
    "date_from": "2024-08-01",
    "date_to": "2024-08-05"
}

response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
    data = response.json()
    print(json.dumps(data, indent=2))
else:
    print(f"Error: {response.status_code} - {response.text}")
Cuban Market Data API - Currency Exchange
Response

200

{
  "currency_exchange_prices": {
    "MLC/CUP": [
      {
        "price": 278.11,
        "min_price": 250,
        "max_price": 300,
        "volume": 1007,
        "date": "2024-08-05",
        "sell_price": 278.11,
        "buy_price": 278.12
      },
      {
        "price": 277.83,
        "min_price": 250,
        "max_price": 300,
        "volume": 2142,
        "date": "2024-08-04",
        "sell_price": 277.83,
        "buy_price": 277.82
      }
    ],
    "USD/CUP": [
      {
        "price": 321.19,
        "min_price": 290,
        "max_price": 340,
        "volume": 2509,
        "date": "2024-08-05",
        "sell_price": 321.22,
        "buy_price": 321.16
      },
      {
        "price": 321.67,
        "min_price": 290,
        "max_price": 350,
        "volume": 5157,
        "date": "2024-08-04",
        "sell_price": 321.7,
        "buy_price": 321.65
      }
    ],
    "EUR/CUP": [
      {
        "price": 329.44,
        "min_price": 295,
        "max_price": 350,
        "volume": 267,
        "date": "2024-08-05",
        "sell_price": 331.04,
        "buy_price": 328.48
      },
      {
        "price": 331.02,
        "min_price": 295,
        "max_price": 350,
        "volume": 539,
        "date": "2024-08-04",
        "sell_price": 331.84,
        "buy_price": 330.52
      }
    ],
    "USD/MLC": [
      {
        "price": 1.1,
        "min_price": 1,
        "max_price": 1.2,
        "volume": 70,
        "date": "2024-08-05",
        "sell_price": 1.1,
        "buy_price": 1.1
      },
      {
        "price": 1.11,
        "min_price": 1,
        "max_price": 1.2,
        "volume": 154,
        "date": "2024-08-04",
        "sell_price": 1.1,
        "buy_price": 1.14
      }
    ],
    "EUR/USD": [
      {
        "price": 1.06,
        "min_price": 1,
        "max_price": 1.08,
        "volume": 40,
        "date": "2024-08-05",
        "sell_price": 1.06,
        "buy_price": 1.05
      },
      {
        "price": 1.05,
        "min_price": 1,
        "max_price": 1.08,
        "volume": 78,
        "date": "2024-08-04",
        "sell_price": 1.05,
        "buy_price": 1.05
      }
    ]
  }
}

Description:

The response will include a list of currency exchange prices with the corresponding dates:

  • price (float): The price of the currency exchange.
  • min_price (float): The minimum price of the currency exchange.
  • max_price (float): The maximum price of the currency exchange.
  • volume (int): The volume of the announces for the period.
  • date (date): The date of the currency exchange price.
  • sell_price (float): The selling price of the currency exchange.
  • buy_price (float): The buying price of the currency exchange.

401

[
  {
  "detail": "Could not validate credentials"
  }
]

404

[
  {
    "detail": "No data found"
  }
]

405

[
  {
    "detail": "Method not allowed"
  }
]

422

[
  {
    "detail": "Unprocessable Entity"
  }
]

429

[
  {
    "detail": "The maximum monthly number of calls or requests for your account has been exceeded"
  }
]

/v1/products

GET /v1/products

This endpoint allows you to get the list of the most common products in Cuba providing a code for each of them.

Headers:

Authorization: Bearer YOUR_ACCESS_TOKEN

This header must be included in every request to authenticate the user.

  • Header name: Authorization
  • Header format: Bearer <your_token>

If omitted or incorrect, the server will respond with a 401 Unauthorized error.

Example using Python and requests
import requests
import json

url = f"{api_url}/v1/products"
headers = {
    "Authorization": f"Bearer {YOUR_ACCESS_TOKEN}"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
    data = response.json()
    print(json.dumps(data, indent=2))
else:
    print(f"Error: {response.status_code} - {response.text}")
Cuban Market Data API - Products
Response

200

{
  "products": {
    "001": "Huevos",
    "002": "Cafe",
    "003": "Ron"
  }
}

401

[
  {
  "detail": "Could not validate credentials"
  }
]

405

[
  {
    "detail": "Method not allowed"
  }
]

/v2/products_prices

GET /v2/products_price/{product}

This endpoint allows you to get the latest prices of a product in Cuba.

Path Parameters:

  • product (str): The code of the product. Available via the /v1/products endpoint.

Headers:

Authorization: Bearer YOUR_ACCESS_TOKEN

This header must be included in every request to authenticate the user.

  • Header name: Authorization
  • Header format: Bearer <your_token>

If omitted or incorrect, the server will respond with a 401 Unauthorized error.

Parameters:

  • period: The period of time between the prices. Can be day, week, month, quarter or year.
  • date_from: The start date of the period. Format: YYYY-MM-DD. This parameter is optional.
  • date_to: The end date of the period. Format: YYYY-MM-DD
Info

The date_from and date_to parameters are optional. If the date_to parameter is not provided, the current date will be used. If the date_from parameter is not provided, the period will be one week before the date_to parameter.

Example using Python and requests
import requests
import json
url = f"{api_url}/v2/products_prices/001"  # Replace '001' with the product code you want to query or `all`
headers = {
    "Authorization": f"Bearer {YOUR_ACCESS_TOKEN}"
}
params = {
    "period": "day",
    "date_from": "2024-08-01",
    "date_to": "2024-08-05"
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
    data = response.json()
    print(json.dumps(data, indent=2))
else:
    print(f"Error: {response.status_code} - {response.text}")
Cuban Market Data API - Products Prices
Responses
{
  "product_prices": [
    {
      "product": "Huevos - Carton",
      "data": {
        "price": 2600,
        "product": "Huevos",
        "max_price": 2600,
        "currency": "CUP",
        "min_price": 2600,
        "volume": 27,
        "measure_unit": "Carton",
        "date": "2024-08-05"
      }
    },
    {
      "product": "Huevos - Carton",
      "data": {
        "price": 2600,
        "product": "Huevos",
        "max_price": 2600,
        "currency": "CUP",
        "min_price": 2600,
        "volume": 24,
        "measure_unit": "Carton",
        "date": "2024-08-04"
      }
    }
  ]
}

Description:

The response will include a list of product prices with the corresponding dates:

  • product (str): The name of the product with the measure unit in the format Product - Measure Unit.
  • data (dict): The data of the product price.
    • price (float): The price of the product.
    • product (str): The name of the product.
    • max_price (float): The maximum price of the product.
    • currency (str): The currency of the price.
    • min_price (float): The minimum price of the product.
    • volume (int): The volume of the announces for the period.
    • measure_unit (str): The measure unit of the product.
    • date (date): The date of the product price.

401

[
  {
  "detail": "Could not validate credentials"
  }
]

404

[
  {
    "detail": "No data found"
  }
]

405

[
  {
    "detail": "Method not allowed"
  }
]

422

[
  {
    "detail": "Unprocessable Entity"
  }
]

429

[
  {
    "detail": "The maximum monthly number of calls or requests for your account has been exceeded"
  }
]

Troubleshooting:

  • Ensure the Authorization header is included.
  • The value must start with Bearer followed by a space and the token.
  • Tokens must be valid, not expired, and correctly formatted.