SergioIommi / Quant-Trading-Dashboards

Equities Pair Trading/Statistical Arbitrage and Multi-Variable Index Regression
9 stars 4 forks source link

Type Error in app1.py #1

Closed peter149 closed 9 months ago

peter149 commented 9 months ago

I'm trying to run notebook. or app1.py, line 474 - Output('backtest-table-descr', 'children', allow_duplicate=True), get error massage:
TypeError: init() got an unexpected keyword argument 'allow_duplicate' How to solve?

SergioIommi commented 9 months ago

I've never got such a problem, but I think it might be that you're using a version of dash different from 2.11.1. Have you used the environment.yml file present in the main folder to build the conda virtual environment to execute the notebook/app1.py?

peter149 commented 9 months ago

Thanks for your answer,I will reply tomorrow. Peter

Sergio Iommi @.***> schrieb am Mi., 20. Sept. 2023, 20:17:

I've never got such a problem, but I think it might be that you're using a version of dash different from 2.11.1. Have you used the environment.yml file present in the main folder to build the conda virtual environment to execute the notebook/app1.py?

— Reply to this email directly, view it on GitHub https://github.com/SergioIommi/Quant-Trading-Dashboards/issues/1#issuecomment-1728222931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXHXNEWYJRHK5HSZXK3INDX3MXMLANCNFSM6AAAAAA46P7GVQ . You are receiving this because you authored the thread.Message ID: @.***>

peter149 commented 9 months ago

YOu are right. The error in app1.py was solved by updating dash to Version 2.11.1

peter149 commented 9 months ago

Hi Sergio, the error in app1.py was solved by updating dash to Version 2.11.1 The error occurred because not all packages or not the specific versions of the yml could be installed under conda and had to be reinstalled via pip. I have formed the db from 2022-08-19 , to have the data of one year. MongoDb on 282 stocks (your short list) was build correctly. Now dash is running on 127.1.1:8050. But unfortunately it gave a new error: ALERT! Unfortunately there was a problem in estimating the models probably for a lack of data for some symbols. Please try changing the date-interval (making it wider or moving it)......

Is there any way to hide or skip the missing data? Thanks for your help. Peter

------ Originalnachricht ------ Von "Peter Go" @.> An "SergioIommi/Quant-Trading-Dashboards" @.> Datum 20.09.2023 20:46:15 Betreff Re: [SergioIommi/Quant-Trading-Dashboards] Type Error in app1.py (Issue #1)

Thanks for your answer,I will reply tomorrow. Peter

Sergio Iommi @.***> schrieb am Mi., 20. Sept. 2023, 20:17:

I've never got such a problem, but I think it might be that you're using a version of dash different from 2.11.1. Have you used the environment.yml file present in the main folder to build the conda virtual environment to execute the notebook/app1.py?

— Reply to this email directly, view it on GitHub https://github.com/SergioIommi/Quant-Trading-Dashboards/issues/1#issuecomment-1728222931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXHXNEWYJRHK5HSZXK3INDX3MXMLANCNFSM6AAAAAA46P7GVQ. You are receiving this because you authored the thread.Message ID: @.***>

SergioIommi commented 9 months ago

Hi Peter, that's good you've been able to solve the issue by using the correct version of dash. Yes, conda is a bit of a mess to install packages in case you need specific versions because it checks if all packages that will end up in the environment are compatible with each other. pip instead doesn't use this approach, so you can install any version you want for a specific package in case that is required by the application (like it's the case with my dash app).

Regarding the other problem, the quickest solution is to use 'start_date_creation': '2022-01-01' when you build the database, because that has already been tested by me. If instead you are forced to use only the data from 2022-08-19, I'm afraid that you might need to modify the code and provide some logic to deal with the cases where you don't have enough data for a specific stock to compute the correlation and/or estimate the models (linear regression or Kalman filter).

peter149 commented 9 months ago

In the first step, the database started on 2022-01-01. Due to lack of data, I created the new database from 2022-08, but even in the shorter time span, data was missing. I am thinking of exporting the database to search for missing data. It might be helpful to delete individual stocks.

Sergio Iommi @.***> schrieb am Do., 21. Sept. 2023, 20:07:

Hi Peter, that's good you've been able to solve the issue by using the correct version of dash. Yes, conda is a bit of a mess to install packages in case you need specific versions because it checks if all packages that will end up in the environment are compatible with each other. pip instead doesn't use this approach, so you can install any version you want for a specific package in case that is required by the application (like it's the case with my dash app).

Regarding the other problem, the quickest solution is to use 'start_date_creation': '2022-01-01' when you build the database, because that has already been tested by me. If instead you are forced to use only the data from 2022-08-19, I'm afraid that you might need to modify the code and provide some logic to deal with the cases where you don't have enough data for a specific stock to compute the correlation and/or estimate the models (linear regression or Kalman filter).

— Reply to this email directly, view it on GitHub https://github.com/SergioIommi/Quant-Trading-Dashboards/issues/1#issuecomment-1730064378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXHXNBSRNK5LPSDN4IRNLTX3R67LANCNFSM6AAAAAA46P7GVQ . You are receiving this because you modified the open/close state.Message ID: @.***>

SergioIommi commented 9 months ago

Yes, removing individual stocks is definitely a possible and easy solution. You can simply remove the single symbols causing the problem from the CSV files contained in the symbols folder.

peter149 commented 9 months ago

I have no explanation. After I checked the data, the incomplete symbols were: CEG(^GSPC), EVEX(^RUT) and GEHC(^NDX) removed, remaining 279 symbols, today (433 days) = 120807 records. These are complete, without gaps. Nevertheless, I keep getting the alert: ..... lack of data.......... No errors in the Python files. What to do? Is it absolutely necessary to check for completeness?

------ Originalnachricht ------ Von "Sergio Iommi" @.> An "SergioIommi/Quant-Trading-Dashboards" @.> Cc "peter149" @.>; "State change" @.> Datum 21.09.2023 22:13:36 Betreff Re: [SergioIommi/Quant-Trading-Dashboards] Type Error in app1.py (Issue #1)

Yes, removing individual stocks is definitely a possible and easy solution. You can simply remove the single symbols causing the problem from the CSV files contained in the symbols folder.

— Reply to this email directly, view it on GitHub https://github.com/SergioIommi/Quant-Trading-Dashboards/issues/1#issuecomment-1730234961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXHXNFSCOLRAKG36B264YTX3SNXBANCNFSM6AAAAAA46P7GVQ. You are receiving this because you modified the open/close state.Message ID: @.***>

SergioIommi commented 8 months ago

Hi Peter, the "lack of data" alert could be related to something else. Unfortunately, I haven't had time to investigate it. I would suggest you to fork the repository and try debugging the Python code and in particular the select_pairs_correlation function in app1.py, which computes the correlation. My best assumption is that data_stocks is causing problems in the computation of the correlation. Please, let me know if you find the source of the issue.

peter149 commented 8 months ago

Hi Sergio, the described errors occurred in the Windows version of my installation. After also a shortening of the data period brought no other result, I came on the thought to make the installation in Linux (here Ubuntu). Both the env_Installation and the further procedure with MongoDb as well as the Python files could be carried out successfully, so that I came to the desired results. Many thanks for your work. At the moment I am thinking about how I can convert the result with the preferred pairs into daily action.

------ Originalnachricht ------ Von "Sergio Iommi" @.***>

An "SergioIommi/Quant-Trading-Dashboards" @.> Cc "peter149" @.>; "State change" @.***> Datum 22.10.2023 18:23:08 Betreff Re: [SergioIommi/Quant-Trading-Dashboards] Type Error in app1.py (Issue #1)

Hi Peter, the "lack of data" alert could be related to something else. Unfortunately, I haven't had the time to investigate it. I would suggest you to fork the repository and try debugging the Python code and in particular the select_pairs_correlation function in app1.py, which computes the correlation. My best assumption is that data_stocks is causing problems in the computation of the correlation. Please, let me know if you find the source of the problem.

— Reply to this email directly, view it on GitHub https://github.com/SergioIommi/Quant-Trading-Dashboards/issues/1#issuecomment-1774136073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXHXNGK2TN6IYP4EWM7VYLYAVB6ZAVCNFSM6AAAAAA46P7GVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZUGEZTMMBXGM. You are receiving this because you modified the open/close state.Message ID: @.***>

SergioIommi commented 5 months ago

Hi Peter, I'm very glad you've been able to successfully run the code in Linux. Good luck with your trading!