pouriamolaee / node-internship

1 stars 0 forks source link

Trading endpoints #9

Open thevahidal opened 1 year ago

thevahidal commented 1 year ago

We need another model for trading. Whenever a trade actions happens we need to create a trade model for this purpose. Trade has following fields:

Top-up

/api/topup/ [POST]

Body

  unit: 1000

Using top-up endpoint users can buy USDT using their local currency (e.g. IRT). For now it's going to be a mock api in which when a user call it and asks for some amount of USDT, we'll automatically charge their USDT balance as requested.

Buy

/api/trade/<symbol>/buy/ [POST]

Body

  amount: 1000

Using this endpoint users will pay some amount of USDT to buy the request coin. System will deduct the request amount from their USDT wallet and add the purchased unit to their coin wallet.

Sell

/api/trade/<symbol>/sell/ [POST]

Body

  unit: 10.12

Using this endpoint users can sell their assets. Process is exactly the opposite of buying.