/xcrypto

Primary LanguagePython

X Crypto

The project is a set of APIs for crypto exchange and related functionalities.

Table of Contents


Prerequisites

Before you begin, ensure you have the following installed on your machine:

Installation

  1. Clone the repository:

    git clone https://github.com/hamidrasti/xcrypto.git
    cd xcrypto
  2. Set up a virtual environment (optional but recommended):

    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  3. Install the Python dependencies:

    pip install -r requirements/development.txt

Running the App Manually

Once the dependencies are installed, you can run the Django project manually.

  1. Run the Application:

    • Use the django server to run the app:
    python manage.py runserver
  2. Access the Interactive API Docs:

Running the App via Docker

If you'd like to run the app using Docker, follow these steps:

  1. Build the Docker Image:

    docker compose build
  2. Run the Docker Container:

    • Use the following command to start the application with Docker:
    docker compose up -d
    • This will start the Django project along with any other services defined in your docker-compose.yml file (e.g., databases, caching services, etc.).
  3. Stopping the Container:

    docker compose down
  4. Accessing the Application:

Configuration

  • You can define environment variables in a .env file or in the docker-compose.yml file for configuration purposes (e.g., database credentials, API keys).
  • Make sure to adapt the Docker and Python settings as needed for production use (e.g., setting up proper logging, configuring uwsgi, etc.).

Load Data

You can load fixtures provided for users, cryptos and orders using:

python manage.py loaddata

Now we have two users with this info:

  • admin

    {
      "username": "admin",
      "password": "pass123456"
    }
  • hamid

    {
      "username": "hamid",
      "password": "pass"
    }

Testing

Run tests

Execute this command:

pytest

or this:

python manage.py test

Tests coverage

Run this commands to get coverage report:

coverage run --source='.' manage.py test
coverage report