It is necessary to develop a simple RESTful API service for the referral system.
- user registration and authentication (JWT, Oauth 2.0);
- an authenticated user must be able to create or delete their referral code. Only 1 code can be active at a time. When creating a code, its expiration date must be specified;
- the ability to receive a referral code by email address of the referrer;
- the ability to register using a referral code as a referral;
- obtaining information about referrals by referrer id;
- UI documentation (Swagger/ReDoc).
- Python 3.10.12^
- Poetry 1.6.1^
- PostgreSQL 15^
- fastapi ^0.110.0
- asyncio ^3.4.3
- fastapi-users ^13.0.0
- aiosqlite ^0.20.0
- python-dotenv ^1.0.1
- uvicorn ^0.28.0
- alembic ^1.13.1
- asyncpg ^0.29.0
- pytz ^2024.1
- flake8 ^7.0.0
- sqlalchemy ^2.0.28
- DATABASE_URL
- SECRET_KEY
- DEBUG
- API_KEY (for 2nd task - CoinGecko API-key)
poetry install
make build
make start
make dev
make lint
For an exchange, get all trading pairs, their latest prices and trading volume for 24 hours
- Create a class inherited from the BaseExchange class.
- Write the implementation of the methods and fill in the required fields (marked as "todo")
- Feel free to add another internal methods.
- It is important that the example from the main function runs without errors
The flow looks like this:
- Request data from the exchange
- We bring the ticker to the general format
- We extract from the ticker properties the last price, the 24-hour trading volume of the base currency and the 24-hour trading volume of the quoted currency. (at least one of the volumes is required)
- Return the structure in the format:
{
"BTC/USDT": TickerInfo(last=57000, baseVolume=11328, quoteVolume=3456789),
"ETH/BTC": TickerInfo(last=4026, baseVolume=4567, quoteVolume=0)
}
make task2
There is a little part of full output
task2.txt