-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query to filter with "above of below %" #25
Comments
Hey, first of all thanks for letting me know.
So you can compare a column to another column or to a value, i.e.: Column('close') > 125.0
# or
Column('close') > Column('price_52_week_low') not both. Can you show me how you would accomplish what you mentioned through the website? (please share a screenshot) |
Find attached 2 screenshots of the filter with TradingView Screener v2 using the app in my desktop computer: Will be great if if we can do the same with this python code. In the documentation I see:
Maybe a solution for the filter "Price above New Low 52 Weeks by 100% or more" can be a new method like abovePercentage() / belowPercentage() ?
Thank you |
I now understand what you mean, there is a whole new version of the screener (also the syntax of the backend changed). I'm gonna open a new branch in which we can add this functionality. And I'm probably gonna release it in a major-breaking-version (v3.0.0). |
Never mind, I'm still not done with 3.0.0, so I added this method ( https://github.com/shner-elmo/TradingView-Screener/releases/tag/v2.5.0 |
Good job with this update! I just tested the new methods above_pct(), below_pct() and between_pct() but I found some issues if I set the tickers: E.g. query 1:
Return is OK: (14, ticker name close E.g. query 2 (with set_tickers()):
Return this: >>> q.get_scanner_data() |
Thanks for the feedback. There is a bug in the code that doesn't set the markets properly. q = Query().select('name', 'close')
q.where(Column('close').above_pct('VWAP', 1.40))
q.set_tickers('OTC:SRNE','OTC:BNSOF','OTC:RDTCF')
q.set_markets('america')
q.get_scanner_data()
|
Hi, the new v2 screener of Trading view allows to have filters like this: "Price above New Low 52 Weeks by 100% or more"
I try to implement this filter with the Query() I add a multiplier (*2) at the end of Column('price_52_week_low'):
(Query()
.select('name', 'close', 'price_52_week_low')
.where(
Column('close') >= (Column('price_52_week_low')*2 ) ,
)
.get_scanner_data())
but get this error:
Traceback (most recent call last):
File "", line 4, in
TypeError: unsupported operand type(s) for +: 'int' and 'Column'
Is there any other way to implement this kind of filters using the "above of below %"?
Thank you
The text was updated successfully, but these errors were encountered: