Skip to content

Commit 69aae17

Browse files
committed
ruff format
1 parent 198d475 commit 69aae17

6 files changed

Lines changed: 268 additions & 79 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ max-doc-length = 88
5959
[tool.ruff.format]
6060
quote-style = "single"
6161

62-
[tool.ruff.flake8-quotes]
62+
[tool.ruff.lint.flake8-quotes]
6363
docstring-quotes = "double"
6464
inline-quotes = "single"
6565
multiline-quotes = "double"
6666

67-
[tool.ruff.flake8-errmsg]
67+
[tool.ruff.lint.flake8-errmsg]
6868
max-string-length = 20
6969

7070
[tool.pyright]

src/tradingview_screener/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@
66

77
from tradingview_screener.column import Column, col
88
from tradingview_screener.query import Query, And, Or
9-
from tradingview_screener.screeners import bond, cfd, coin, crypto, crypto_dex, forex, futures, options, stocks
9+
from tradingview_screener.screeners import (
10+
bond,
11+
cfd,
12+
coin,
13+
crypto,
14+
crypto_dex,
15+
forex,
16+
futures,
17+
options,
18+
stocks,
19+
)

src/tradingview_screener/models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ class QueryDict(TypedDict, total=False):
8484
ignore_unknown_fields: bool # default false
8585
preset: Literal['index_components_market_pages', 'pre-market-gainers'] # there are many
8686
# other presets (these are just some a examples)
87-
price_conversion: dict[Literal['to_symbol'], bool] | dict[
88-
Literal['to_currency'], str # this string should be the currency in lower-case
89-
]
87+
price_conversion: (
88+
dict[Literal['to_symbol'], bool]
89+
| dict[
90+
Literal['to_currency'], str # this string should be the currency in lower-case
91+
]
92+
)
9093

9194

9295
class ScreenerRowDict(TypedDict):

src/tradingview_screener/query.py

Lines changed: 121 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,49 +43,128 @@
4343
'accept-language': 'en-US,en;q=0.9,it;q=0.8',
4444
}
4545
STOCKS_QUERY = {
46-
'markets': [],
47-
'symbols': {},
48-
'options': {'lang': 'en'},
49-
'columns': [
50-
'name', 'close', 'type', 'typespecs', 'pricescale', 'minmov', 'fractional',
51-
'minmove2', 'currency', 'change', 'volume', 'relative_volume_10d_calc',
52-
'market_cap_basic', 'fundamental_currency_code', 'price_earnings_ttm',
53-
'earnings_per_share_diluted_ttm', 'earnings_per_share_diluted_yoy_growth_ttm',
54-
'dividends_yield_current', 'sector.tr', 'market', 'sector',
55-
'AnalystRating', 'AnalystRating.tr',
46+
'markets': [],
47+
'symbols': {},
48+
'options': {'lang': 'en'},
49+
'columns': [
50+
'name',
51+
'close',
52+
'type',
53+
'typespecs',
54+
'pricescale',
55+
'minmov',
56+
'fractional',
57+
'minmove2',
58+
'currency',
59+
'change',
60+
'volume',
61+
'relative_volume_10d_calc',
62+
'market_cap_basic',
63+
'fundamental_currency_code',
64+
'price_earnings_ttm',
65+
'earnings_per_share_diluted_ttm',
66+
'earnings_per_share_diluted_yoy_growth_ttm',
67+
'dividends_yield_current',
68+
'sector.tr',
69+
'market',
70+
'sector',
71+
'AnalystRating',
72+
'AnalystRating.tr',
73+
],
74+
'filter': [{'left': 'is_primary', 'operation': 'equal', 'right': True}],
75+
'filter2': {
76+
'operator': 'and',
77+
'operands': [
78+
{
79+
'operation': {
80+
'operator': 'or',
81+
'operands': [
82+
{
83+
'operation': {
84+
'operator': 'and',
85+
'operands': [
86+
{
87+
'expression': {
88+
'left': 'type',
89+
'operation': 'equal',
90+
'right': 'stock',
91+
}
92+
},
93+
{
94+
'expression': {
95+
'left': 'typespecs',
96+
'operation': 'has',
97+
'right': ['common'],
98+
}
99+
},
100+
],
101+
}
102+
},
103+
{
104+
'operation': {
105+
'operator': 'and',
106+
'operands': [
107+
{
108+
'expression': {
109+
'left': 'type',
110+
'operation': 'equal',
111+
'right': 'stock',
112+
}
113+
},
114+
{
115+
'expression': {
116+
'left': 'typespecs',
117+
'operation': 'has',
118+
'right': ['preferred'],
119+
}
120+
},
121+
],
122+
}
123+
},
124+
{
125+
'operation': {
126+
'operator': 'and',
127+
'operands': [
128+
{
129+
'expression': {
130+
'left': 'type',
131+
'operation': 'equal',
132+
'right': 'dr',
133+
}
134+
},
135+
],
136+
}
137+
},
138+
{
139+
'operation': {
140+
'operator': 'and',
141+
'operands': [
142+
{
143+
'expression': {
144+
'left': 'type',
145+
'operation': 'equal',
146+
'right': 'fund',
147+
}
148+
},
149+
{
150+
'expression': {
151+
'left': 'typespecs',
152+
'operation': 'has_none_of',
153+
'right': ['etf', 'mutual', 'closedend'],
154+
}
155+
},
156+
],
157+
}
158+
},
159+
],
160+
}
161+
},
162+
{'expression': {'left': 'typespecs', 'operation': 'has_none_of', 'right': ['pre-ipo']}},
56163
],
57-
'filter': [{'left': 'is_primary', 'operation': 'equal', 'right': True}],
58-
'filter2': {
59-
'operator': 'and',
60-
'operands': [
61-
{
62-
'operation': {
63-
'operator': 'or',
64-
'operands': [
65-
{'operation': {'operator': 'and', 'operands': [
66-
{'expression': {'left': 'type', 'operation': 'equal', 'right': 'stock'}},
67-
{'expression': {'left': 'typespecs', 'operation': 'has', 'right': ['common']}},
68-
]}},
69-
{'operation': {'operator': 'and', 'operands': [
70-
{'expression': {'left': 'type', 'operation': 'equal', 'right': 'stock'}},
71-
{'expression': {'left': 'typespecs', 'operation': 'has', 'right': ['preferred']}},
72-
]}},
73-
{'operation': {'operator': 'and', 'operands': [
74-
{'expression': {'left': 'type', 'operation': 'equal', 'right': 'dr'}},
75-
]}},
76-
{'operation': {'operator': 'and', 'operands': [
77-
{'expression': {'left': 'type', 'operation': 'equal', 'right': 'fund'}},
78-
{'expression': {'left': 'typespecs', 'operation': 'has_none_of', 'right': ['etf', 'mutual', 'closedend']}},
79-
]}},
80-
],
81-
}
82-
},
83-
{'expression': {'left': 'typespecs', 'operation': 'has_none_of', 'right': ['pre-ipo']}},
84-
],
85-
},
86-
'sort': {'sortBy': 'market_cap_basic', 'sortOrder': 'desc'},
87-
'range': DEFAULT_RANGE.copy(),
88-
'ignore_unknown_fields': False,
164+
},
165+
'sort': {'sortBy': 'market_cap_basic', 'sortOrder': 'desc'},
166+
'range': DEFAULT_RANGE.copy(),
167+
'ignore_unknown_fields': False,
89168
}
90169

91170

0 commit comments

Comments
 (0)