Skip to content

MaWeXi/scaleup-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScaleUp Backend Guide

Little guide for the ScaleUp Backend


Users

API Requests and responses for the user controller.

Always look at the message in the JSON response for further information if you get an error.

API Requests

HTTP URL Body
POST http://localhost:8080/api/v1/user/
{
    "id": "15787aab-9ec8-48c8-9535-ba1ff585b16a",
    "username": "horst",
    "leagues": {}
}
GET http://localhost:8080/api/v1/user/all

-

GET http://localhost:8080/api/v1/user/all/{id}

-

PUT http://localhost:8080/api/v1/user/{id}
{
"id": "15787aab-9ec8-48c8-9535-ba1ff585b16a",
"username": "horst",
"leagues": {}
}
PUT http://localhost:8080/api/v1/user/join-league/{id}
{
    "leagueId": "1d701622-4e4c-481e-84ad-02b8aec21136",
    "leagueCode": "0000"
}

API Response

Status Response
200
{
    "id": "15787aab-9ec8-48c8-9535-ba1ff585b16a",
    "username": "user1",
    "leagues": {}
}
204

No users saved in DB

404

User could not be found under this id or username

409

User with this username already saved in DB

400

Bad Request


Leagues

API Requests and responses for the leagues controller

API Requests

HTTP URL Body
POST http://localhost:8080/api/v1/league/
{
    "userId": "ba7159b0-10e8-4141-b085-4d1060bd739c",
    "leagueName": "Best league ever",
    "startBudget": 10000,
    "transactionCost": 5,
    "stockAmount": 200,
    "probability":
    {
        "Technology": 0.5,
        "Communication Services": 0.5,
        "...": "..."
    }
}
GET http://localhost:8080/api/v1/league/{id}

-

GET http://localhost:8080/api/v1/league/all

-

GET http://localhost:8080/api/v1/league/leaderboard/{id}

-

PUT tbc.

-

API Response

Status Response
200

OK

204

No leagues saved in DB

404

League could not be found under this id

409

Either this league id does already exist or the user does not exist in the DB

400

Bad request


Stocks

API Requests and responses for the stock controller
askPrice returns current askPrice and its development in percent to the value when the day started
bidPrice returns current bidPrice and its development in percent to the value when the day started\

API Requests

HTTP URL Body
GET http://localhost:8080/api/v1/stock/{symbol}
http://localhost:8080/api/v1/stock/{symbol}?interval=day
Optional URL Parameters:
interval = day, week, month, year
GET http://localhost:8080/api/v1/stock/askPrice/{Symbol}

-

GET http://localhost:8080/api/v1/stock/bidPrice/{symbol}

-

GET tbc.

-

API Response

Status Response
200
{
    "symbol": "BMW.DE",
    "name": "Bayerische Motorenwerke",
    "isin": "DE0005190003",
    "wkn": "519000",
    "lastUpdated": "2021-12-06T19:05:29.000+00:00",
    "price": 43411.125,
    "dayOpen": 43632.46,
    "previousClose": 43632.46,
    "dayHigh": 43644.844,
    "dayLow": 41835.867,
    "fiftyTwoHigh": 59496.15,
    "fiftyTwoLow": 14539.374,
    "volume": 3.15467428E10,
    "stockType": "CRYPTOCURRENCY",
    "sector": "Blockchain",
    "stockHistory": [
        {
          "date": "2021-02-03T16:00:00.000+00:00",
          "close": 133.750000000000000000
        },
        {
          "date": "2021-02-02T09:30:00.000+00:00",
          "close": 135.650000000000000000
        }
    ]  
}
404

Stock with this symbol could not be found in the DB

400

Bad Request


Markets

API Requests and responses for the market controller
market returns complete market for league (here we need to add information that you want to show)
joker/update sets joker for stock in market

API Requests

HTTP URL Body
GET http://localhost:8080/api/v1/market/{leagueid}

-

Put http://localhost:8080/api/v1/market/joker/update/{leagueid}
{
  "userid": "15787aab-9ec8-1111-1111-testuserb16a",
  "symbol": "ABEA.DE"
}

API Response

Status Response
200
{
    "symbol": "BTC-EUR",
    "lastUpdated": "2021-12-06T19:05:29.000+00:00",
    "price": 43411.125,
    "dayOpen": 43632.46,
    "previousClose": 43632.46,
    "dayHigh": 43644.844,
    "dayLow": 41835.867,
    "fiftyTwoHigh": 59496.15,
    "fiftyTwoLow": 14539.374,
    "volume": 3.15467428E10,
    "stockType": "CRYPTOCURRENCY",
    "sector": "Blockchain"
}
404

Stock with this symbol could not be found in the DB

400

Bad Request


StocksByUser

API Requests and responses for the stocksByUser controller
Posts to buy and sell stock Get-request to get amount of stock owned. This is needed to determine how much stock a user can sell.

API Requests

HTTP URL Body
Post http://localhost:8080/api/v1/stockByUser/BuyStock
{
"userid": "15787aab-9ec8-1111-1111-testuserb16a",
"leagueid": "1d701622-4e4c-1111-1111-testleague69",
"symbol": "ABEA.DE",
"bidPrice": "1",
"amount": "3"
}
Post http://localhost:8080/api/v1/stockByUser/SellStock
{
  "userid": "15787aab-9ec8-1111-1111-testuserb16a",
  "leagueid": "1d701622-4e4c-1111-1111-testleague69",
  "symbol": "ABEA.DE",
  "bidPrice": "1",
  "amount": "3"
}
Get http://localhost:8080/api/v1/stockByUser/GetStockAmountOwned
{
  "leagueId": "XL8L3M_SUID",
  "userId": "15787aab-9ec8-1111-1111-testuserb16a",
  "symbol": "YOC.DE"
}

API Response

Status Response
200
{
    "symbol": "BTC-EUR",
    "lastUpdated": "2021-12-06T19:05:29.000+00:00",
    "price": 43411.125,
    "dayOpen": 43632.46,
    "previousClose": 43632.46,
    "dayHigh": 43644.844,
    "dayLow": 41835.867,
    "fiftyTwoHigh": 59496.15,
    "fiftyTwoLow": 14539.374,
    "volume": 3.15467428E10,
    "stockType": "CRYPTOCURRENCY",
    "sector": "Blockchain"
}
404

Stock with this symbol could not be found in the DB

400

Bad Request


UserByLeagues

API Requests and responses for the userByLeagues controller
get current depotvalue
get full depot request

API Requests

HTTP URL Body
Get http://localhost:8080/api/v1/valueDepot
{
  "leagueid": "1d701622-4e4c-1111-1111-testleague69",
  "userid": "15787aab-9ec8-1111-1111-testuserb16a"
}
Get http://localhost:8080/api/v1/freeBudget
{
  "leagueid": "1d701622-4e4c-1111-1111-testleague69",
  "userid": "15787aab-9ec8-1111-1111-testuserb16a"
}
Get http://localhost:8080/api/v1/Depot
{
  "leagueid": "1d701622-4e4c-1111-1111-testleague69",
  "userid": "15787aab-9ec8-1111-1111-testuserb16a"
}

API Response

Status Response
200
{
    "symbol": "BTC-EUR",
    "lastUpdated": "2021-12-06T19:05:29.000+00:00",
    "price": 43411.125,
    "dayOpen": 43632.46,
    "previousClose": 43632.46,
    "dayHigh": 43644.844,
    "dayLow": 41835.867,
    "fiftyTwoHigh": 59496.15,
    "fiftyTwoLow": 14539.374,
    "volume": 3.15467428E10,
    "stockType": "CRYPTOCURRENCY",
    "sector": "Blockchain"
}
404

Stock with this symbol could not be found in the DB

400

Bad Request

Transactions

API Requests and responses for the user controller.

Always look at the message in the JSON response for further information if you get an error.

With this Get request you get all transactions within a league. Maybe for future work we need to limit the Get-response to x transactions (maybe x = 100).

API Requests

HTTP URL Body
GET http://localhost:8080/api/v1/transactions/league/all/{leagueId}

-

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages