{"id":34023824,"url":"https://github.com/kwesy/pytradingview","last_synced_at":"2026-03-17T20:35:53.047Z","repository":{"id":288237098,"uuid":"966419961","full_name":"kwesy/pytradingview","owner":"kwesy","description":"A lightweight, open-source Python client for connecting to TradingView's WebSocket API.","archived":false,"fork":false,"pushed_at":"2026-02-09T17:07:39.000Z","size":49,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-09T21:54:16.084Z","etag":null,"topics":["automation","crypto","crypto-bot","forex","trading","tradingbot"],"latest_commit_sha":null,"homepage":"https://github.com/kwesy/pytradingview","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwesy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-14T22:32:25.000Z","updated_at":"2026-02-09T17:07:43.000Z","dependencies_parsed_at":"2025-04-16T11:40:30.502Z","dependency_job_id":null,"html_url":"https://github.com/kwesy/pytradingview","commit_stats":null,"previous_names":["kwesy/pytradingview"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kwesy/pytradingview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwesy%2Fpytradingview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwesy%2Fpytradingview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwesy%2Fpytradingview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwesy%2Fpytradingview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwesy","download_url":"https://codeload.github.com/kwesy/pytradingview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwesy%2Fpytradingview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30631361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","crypto","crypto-bot","forex","trading","tradingbot"],"created_at":"2025-12-13T16:03:01.132Z","updated_at":"2026-03-17T20:35:53.034Z","avatar_url":"https://github.com/kwesy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytradingview\n\nA lightweight, open-source Python client for connecting to TradingView's WebSocket API.\n\n## Features\n\n- WebSocket connection management\n- Easy to extend for custom signals and data\n- Download data\n- Search for symbols\n\n## Dependencies\n```bash\nwebsocket-client\nrequests\n```\n\n## Installation\n\n```bash\npip install pytradingview\n```\n\n## Usage\n```python\n# example.py\nfrom pytradingview import TVclient\n\n# Create the client and chart\nclient = TVclient()\nchart = client.chart\n\n# Set up the chart\nchart.set_up_chart()\n\n# Set the market\nchart.set_market(\"BINANCE:BTCUSD\", {\n    \"timeframe\": \"1\",  # 1-minute chart\n    \"currency\": \"USD\",\n})\n\n# Event: When the symbol data is loaded\nchart.on_symbol_loaded(lambda _: print(\"✅ Market loaded:\", chart.get_infos['description']))\n\n# Event: When price data is updated\ndef handle_update(_):\n    if chart.get_periods:\n        print(f\"🟢 New Price: {chart.get_periods['close']}\")\n\nchart.on_update(handle_update)\n\n# Start the WebSocket connection\nclient.create_connection()\n\n```\n\n### Authentication\nGuest mode (default):\n\n```python\nfrom pytradingview import TVclient\nclient = TVclient()  # uses TradingView unauthorized_user_token\n```\n\nAuth token mode:\n\n```python\nfrom pytradingview import TVclient\nclient = TVclient(auth_token=\"YOUR_TRADINGVIEW_AUTH_TOKEN\")\n```\n\nUsername/password mode (fetches token via TradingView signin endpoint):\n\n```python\nfrom pytradingview import TVclient\nclient = TVclient(username=\"you@example.com\", password=\"your-password\")\n```\n\n#### Command line (CLI)\n```bash\npython -m pytradingview -d -s '2025-04-24 00:00' -e '2025-04-25 00:00' -p 'FX:EURUSD' \n```\n```bash\npython -m pytradingview -d -s '2025-04-24 00:00' -e 'now' -p 'FX:EURUSD'\n```\n```bash\npython -m pytradingview --search EURUSD --max 50\n```\n```bash\npython -m pytradingview -d -p 'CME_MINI:ES1!' -t '1' -s '-1d' -e 'now' --username 'you@example.com' --password 'your-password'\n```\n```bash\nexport PYTRADINGVIEW_AUTH_TOKEN='YOUR_TRADINGVIEW_AUTH_TOKEN'\npython -m pytradingview -d -p 'CME_MINI:ES1!' -t '1' --start=-2h --end=now -o /tmp/es_1m.csv\n```\n\n## Contributing\n\nContributions are welcome! Please open issues or PRs to collaborate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwesy%2Fpytradingview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwesy%2Fpytradingview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwesy%2Fpytradingview/lists"}