generated from airtai/faststream-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdescription.txt
14 lines (10 loc) · 955 Bytes
/
description.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Create faststream application which will retrieve cryptocurrency current price and publish it to new_crypto_price topic.
Application should retrieve the data every 2 seconds.
Message which will be produced is JSON with the two attributes:
- price: non negative float (it represents current pice of cryptocurrency in USD)
- crypto_currency: string (it represents the cryptocurrency e.g BTC, ETH...)
Current price of Bitcoin can be retrieved by simple GET request to 'https://api.coinbase.com/v2/prices/BTC-USD/spot'
Current price of Ethereum can be retrieved by simple GET request to 'https://api.coinbase.com/v2/prices/ETH-USD/spot'
The response of this GET request is a JSON and you can get information about the crypto_currency in response['data']['base']
and the information about the price in response['data']['amount']
Use utf-8 encoded crypto_currency attribute as a partition key when publishing the message to new_crypto_price topic.