Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock Simulate Transactions Endpoint #10

Open
theDe-bugger opened this issue Nov 17, 2023 · 0 comments
Open

Stock Simulate Transactions Endpoint #10

theDe-bugger opened this issue Nov 17, 2023 · 0 comments
Assignees
Labels
backend stat Any statistical analysis tickets

Comments

@theDe-bugger
Copy link
Contributor

Description

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

Example Call

GET /api/stock/simulate
with params:

  • stock ticker = AAPL
  • [transactions] =
    {
    'trade1' : {
    'action': 'buy',
    'time': '01/01/2023 10:00:00"
    },
    'trade2' : {
    'action': 'sell',
    'time': '09/09/2023 18:00:00"
    }
    .
    .
    .
    }
  • capital = 10000.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

@theDe-bugger theDe-bugger added stat Any statistical analysis tickets backend labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend stat Any statistical analysis tickets
Projects
None yet
Development

No branches or pull requests

2 participants