Building Your First Python Strategy Using OpenAlgo and Using Fyers API with ChatGPT

Join us for a live session with Fyers on Building Your First Python Strategy Using OpenAlgo and Using Fyers API with ChatGPT.

Date: 10th December 2024

Time: 11 AM IST

Watch here:
https://www.youtube.com/live/W1cNjDtFTSQ

**Fyers Installation of OpenAlgo **

https://www.youtube.com/watch?v=lintXPX5LzE

What will be discussed

  1. How to set up an Algo Trading Environment.

  2. Configuring Fyers API with OpenAlgo.

  3. Building their first Python strategy using ChatGPT-4o model and OpenAlgo.

  4. Handling live and historical data using Pandas.

  5. Understanding prompting techniques for building trading strategies.

I am getting error after cloning git, and while installing pip.

error as below
ForEach-Object : Cannot bind parameter ‘RemainingScripts’. Cannot convert the “requirements.txt” value of type

“System.String” to type “System.Management.Automation.ScriptBlock”.

At line:1 char:18

  • % pip install -r requirements.txt

  •              ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:slight_smile: [ForEach-Object], ParameterBindingException

    • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectCommand

Solution please

you should not be using

% pip install -r requirements.txt

instead try with

pip install -r requirements.txt

Sir, thank you very much for building open source project to help Indian trading community and sharing the insightful session with us.

sir where i can get my redirect url

How do I create a heikenaishi or renko chart and use it for automating my trading

@SWF99NL8oO In case the API order is rejected API gives response as success and not Failure. how do we tackle this. How is it different from using TV to place order, as at the bottom it also shows trading /order panels.

Hello @SWF99NL8oO

I am getting below error while installing requirements. How do fix this

=================================================================

Preparing metadata (pyproject.toml) … error

error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.

│ exit code: 1

╰─> [14 lines of output]

  + C:\Program Files\Python313\python.exe C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240\vendored-meson\meson\[meson.py](http://meson.py) setup C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240 C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240\.mesonpy-sfpslsqx\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240\.mesonpy-sfpslsqx\build\meson-python-native-file.ini

  The system cannot find the file specified.

  The Meson build system

  Version: 1.2.99

  Source dir: C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240

  Build dir: C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240\.mesonpy-sfpslsqx\build

  Build type: native build

  Project name: NumPy

  Project version: 1.26.2

  Activating VS 17.12.3

  ..\..\[meson.build:1](http://meson.build:1):0: ERROR: Compiler cl cannot compile programs.

  A full log can be found at C:\Users\Prasanth\AppData\Local\Temp\pip-install-qfkrgr4h\numpy_7ba8b9a2a66b498db4e51c8693bf0240\.mesonpy-sfpslsqx\build\meson-logs\meson-log.txt

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

hint: See above for details.

@SWF99NL8oO I have done all the steps till this page. I have provided my password, otp every this was working till that But Dashboard page is not loading. Insted getting This site can’t be reached

127.0.0.1 refused to connect. In developer tools : Network section found : (failed)

net::ERR_CONNECTION_REFUSED : http://127.0.0.1:5001/fyers/callback?s=ok&code=200&

auth_code=xxxx (replaced my auth code). Could you pls help me on this to resolve this issue. I’m very intersted to use this app. Request you please provide me your support.

Hi Sir

When i clicked to get the API key for the first time i got logged out of Openalgo and since then not able to log in. Its saying invalid credentials.

@SWF99NL8oO, I found the issue. The local flask app working on 5000 port. But in Api app, Redirect url mentioned as 5001 port. “http://127.0.0.1:5000/fyers/callback”. Now I have updated the port number in API app redirect url. Now app got loaded dashboard. Thanks.

One can goto the db folder delete the openalgo.db file and start the application and remember the credential the next time you are setting up openalgo.

Im glad it worked for you!

Everytime the order is sent to the broker and broker generates the orderid it is considered as successful response. But the order can be rejected or open or trigger pending or in a complete state.

As of now if the broker orderid is generated then it is considered as successful response. Failure to generate the order id because of invalid parameters or any other means then it will result in error response.

If you are running in your local machine (Windows) then your redirect url is http://127.0.0.1:5000/fyers/callback

Im glad you liked it!

Hello sir, i performed the steps as mentioned by you in the video and renamed the same.env file to .env and also change the redirect url to http://127.0.0.1:5000/fyers/callback , but iam getting redirect url of zerodha, plz guide how to fix it.

PS C:\Openalgo> python app.py

Error: Invalid REDIRECT_URL format.

The URL must end with ‘/broker_name/callback’

Example: http://127.0.0.1:5000/zerodha/callback

The query is resolved by Fyers support team. Mr. Vinith from support team assisted me and was very supportive and he helped me resolve the query.

Hello sir,

I want to create option chain analysis tool website, so I need api for option data,

Can I use** fyers api**??

Yes one can build inside openalgo itself. one can take the Fyers Option Chain API and integrate inside the OpenAlgo.

Pre-requesite

  • Knowledge on Working with Python Flask Web Framework, RestX-API Creation in Flask
  • DaisyUI and Tailwind CSS
  • Sqlite 3 for Database Management.