You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need an endpoint that allows us to simulate a list of transactions for a given stock.
You may also make this as a function instead of an endpoint that the other endpoints can simply call to perform the calculations
Stock Based Endpoint:
We need to make GET request!
Endpoint
'/api/stock/simulate'
Params
stock ticker
[transactions]
capital (in xx.xx dollars)
Return
optimize the capital to invest the money and make the most profit
ie; if it makes sense to invest a lot the first time and sell it all, do that. if it makes more profit to buy some at the start, sell half, and then buy a little more later, do that.
going to require some logic. - return total profit made and an updated list of transactions mentioning how much was sold/bought at each transaction
Description
We need an endpoint that allows us to simulate a list of transactions for a given stock.
Stock Based Endpoint:
We need to make GET request!
Endpoint
'/api/stock/simulate'
Params
Return
- return total profit made and an updated list of transactions mentioning how much was sold/bought at each transaction
Example Call
GET /api/stock/simulate
with params:
{
'trade1' : {
'action': 'buy',
'time': '01/01/2023 10:00:00"
},
'trade2' : {
'action': 'sell',
'time': '09/09/2023 18:00:00"
}
.
.
.
}
Example Return
results :
{
'profit' : 20000.00,
'transactions' :
{
'trade1' : {
'action': 'buy',
'time': '01/01/2023 10:00:00",
'amount' : 10000.00
},
'trade2' : {
'action': 'sell',
'time': '09/09/2023 18:00:00"
'amount' : 20000.00
}
.
.
.
}
}
Error Handling
For any error, just throw 400 for now
The text was updated successfully, but these errors were encountered: