client = p123api.Client(api_id='<insert your own>', api_key='<insert your own>')
your_simulation = client.strategy(strategy_id=<insert your own strategy id>)
Thanks - but maybe I’m missing something again. That logic makes sense but the page I’m working with here on P123 (https://api.portfolio123.com/docs/index.html#/Strategy/_details) seems to require entering pre-defined values into Token and ID fields, not coding or a data string. Where would I enter that string or statement? Or how do I do this using just the Strategy inputs on that API page? Thanks.
The code I gave above would be used in Python using IDE software of choice like Visual Studio Code or Spyder.
I think you are looking for a way to call the API through your browser. I’m not sure if that is possible even though that would be an easy and handy way of using the API. The code described here might be a good starting point though: Single factor testing tool developed using the API - #6 by danparquette. It uses Google Cobab to execute the code in Python. That way at least you don’t have to download an IDE.
Hope this doesn’t sound too confusing and perhaps there is a more user friendly way of using the API that I am not currently aware of.
Click Execute. If there were no errors, the access token will be in the code 200 section. Copy the access token from the response body.
Go to The Strategy endpoint and click Try it Out.
Paste in the Access Token into the token field.
Enter the strategy id of the strategy in the Id field. This id is found at the end of the URL while on the site and on that page for the Strategy.
Click Execute
Thanks. Yes I’ve tried this approach but I get an error message when I attempt to execute the /auth endpoint. Do I need to Create Key, ie create a new key each time on the Dataminer/API page? If not then I’m not sure why I’m getting that error message.
Thanks for the info. I am getting the same error now with my id. I’ll ask the developer to look at it.
Please do not share your api key with others. This include screenshots. Anybody with the id and key can use them to run scripts using the api credits from your account. Please go to the Dataminer & API page in account settings and delete the key with id 196 and then create a new one.