trd-utils 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of trd-utils might be problematic. Click here for more details.

@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
1
  import json
5
2
  from typing import Optional
6
3
 
@@ -10,41 +7,45 @@ from .tradingview_types import CoinScanInfo
10
7
  class TradingViewClient:
11
8
  """TradingViewClient class to interact with TradingView API."""
12
9
 
13
-
14
10
  def __init__(self) -> None:
15
11
  pass
16
12
 
17
- async def get_coin_scan(self,
18
- coin_filter: Optional[str] = None,
19
- limit: int = 200,
20
- offset: int = 0) -> list['CoinScanInfo']:
13
+ async def get_coin_scan(
14
+ self,
15
+ coin_filter: Optional[str] = None,
16
+ limit: int = 200,
17
+ offset: int = 0,
18
+ ) -> list["CoinScanInfo"]:
21
19
  import httpx
20
+
22
21
  cookies = {
23
- 'cookiesSettings': '{"analytics":true,"advertising":true}',
24
- 'cookiePrivacyPreferenceBannerProduction': 'accepted',
22
+ "cookiesSettings": '{"analytics":true,"advertising":true}',
23
+ "cookiePrivacyPreferenceBannerProduction": "accepted",
25
24
  }
26
25
 
27
26
  headers = {
28
- 'accept': 'application/json',
29
- 'accept-language': 'en-US,en;q=0.9',
30
- 'cache-control': 'no-cache',
31
- 'content-type': 'text/plain;charset=UTF-8',
32
- 'origin': 'https://www.tradingview.com',
33
- 'pragma': 'no-cache',
34
- 'priority': 'u=1, i',
35
- 'referer': 'https://www.tradingview.com/',
36
- 'sec-ch-ua': '"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
37
- 'sec-ch-ua-mobile': '?0',
38
- 'sec-ch-ua-platform': '"Windows"',
39
- 'sec-fetch-dest': 'empty',
40
- 'sec-fetch-mode': 'cors',
41
- 'sec-fetch-site': 'same-site',
42
- 'user-agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' +
43
- '(KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'),
27
+ "accept": "application/json",
28
+ "accept-language": "en-US,en;q=0.9",
29
+ "cache-control": "no-cache",
30
+ "content-type": "text/plain;charset=UTF-8",
31
+ "origin": "https://www.tradingview.com",
32
+ "pragma": "no-cache",
33
+ "priority": "u=1, i",
34
+ "referer": "https://www.tradingview.com/",
35
+ "sec-ch-ua": '"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
36
+ "sec-ch-ua-mobile": "?0",
37
+ "sec-ch-ua-platform": '"Windows"',
38
+ "sec-fetch-dest": "empty",
39
+ "sec-fetch-mode": "cors",
40
+ "sec-fetch-site": "same-site",
41
+ "user-agent": (
42
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
43
+ + "(KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
44
+ ),
44
45
  }
45
46
 
46
47
  params = {
47
- 'label-product': 'screener-coin',
48
+ "label-product": "screener-coin",
48
49
  }
49
50
 
50
51
  data = {
@@ -83,19 +84,14 @@ class TradingViewClient:
83
84
  "Volatility.D",
84
85
  ],
85
86
  "ignore_unknown_fields": False,
86
- "options": {
87
- "lang": "en"
88
- },
89
- "range":[
87
+ "options": {"lang": "en"},
88
+ "range": [
90
89
  offset,
91
90
  offset + limit,
92
91
  ],
93
- "sort": {
94
- "sortBy": "crypto_total_rank",
95
- "sortOrder": "asc"
96
- },
92
+ "sort": {"sortBy": "crypto_total_rank", "sortOrder": "asc"},
97
93
  "symbols": {},
98
- "markets": ["coin"]
94
+ "markets": ["coin"],
99
95
  }
100
96
 
101
97
  if coin_filter:
@@ -103,13 +99,13 @@ class TradingViewClient:
103
99
  {
104
100
  "left": "base_currency,base_currency_desc",
105
101
  "operation": "match",
106
- "right": f"{coin_filter}"
102
+ "right": f"{coin_filter}",
107
103
  }
108
104
  ]
109
105
  data = json.dumps(data)
110
106
  async with httpx.AsyncClient() as client:
111
107
  response = await client.post(
112
- 'https://scanner.tradingview.com/coin/scan',
108
+ "https://scanner.tradingview.com/coin/scan",
113
109
  params=params,
114
110
  cookies=cookies,
115
111
  headers=headers,
@@ -127,4 +123,4 @@ class TradingViewClient:
127
123
  continue
128
124
  all_infos.append(CoinScanInfo._parse(current_data.get("d", [])))
129
125
 
130
- return all_infos
126
+ return all_infos
@@ -1,6 +1,5 @@
1
1
  import json
2
2
  from typing import (
3
- Optional,
4
3
  Union,
5
4
  get_type_hints,
6
5
  Any,
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 ALi.w
3
+ Copyright (c) 2024-2025 ALi.w
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: trd_utils
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Common Basic Utils for Python3. By ALiwoto.
5
- Home-page: https://github.com/ALiwoto/trd_utils
6
5
  Keywords: utils,trd_utils,basic-utils,common-utils
7
6
  Author: ALiwoto
8
7
  Author-email: aminnimaj@gmail.com
@@ -20,9 +19,20 @@ Classifier: Programming Language :: Python :: 3.12
20
19
  Classifier: Programming Language :: Python :: 3.13
21
20
  Requires-Dist: cryptography (>=41.0.7)
22
21
  Requires-Dist: httpx (>=0.21.0)
22
+ Project-URL: Homepage, https://github.com/ALiwoto/trd_utils
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # Trd Utils
26
26
 
27
27
  Basic common utils for Python.
28
28
 
29
+ ## How to run tests
30
+
31
+ Use this command first:
32
+
33
+ ```bash
34
+ pip install -e .
35
+ ```
36
+
37
+ Then run the tests in vscode.
38
+
@@ -0,0 +1,23 @@
1
+ trd_utils/__init__.py,sha256=r1FyIVMcj4G09lxuES6Tc50rbc-_eR52L74_l10QWJY,24
2
+ trd_utils/cipher/__init__.py,sha256=V05KNuzQwCic-ihMVHlC8sENaJGc3I8MCb4pg4849X8,1765
3
+ trd_utils/common_utils/float_utils.py,sha256=W-jv7nzjl88xwGB6gsEXmDDhF6DseOrrVT2qx7OvyCo,266
4
+ trd_utils/exchanges/__init__.py,sha256=SQJt5cIXh305miWuDumkOLZHzqDUyOqSmlhTT9Xc9RY,180
5
+ trd_utils/exchanges/blofin/__init__.py,sha256=dQkY9aSbI5fZJDOSbkrbrbpHSbWbJjLEmjpkXxDMDD4,74
6
+ trd_utils/exchanges/blofin/blofin_client.py,sha256=IPmTTT437UdLW-FiGwi6ZEEurjD_rc8VxvykNIEdQFs,7628
7
+ trd_utils/exchanges/blofin/blofin_types.py,sha256=QlhgpBvFr-RwZB8agGwQSmhegw3__0TAsBg6oEXScYM,3664
8
+ trd_utils/exchanges/bx_ultra/__init__.py,sha256=8Ssy-eOemQR32Nv1-FoPHm87nRqRO4Fm2PU5GHEFKfQ,80
9
+ trd_utils/exchanges/bx_ultra/bx_types.py,sha256=FiJish58XpF6_vDRWxvpBVlPwXjC7uzK5K7CaA6Y8AI,25217
10
+ trd_utils/exchanges/bx_ultra/bx_ultra_client.py,sha256=4Zsybe7lzB7qSvOByp8KdoVvFcOAnFuStJJQuGWT6po,21164
11
+ trd_utils/exchanges/bx_ultra/bx_utils.py,sha256=PwapomwDW33arVmKIDj6cL-aP0ptu4BYy_lOCqSAPOo,1392
12
+ trd_utils/exchanges/exchange_base.py,sha256=SQERi-z9nvDAzuM4oZ3_v-wYWiw_eZV75jmAL2E4MG4,1976
13
+ trd_utils/html_utils/__init__.py,sha256=1WWs8C7JszRjTkmzIRLHpxWECHur_DrulTPGIeX88oM,426
14
+ trd_utils/html_utils/html_formats.py,sha256=unKsvOiiDmYTTaM0DYZEUNLEUzWQKKrqASJXvY54kvU,2299
15
+ trd_utils/tradingview/__init__.py,sha256=H0QYb-O5qvy7qC3yswtlcSWLmeBnaS6oJ3JtjvmaV_Y,154
16
+ trd_utils/tradingview/tradingview_client.py,sha256=g_eWYaCRQAL8Kvd-r6AnAdbH7Jha6C_GAyCuxh-RQUU,3917
17
+ trd_utils/tradingview/tradingview_types.py,sha256=z21MXPVdWHAduEl3gSeMIRhxtBN9yK-jPYHfZSMIbSA,6144
18
+ trd_utils/types_helper/__init__.py,sha256=SB9_5bQkuxV059AKC4cXYwsLPT3lM4LOu2m8LpMhZlQ,60
19
+ trd_utils/types_helper/base_model.py,sha256=08P5GatIjLoBGVudF7dcKDpibLqcpUeqE-zLRh1FjEE,5617
20
+ trd_utils-0.0.5.dist-info/LICENSE,sha256=J1EP2xt87RjjmsTV1jTjHDQMLIM9FjdwEftTpw8hyv4,1067
21
+ trd_utils-0.0.5.dist-info/METADATA,sha256=oD-HdWY6g30VIE623ZCBQf_8d0fcsMtXBcJVuEpotoc,1094
22
+ trd_utils-0.0.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
23
+ trd_utils-0.0.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,17 +0,0 @@
1
- trd_utils/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
2
- trd_utils/bx_ultra/__init__.py,sha256=8Ssy-eOemQR32Nv1-FoPHm87nRqRO4Fm2PU5GHEFKfQ,80
3
- trd_utils/bx_ultra/bx_types.py,sha256=avgj7JFijJpK3_WBMrV5HaK4rssBnj0eG7kToEbdvAQ,21646
4
- trd_utils/bx_ultra/bx_ultra_client.py,sha256=w2ajrBLDrSeRAPXCPV4lkUkR-r1PqE1Kwu2bxbJUy7A,15876
5
- trd_utils/bx_ultra/common_utils.py,sha256=p9u3D52jCa9DNJzo-oA1yK_lrdb7_ahkGHaTuiX5wGE,1656
6
- trd_utils/cipher/__init__.py,sha256=V05KNuzQwCic-ihMVHlC8sENaJGc3I8MCb4pg4849X8,1765
7
- trd_utils/html_utils/__init__.py,sha256=1WWs8C7JszRjTkmzIRLHpxWECHur_DrulTPGIeX88oM,426
8
- trd_utils/html_utils/html_formats.py,sha256=unKsvOiiDmYTTaM0DYZEUNLEUzWQKKrqASJXvY54kvU,2299
9
- trd_utils/tradingview/__init__.py,sha256=H0QYb-O5qvy7qC3yswtlcSWLmeBnaS6oJ3JtjvmaV_Y,154
10
- trd_utils/tradingview/tradingview_client.py,sha256=iiNSLSKr5PnDcGiVFn515gsnGtqm5Htu99IwShHr2wM,4007
11
- trd_utils/tradingview/tradingview_types.py,sha256=z21MXPVdWHAduEl3gSeMIRhxtBN9yK-jPYHfZSMIbSA,6144
12
- trd_utils/types_helper/__init__.py,sha256=SB9_5bQkuxV059AKC4cXYwsLPT3lM4LOu2m8LpMhZlQ,60
13
- trd_utils/types_helper/base_model.py,sha256=J3SdOB9UNgw0cI8gaG8zjnfqa1qiVmlpz4o3aBxHqas,5631
14
- trd_utils-0.0.3.dist-info/LICENSE,sha256=msfwzd8S06fL8ORRneycnonTKmyuXzfeBT0V2figir8,1062
15
- trd_utils-0.0.3.dist-info/METADATA,sha256=uhT5sTw4F0V-uIdk-i3iz3EKSfDHq8TU8FpELH0-K-o,975
16
- trd_utils-0.0.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
- trd_utils-0.0.3.dist-info/RECORD,,
File without changes