timelyart / Kairos

Kairos aims to help you save time by automating repetitive tasks on TradingView such as scanning markets for setups, and refreshing alerts as well as creating new ones.
GNU General Public License v3.0
71 stars 31 forks source link

screener_to_watchlist.yaml error still :/ #121

Closed johnmolino closed 1 month ago

johnmolino commented 2 months ago

Hi, if yours is working I'm just wondering if it's something on my end. Can you recommend the best way to debug the css? Do you just use the Google Developer Tools? I've tried but it seems tricky to find what I'm looking for - perhaps you can suggest the proper techniqu as I really want to develop some of my own .yaml files for various automations. (Also, I'd be happy to fork this and offer my updates/bug fixes if I can get figure it out)....

Lastly, you mentioned that some folks have switched to paid services. Do you have a suggestion for me to check out? I'm really not interested in automating trades, but rather just working within TradingView. You can email me directly (my email is public on my profile). Thank you. Below is the error if you have a bit of time to debug. -John

c:\Kairos-3.20>python main.py screener_to_watchlist.yaml

======================================== 2024-09-14 10:17:00 - Start Program

DISCLAIMER This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

USAGE python main.py [] [-s|-s ] [-h] [-d] For help, type: python main.py -h

2024-09-14 10:17:00.425 INFO tv - run: Running on a windows operating system 2024-09-14 10:17:01.266 INFO tv - assign_user_data_directory: kairos_0 assigned 2024-09-14 10:17:01.267 INFO tv - create_browser: using c:\chromedriver.exe as webdriver

DevTools listening on ws://127.0.0.1:65407/devtools/browser/83b0c3f0-1d98-42c7-9c43-c679a324607c 2024-09-14 10:17:02.379 INFO tv - check_driver: browser version: 128.0.6613.138 2024-09-14 10:17:02.379 INFO tv - check_driver: driver version: 128.0.6613.137 2024-09-14 10:17:05.952 INFO tv - login: already logged in (Premium account) 2024-09-14 10:17:05.952 INFO tv - run: WAIT_TIME_IMPLICIT = 0.0 2024-09-14 10:17:05.952 INFO tv - run: PAGE_LOAD_TIMEOUT = 60.0 2024-09-14 10:17:05.952 INFO tv - run: CHECK_IF_EXISTS_TIMEOUT = 10.0 2024-09-14 10:17:05.952 INFO tv - run: DELAY_BREAK_MINI = 0.1 2024-09-14 10:17:05.953 INFO tv - run: DELAY_BREAK = 0.25 2024-09-14 10:17:05.953 INFO tv - run: DELAY_SUBMIT_ALERT = 0.0 2024-09-14 10:17:05.953 INFO tv - run: DELAY_CHANGE_SYMBOL = 1.0 2024-09-14 10:17:05.953 INFO tv - run: DELAY_CLEAR_INACTIVE_ALERTS = 2.0 2024-09-14 10:17:05.953 INFO tv - run: DELAY_KEYSTROKE = 0.05 2024-09-14 10:17:05.953 INFO tv - run: DELAY_READ_INDICATOR_VALUE = 0.2 2024-09-14 10:17:05.953 INFO tv - run: READ_FROM_DATA_WINDOW = True 2024-09-14 10:17:05.953 INFO tv - run: WAIT_UNTIL_CHART_IS_LOADED = True 2024-09-14 10:17:05.953 INFO tv - run: READ_ALL_VALUES_AT_ONCE = True 2024-09-14 10:17:05.954 INFO tv - run: CHANGE_SYMBOL_WITH_SPACE = False 2024-09-14 10:17:05.954 INFO tv - run: VERIFY_MARKET_LISTING = False

2024-09-14 10:17:05.954 INFO tv - run: create/update watchlist 'John's Pre-market' from screener. Please be patient, this may take several minutes ... 2024-09-14 10:17:39.534 ERROR tv - run: Message: Stacktrace: GetHandleVerifier [0x003AD933+25811] (No symbol) [0x0033E314] (No symbol) [0x00232523] (No symbol) [0x00277483] (No symbol) [0x0027765B] (No symbol) [0x002B6BA2] (No symbol) [0x0029AD74] (No symbol) [0x002B46F0] (No symbol) [0x0029AAC6] (No symbol) [0x0026BEFD] (No symbol) [0x0026C8FD] GetHandleVerifier [0x0067F143+2981091] GetHandleVerifier [0x006D2FF9+3324825] GetHandleVerifier [0x0043B32F+605903] GetHandleVerifier [0x00442CBC+637020] (No symbol) [0x00346F4D] (No symbol) [0x00343DD8] (No symbol) [0x00343F75] (No symbol) [0x00336406] BaseThreadInitThunk [0x75C6FCC9+25] RtlGetAppContainerNamedObjectPath [0x77E380CE+286] RtlGetAppContainerNamedObjectPath [0x77E3809E+238]

Traceback (most recent call last): File "c:\Kairos-3.20\tv\tv.py", line 3448, in run markets = get_screener_markets(browser, screener_yaml) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Kairos-3.20\tv\tv.py", line 3548, in get_screener_markets wait_and_click(browser, css_selectors['select_screener'], delay=30) File "c:\Kairos-3.20\tv\tv.py", line 445, in wait_and_click return WebDriverWait(browser, delay).until( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jm\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium-4.24.0-py3.12.egg\selenium\webdriver\support\wait.py", line 105, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: GetHandleVerifier [0x003AD933+25811] (No symbol) [0x0033E314] (No symbol) [0x00232523] (No symbol) [0x00277483] (No symbol) [0x0027765B] (No symbol) [0x002B6BA2] (No symbol) [0x0029AD74] (No symbol) [0x002B46F0] (No symbol) [0x0029AAC6] (No symbol) [0x0026BEFD] (No symbol) [0x0026C8FD] GetHandleVerifier [0x0067F143+2981091] GetHandleVerifier [0x006D2FF9+3324825] GetHandleVerifier [0x0043B32F+605903] GetHandleVerifier [0x00442CBC+637020] (No symbol) [0x00346F4D] (No symbol) [0x00343DD8] (No symbol) [0x00343F75] (No symbol) [0x00336406] BaseThreadInitThunk [0x75C6FCC9+25] RtlGetAppContainerNamedObjectPath [0x77E380CE+286] RtlGetAppContainerNamedObjectPath [0x77E3809E+238]

2024-09-14 10:17:39.838 ERROR tv - snapshot: log\20240914_101739.png

======================================== 2024-09-14 10:17:42 - End Program Elapsed time: 41 seconds

timelyart commented 2 months ago

Changes to the DOM aren't pushed to everyone at the same time. Either of us may lag behind the other. It might also be a browser cache issue. You can clear the cache by running python main.py -cls if you have not done so already.

To find the CSS of an element I use devtools (F12), find the right element with CTRL+SHIFT+C and click it. On the right side (elements tab), you can right click said element to generate CSS or XPATH. I prefer to use CSS over XPATH. However, you might end up with overly long values. Try to use id, class, name or other attributes to keep the CSS short and concise.

Furthermore, if you want to help a good first change would be to move the CSS dictionary out of the logic and into a separate file.

Lastly, most people eventually move to something like automated trading such as 3commas.io (for crypto), use TV's trading engine, or hook up their own software via webhooks.

johnmolino commented 2 months ago

OK got it - thanks. Just so I'm clear.... in the screener_to_watchlist.yaml file I should have - url: https://www.tradingview.com/screener/ (and not my actual Personal screener URL)? Also - which is the first element I'm looking for to find the CSS? I'd like to solve 1 problem myself so I can fish! :)

On Sat, Sep 14, 2024 at 12:01 PM timelyart @.***> wrote:

Changes to the DOM aren't pushed to everyone at the same time. Either of us may lag behind the other. It might also be a browser cache issue. You can clear the cache by running python main.py -cls if you have not done so already.

To find the CSS of an element I use devtools (F12), find the right element with CTRL+SHIFT+C and click it. On the right side (elements tab), you can right click said element to generate CSS or XPATH. I prefer to use CSS over XPATH. However, you might end up with overly long values. Try to use id, class, name or other attributes to keep the CSS short.

Furthermore, if you want to help a good first change would be to move the CSS dictionary out of the logic and into a separate file.

Lastly, most people eventually move to something like automated trading such as 3commas.io (for crypto), use TV's trading engine, or hook up their own software via webhooks.

— Reply to this email directly, view it on GitHub https://github.com/timelyart/Kairos/issues/121#issuecomment-2351044283, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6G7EJ64GZXMI7OWXQTN73ZWRMVRAVCNFSM6AAAAABOG4WO7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGA2DIMRYGM . You are receiving this because you authored the thread.Message ID: @.***>

timelyart commented 2 months ago

Ah. It seems /screener is different from /crypto-screener which is what I use. This used to be the same but it may have diverged some time ago already.

I will need to add some logic to differentiate between the two screeners. It shouldn't be a whole lot of work but unfortunately the next two weeks I will have very limited time. I see what I can do but I can't promise anything.

To get back to your question. It doesn't matter whether you use /screener or /screener/<my_screener but I'd use your personal URL so you know you have the right filters.

johnmolino commented 1 month ago

Hi - I was wondering if you've had the opportunity to fix the /screener version? I was unsuccessful...but I'll keep learning .. thank you.

timelyart commented 1 month ago

Unfortunately, the past month I have had limited time, and will continue to have limited time for the rest of the month. However, I will try my best to create a fix for the stock screener.

timelyart commented 1 month ago

It took less time than expected. Release v3.21 adds support for stocks (and other investment types).