Open crypt0inf0 opened 2 days ago
After login we select broker, If the api is available in database it takes to broker login. If broker api is not available it redirect to enter the api key and save it.
Already have plans to migrate the broker credentials from .env to database. But the immediate challenge will be have to reconfigure the API structure in case of allowing multi broker login.
Here is the sample placeorder structure which needs to be reconfigured which I don't want to do at this point https://docs.openalgo.in/api-documentation/v1/placeorder
any other alternatives without changing the existing API structure.?
There is no need to change the structure, We just need to change the os.getenv('BROKER_API_KEY')
& os.getenv('BROKER_API_SECRET')
to fetch from database instead of .env
And for os.getenv('REDIRECT_URL')
we can use the broker selected by the user to be autofill on f'http://127.0.0.1:5000/$(broker)/callback'
If the user selected broker does not have any API stored then redirect to API secret page to enter the API details and save it.
API database struct like,
{
BROKER: angelone,
API_KEY: xxxx,
API_SECRET: yyyy
}
Also provide a option to edit API keys, We can use the same template as save API keys. We also need to have a error handling for expired api key or wrong api keys.
Can we save the broker configuration api in database, So that we can save multiple broker api's & switch between multiple brokers in the frontend.
We can also manage multiple brokerage account.