Skip to content

boomNDS/skuberg-assignment

Repository files navigation

Nest Logo

Description

Cryptocurrencies exchange service e.g https://c2c.binance.com/th/trade/buy/BTC

  • ระบบสามารถตั้ง ซื้อ-ขาย Cryptocurrencies (BTC,ETH,XRP, DOGE)
  • ระบบบันทึกการโอนเงินและซื้อ-ขายแลกเปลี่ยน
  • ระบบมีการสร้างบัญชีผู้ใช้
  • ระบบทั้งหมดใช้หน่วย USD ในการคำนวณ สามารถซื้อขายด้วยเงิน

Cryptocurrencies exchange ER design

erDiagram
    User ||--o{ Wallet : owns
    User ||--o{ Transaction : initiates
    User ||--o{ Order : places
    User ||--o{ MarketListing : creates
    MarketListing ||--o{ Order : receives
    Order ||--o{ Transaction : has

    User {
        number id PK
        string email
        string password
        string username
        string firstName
        string lastName
        date dob
        string phone
        string address
        boolean hasKyc
        datetime createdAt
        datetime updatedAt
    }
    ExchangeRate {
        number id PK
        string currency
        float price "price per unit in USD"
        datetime createdAt
        datetime updatedAt
    }
    Wallet {
        number id PK
        string type "fiat/crypto"
        number userId FK
        string currency
        float balance
        datetime createdAt
        datetime updatedAt
    }
    Transaction {
        number id PK
        number fromUserId FK
        number toUserId FK
        string currency
        string type "buy/sell/transfer/withdraw"
        float amount
        float price
        float fee
        float total
        number orderId FK
        string toAddress "only for withdrawals"
        datetime createdAt
        datetime updatedAt
    }
    MarketListing {
        number id PK
        number userId FK
        string currency
        string type "buy/sell"
        float amount
        datetime createdAt
        datetime updatedAt
    }
    Order {
        number id PK
        number userId FK
        number marketListingId FK
        string type "buy/sell"
        float amount
        float price
        string priceCurrency
        string status "pending/confirmed/canceled"
        datetime createdAt
        datetime updatedAt
    }

Loading

Installation

$ yarn install

Set-up database

# create postgres database
$ docker compose up -d

# create seed data
$ yarn seed

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

License

Nest is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published