{"id":28191824,"url":"https://github.com/pynesys/pynecore","last_synced_at":"2025-05-16T11:11:10.023Z","repository":{"id":286422856,"uuid":"911400708","full_name":"PyneSys/pynecore","owner":"PyneSys","description":"PyneCore - Pine Script Like Python Framework","archived":false,"fork":false,"pushed_at":"2025-04-26T12:16:52.000Z","size":1530,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-26T13:26:41.719Z","etag":null,"topics":["backtesting-engine","compiler","financial-data","framework","library","open-source","pine-script","pinescript","python","technical-analysis","trading-indicators","trading-strategies","tradingvew"],"latest_commit_sha":null,"homepage":"https://pynecore.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyneSys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2025-01-02T23:42:43.000Z","updated_at":"2025-04-26T12:16:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ef54e3b-2ed8-49aa-8662-3bc4bf53a9e4","html_url":"https://github.com/PyneSys/pynecore","commit_stats":null,"previous_names":["pynesys/pynecore"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyneSys%2Fpynecore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyneSys%2Fpynecore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyneSys%2Fpynecore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyneSys%2Fpynecore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyneSys","download_url":"https://codeload.github.com/PyneSys/pynecore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518400,"owners_count":22084376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["backtesting-engine","compiler","financial-data","framework","library","open-source","pine-script","pinescript","python","technical-analysis","trading-indicators","trading-strategies","tradingvew"],"created_at":"2025-05-16T11:10:54.862Z","updated_at":"2025-05-16T11:11:10.015Z","avatar_url":"https://github.com/PyneSys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/PyneSys/pynecore/refs/heads/main/docs/logo.svg\" alt=\"PyneCore Logo\"\u003e\n\u003ch1\u003ePyneCore™\u003c/h1\u003e\n\u003cstrong\u003ePine Script in Python - Without Limitations\u003c/strong\u003e\n\n\u003ca href=\"https://www.python.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Python-3.11%2B-blue\" alt=\"Python\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n## What is PyneCore?\n\nPyneCore brings TradingView's Pine Script capabilities to Python through a revolutionary approach - it transforms regular Python code to behave like Pine Script through AST transformations, while maintaining the full power of the Python ecosystem.\n\nInstead of creating another object-oriented wrapper or a new language, PyneCore modifies your Python code at import time, giving you the intuitive bar-by-bar execution model of Pine Script without leaving Python's rich environment.\n\n## Key Features\n\n- **Native Pine Script Semantics in Python**: Write familiar Python code that runs with Pine Script's bar-by-bar execution model\n- **AST Transformation Magic**: Your code is transformed at import time to implement Pine Script behavior\n- **High Performance**: Zero mandatory external dependencies with highly optimized implementation\n- **Series \u0026 Persistent Variables**: Full support for Pine Script's time series and state persistence\n- **Function Isolation**: Each function call gets its own isolated persistent state\n- **NA Handling**: Graceful handling of missing data with Pine Script's NA system\n- **Technical Analysis Library**: Comprehensive set of Pine Script-compatible indicators and functions\n- **Strategy Backtesting**: Pine Script compatible framework for developing and testing trading strategies\n\n## Quick Example\n\n```python\n\"\"\"\n@pyne\n\"\"\"\nfrom pynecore import Series\nfrom pynecore.lib import script, close, ta, plot, color, input\n\n@script.indicator(title=\"Bollinger Bands\")\ndef main(\n    length=input.int(\"Length\", 20, minval=1),\n    mult=input.float(\"Multiplier\", 2.0, minval=0.1, step=0.1),\n    src=input.source(\"Source\", close)\n):\n    # Calculate Bollinger Bands\n    basis = ta.sma(src, length)\n    dev = mult * ta.stdev(src, length)\n\n    upper = basis + dev\n    lower = basis - dev\n\n    # Output to chart\n    plot(basis, \"Basis\", color=color.orange)\n    plot(upper, \"Upper\", color=color.blue)\n    plot(lower, \"Lower\", color=color.blue)\n```\n\n## Innovative Concepts\n\nPyneCore introduces several revolutionary concepts:\n\n### 1. Magic Comment \u0026 Import Hook\n\nIdentify your scripts with a simple magic comment:\n\n```python\n\"\"\"\n@pyne\n\"\"\"\n```\n\nThis activates PyneCore's import hook system which intercepts Python imports and applies AST transformations to recognized scripts.\n\n### 2. Series Variables\n\nTrack historical data across bars, just like in Pine Script:\n\n```python\nfrom pynecore import Series\n\nprice: Series[float] = close\nprevious_price = price[1]  # Access previous bar's price\n```\n\n### 3. Persistent Variables\n\nMaintain state between bars with simple type annotations:\n\n```python\nfrom pynecore import Persistent\n\ncounter: Persistent[int] = 0\ncounter += 1  # Increments with each bar\n```\n\n### 4. Function Isolation\n\nEach call to a function maintains its own isolated state:\n\n```python\ndef my_indicator(src, length):\n    # Each call gets its own instance of sum\n    sum: Persistent[float] = 0\n    sum += src\n    return sum / length\n```\n\n## Installation\n\n```bash\n# Basic installation\npip install pynesys-pynecore\n\n# With CLI tools (recommended)\npip install pynesys-pynecore[cli]\n\n# With all features including data providers\npip install pynesys-pynecore[all]\n```\n\n## Getting Started\n\n### Create a Simple Script\n\n1. Create a file with the `@pyne` annotation:\n\n```python\n\"\"\"\n@pyne\n\"\"\"\nfrom pynecore.lib import script, close, plot\n\n@script.indicator(\"My First Indicator\")\ndef main():\n    # Calculate a simple moving average\n    sma_value = (close + close[1] + close[2]) / 3\n\n    # Plot the result\n    plot(sma_value, \"Simple Moving Average\")\n```\n\n2. Run your script with the PyneCore CLI:\n\n```bash\n# First, download some price data\npyne data download ccxt --symbol \"BYBIT:BTC/USDT:USDT\"\n\n# Then run your script on the data\npyne run my_script.py ccxt_BYBIT_BTC_USDT_USDT_1D.ohlcv\n```\n\n## Why Choose PyneCore?\n\n- **Beyond TradingView Limitations**: No more platform restrictions, code size limits, or subscription fees\n- **Python Ecosystem Access**: Use Python's data science, ML, and analysis libraries alongside trading logic\n- **Performance \u0026 Precision**: Designed for speed and precision, the same results as Pine Script\n- **Open Source Foundation**: The core library and runtime is open source under Apache 2.0 license\n- **Professional Trading Tools**: Build institutional-grade systems with Pine Script simplicity\n- **Advanced Backtesting**: Run sophisticated strategy tests outside platform constraints\n\n## Documentation \u0026 Support\n\n- **Documentation**: [pynecore.org](https://pynecore.org/docs)\n\n### Community\n\n- **Discussions**: [GitHub Discussions](https://github.com/pynesys/pynecore/discussions)\n- **Discord**: [discord.com/invite/7rhPbSqSG7](https://discord.com/invite/7rhPbSqSG7)\n- **X**: [x.com/pynesys](https://x.com/pynesys)\n- **Website**: [pynecore.org](https://pynecore.org)\n\n## License\n\nPyneCore is licensed under the [Apache License 2.0](LICENSE.txt).\n\n## Disclaimer\n\nPine Script™ is a trademark of TradingView, Inc. PyneCore is not affiliated with, endorsed by, or sponsored by TradingView. This project is an independent implementation that aims to provide compatibility with the Pine Script language concept in the Python ecosystem.\n\n### Risk Warning\n\nTrading involves significant risk of loss and is not suitable for all investors. The use of PyneCore does not guarantee any specific results. Past performance is not indicative of future results.\n\n- PyneCore is provided \"as is\" without any warranty of any kind\n- PyneCore is not a trading advisor and does not provide trading advice\n- Scripts created with PyneCore should be thoroughly tested before using with real funds\n- Users are responsible for their own trading decisions\n- You should consult with a licensed financial advisor before making any financial decisions\n\nBy using PyneCore, you acknowledge that you are using the software at your own risk. The creators and contributors of PyneCore shall not be held liable for any financial loss or damage resulting from the use of this software.\n\n## Commercial Support\n\nPyneCore is part of the PyneSys ecosystem. For commercial support, custom development, or enterprise solutions:\n\n- **Website**: [pynesys.com/contact](https://pynesys.com/contact)\n\n---\n\u003cstrong\u003eElevate Your Trading with the Power of Python \u0026 Pine Script\u003c/strong\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpynesys%2Fpynecore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpynesys%2Fpynecore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpynesys%2Fpynecore/lists"}