Releases: PyneSys/pynecore
PyneCore v6.3.4
What's Changed
Bug Fixes
- Python 3.11 Compatibility: Fixed import error for
collections.abc.Bufferwhich was introduced in Python 3.12- Added fallback to
bytestype for Python versions < 3.12 - Ensures PyneCore works correctly on Python 3.11 (minimum supported version)
- Resolves ImportError when running on older Python versions
- Added fallback to
Technical Details
The Buffer type was added to collections.abc in Python 3.12 as part of PEP 688. This release adds a compatibility layer that:
- Uses the native
Buffertype on Python 3.12+ - Falls back to
byteson Python 3.11 - Maintains full functionality across all supported Python versions
PyneCore v6.3.3
Major Features
π Strategy System Enhancements
The strategy simulator has received significant improvements focused on performance, reliability, and feature completeness:
- PriceOrderBook Implementation: New O(log n) price-based order operations replacing linear search, providing dramatic performance improvements for large order books
- Complete OCA Support: Full One-Cancels-All (OCA) group functionality with cancel and reduce operations
- Enhanced Risk Management: Added max intraday filled orders tracking for better risk control
- Improved Order Processing: Added
is_market_orderflag and refined order handling logic
π Smart OHLCV Data Conversion
Comprehensive enhancement of data handling with intelligent automatic conversion capabilities:
- Automatic Format Detection: Supports CSV, JSON, and TXT files with smart detection
- Symbol & Provider Detection: Automatically identifies exchanges (BINANCE, BYBIT, CAPITALCOM, etc.) and symbols from filename patterns
- Tick Size Detection: Multi-method analysis using histogram clustering for accurate tick size determination
- Trading Hours Detection: Automatically distinguishes between 24/7 crypto markets and regular trading hours
- Interval Auto-Correction: Fixes gaps at data start for cleaner datasets
π New Financial Types
- Earnings Type: Added
Earningstype with related constants for earnings data handling - Dividends Type: Added
Dividendstype with dividend-related constants
Bug Fixes
Strategy System Fixes
- Fixed commission calculations for percentage-based commissions
- Corrected NA handling in quantity validation
- Fixed order processing logic for stop/limit orders
- Resolved pyramiding logic issues
- Fixed profit/loss/trail_points calculations to use entry price instead of close price
Test Infrastructure
- Fixed import hook registration order to ensure proper AST transformations
Performance Optimizations
- Position Class Optimization: Used
__slots__for 20-40% memory reduction - Order Book Operations: Optimized with bisect-based price level management
- Enhanced Bar Index Tracking: Improved debugging capabilities with better bar tracking
Testing Improvements
Comprehensive Slippage Test Suite
Expanded test suite with 4 new slippage strategies:
- Basic slippage tests
- Direction-based slippage tests
- Limit order slippage tests
- Pyramiding with slippage tests
Strategy Test Coverage
Added comprehensive validation for multiple strategy types:
- Channel Breakout strategy (5,893 trades validated)
- Keltner Channel strategy (521 trades validated)
- RSI strategy (389 trades validated)
- MACD strategy (3,617 trades validated)
- Supertrend strategy (1,205 trades validated)
- Bollinger Bands strategy (1,159 trades validated)
All tests include full CSV validation matching TradingView behavior exactly.
CLI Improvements
Data Commands
pyne data convert-from: Now auto-detects symbol, provider, and timeframe (removed redundant parameters)pyne data convert-to: Accepts direct file paths for easier usagepyne run: Automatic conversion of non-OHLCV files before execution
Breaking Changes
pyne data convert-from: Removed timeframe parameter (now auto-detected)pyne data convert-to: Changed to accept direct file paths instead of symbols
Statistics
- Files Changed: 63 files
- Lines Added: 149,621
- Lines Removed: 31,787
- New Test Data: Over 100,000 lines of validated test data
- Test Coverage: 13 new comprehensive test modules
Documentation
- Updated CLI documentation for data and run commands
- Added examples for automatic detection features
- Enhanced strategy system documentation
PyneCore v6.3.2
What's Changed
Features
- Add timenow() function: Implemented Pine Script
timenow()function that returns current UTC time in milliseconds since Unix epoch, with @module_property decorator for Pine Script compatibility
Bug Fixes
- Fix strategy order ID collision: Resolved critical bug where entry and exit orders with the same ID would overwrite each other. Now uses prefix-based storage ("entry_" and "exit_" prefixes) to maintain Pine Script compatibility while preventing collisions
Refactoring
- Improve function isolation performance: Replaced global
_call_countersdictionary with local counter variables using unicode separators, eliminating global state and improving thread safety
Testing
- Test improvements: Moved and updated persistent annotation assignment tests, fixed matrix test section
Technical Details
The order ID collision fix is particularly important for strategy execution. Previously, if you had:
strategy.entry("order1", ...)
strategy.exit("order1", ...) The exit order would overwrite the entry order. Now they're stored separately with prefixes, maintaining full Pine Script compatibility.
The function isolation refactoring removes global state, making the code cleaner and more performant. Counter variables are now local to each function with collision-safe naming using unicode middle dot separators.
Full Changelog: v6.3.1...v6.3.2
PyneCore v6.3.1
What's Changed
π Bug Fixes
Strategy System
- Fixed critical order leak in position direction changes: Resolved a bug where orders were not properly deleted from the orders dictionary when a position was fully closed during a direction change
- Fixed unnecessary position split: Added condition to prevent unnecessary splitting when closing to zero position
Provider System
- Improved CCXT ticker extraction robustness: Enhanced ticker extraction logic for better market details handling
- Fixed symbol casing in output paths: Ensured symbols are properly uppercased in provider output paths
β¨ New Features
Trailing Stop Implementation
- Complete trailing stop functionality: Added full support for trailing stop orders with
trail_priceandtrail_offsetparameters - Dynamic stop price updates: Trailing stops now automatically adjust based on high/low price movements
- Enhanced Order class: Added
trail_price,trail_offset, andtrail_triggeredattributes - Exit function improvements: Updated
exit()function to support trailing stop parameters - Close price execution: Added
_check_close()method for trailing stop execution at close price
Logging Enhancements
- Pine Script timezone support: Added custom
PineRichHandlerthat formats log timestamps usingsyminfo.timezone - Improved time handling: Modified
PineLogFormatterto use Pine Script time when available, with fallback to UTC or system time - Better log formatting: Replaced default RichHandler with custom PineRichHandler for improved time display
π Improvements
CLI Enhancements
- Added 120-minute interval support: Extended
TimeframeEnumto include 120-minute intervals for data commands
Code Quality
- Improved price rounding logic: Avoided unnecessary rounding when prices are already at tick level
- Better None comparison: Updated check methods to use
is Noneinstead of falsy checks for proper None comparison - Enhanced trailing stop checks: Added trailing stop support in both high and low price checks for long and short positions
Technical Details
The main changes focus on fixing critical order management issues and implementing comprehensive trailing stop functionality. The order leak fix prevents memory issues and incorrect order state during position direction changes. The new trailing stop feature provides advanced order management capabilities matching Pine Script v6 functionality.
Full Changelog
PyneCore v6.3.0
π New Features
Complete Matrix Implementation
- Full Pine Script matrix compatibility: Complete implementation of all 47 matrix methods and functions
- Mathematical operations: Matrix multiplication, addition, subtraction, determinant, inverse, transpose
- Statistical functions: Average, max, min, median, mode calculations
- Matrix properties: Trace, rank, eigenvalues, eigenvectors support
- Shape manipulation: Reshape, submatrix extraction, row/column operations
- Advanced features: Kronecker product, matrix power operations, pseudoinverse
- Property checks: Identity, diagonal, symmetric, triangular, stochastic matrix detection
- Pine Script API: Full
matrix.*function library with TradingView compatibility
Enum Input Support
- Script enum inputs: Added support for enum parameters in Pine Script
input()functions - Type preservation: Proper enum type handling and validation in script configurations
- Pine Script compatibility: Full support for TradingView-style enum input declarations
π Bug Fixes
API Key Validation
- Compilation fix: Fixed issue where Pine Script compilation was attempted without valid API key
- Better error handling: Improved error messages when API key is missing or invalid
π§ Improvements
OHLCV File Handling
- Path parameter flexibility: Updated OHLCV file functions to accept both
strandPathobjects - Better type annotations: Improved type safety for file path parameters
- Consistent API: Standardized path handling across all OHLCV operations
π οΈ Technical Details
This release significantly expands PyneCore's Pine Script compatibility with the complete matrix implementation, bringing it closer to full TradingView feature parity. The addition of enum input support enhances the development workflow for Pine Script developers.
PyneCore v6.2.1
π New Features
PyneSys API Client for Pine Script Compilation
- Added
pynesysmodule with API client for remote Pine Script compilation - New
pyne compilecommand that uses PyneSys API to compile.pinefiles to.py - Supports API key from command line (
--api-key) or config file (workdir/config/api.toml) - Smart compilation: skips files that are already up-to-date based on modification time
- Shows API usage statistics (daily/hourly limits and remaining quota)
- API key validation with expiration information display
π Bug Fixes
Fixed Empty Error Box on pyne Command
- Running
pynewithout arguments now shows help message instead of empty error box - Exit code is now 0 (success) when showing help
- Fixes issue #2
π Documentation
- Added comprehensive
compile.mddocumentation (210 lines) - Updated
run.mdwith API compilation features - Added Reddit community link to ecosystem documentation and pyproject.toml
π§ Technical Details
- API client implemented using Python stdlib only (no external dependencies)
- Comprehensive error handling for API errors, rate limits, and authentication issues
- Added file utilities for modification time handling
- Updated .gitignore with API-related patterns
Full commit history: v6.1.2...v6.2.1
PyneCore v6.1.2
PyneCore v6.1.2
π Bug Fixes
- Fixed plot() function compatibility with plotchar(): The plot() function now properly works when called from plotchar() function, resolving a critical issue that prevented plotchar from functioning correctly
- Improved error messages: Enhanced error messages in data conversion commands for better user guidance
- Fixed JSON loading: Added proper initialization for data variable in OHLCV file handling
π Improvements
- Clarified help text in CLI commands for data conversion
- Better error message when detecting text files with .ohlcv extension, now suggests the correct .csv extension in the conversion command
This is a hotfix release addressing the plotchar functionality issue.
PyneCore v6.1.1
π§ User Experience Improvements
New Features
-
@pyneMagic Docstring Validation: Added pre-import validation to ensure user scripts contain the required@pynemagic docstring comment at the beginning of the file. This prevents confusing AST transformation errors and provides clear guidance when the magic comment is missing. -
OHLCV File Format Detection: Added intelligent format detection to prevent CSV files renamed with
.ohlcvextension from being read as binary data. The system now detects text files by attempting ASCII decode and shows clear error messages with CLI conversion commands.
Technical Details
- Script Runner Enhancement: The
import_script()function now validates magic docstring presence before attempting module import, reading only the first 1KB for efficient detection - OHLCVReader Protection: Binary OHLCV reader now detects text files masquerading as binary format and provides helpful CLI conversion guidance
- Error Prevention: Both improvements prevent common user errors that previously resulted in confusing error messages or corrupted data
Benefits
- π‘οΈ Better Error Prevention: Catches common first-time user mistakes before they cause problems
- π Educational Guidance: Clear error messages teach users the correct workflow
- π Data Integrity: Prevents CSV files from being interpreted as binary OHLCV data
- β‘ User-Friendly: Immediate, actionable feedback for common issues
These improvements specifically address user confusion and data corruption issues reported by early adopters, making PyneCore more robust and user-friendly.
PyneCore v6.1.0
π PyneCore v6.1.0 - Breaking Changes Release
β οΈ Breaking Changes
- Parameter Renaming:
equity_pathβtrade_pathin ScriptRunner and CLI - CLI Flags:
--equity/-epβ--trade/-tp - Default Filename:
_equity.csvβ_trade.csv
β¨ Major Features
- Strategy Statistics Export: Complete TradingView-compatible statistics calculation and CSV export
- TradingView Risk Management: Full implementation of all 6 risk management functions (
allow_entry_in,max_drawdown,max_cons_loss_days, etc.)
π§ Improvements
- Phantom Position Fix: Enhanced position size rounding to eliminate tiny phantom positions
- Risk Integration: Risk checks integrated into
strategy.entry()function
ποΈ Technical Changes
- Version bump to 6.1.0 for breaking API changes
- Zero division protection in position calculations
π Migration Guide
If upgrading from v6.0.x:
- Replace
--equitywith--tradein CLI commands - Update
equity_pathtotrade_pathin ScriptRunner calls - Output files now use
_trade.csvsuffix
PyneCore v6.0.18
Bug Fixes
Phantom Position Resolution
- Fix strategy halt from phantom positions - Resolved critical floating-point precision bug where strategy.close() calls left tiny phantom positions (0.0000001) instead of properly closing to 0.0, preventing further trading
- Added floating point precision handling to eliminate phantom positions that could halt strategy execution
- Optimized crypto position size rounding with centralized factor calculation
TradingView Compatibility
- Fix percent_of_equity calculation - Fixed strategy entry order sizing to match TradingView behavior when using percent_of_equity as default quantity type
- TradingView now correctly calculates position size so that the total investment (position value + commission) equals the specified percentage of equity
- Added support for all commission types with proper formulas for percentage-based, cash per contract, and cash per order commission
Technical Improvements
- Centralized crypto size rounding factor calculation for better performance
- Enhanced floating point precision handling in position management
- Improved commission calculation accuracy across all commission types
- Better syminfo.basecurrency reference handling for crypto assets
This release resolves critical issues that could prevent strategies from executing properly due to phantom positions and ensures 100% compatibility with TradingView's position sizing calculations.