Skip to content

Releases: PyneSys/pynecore

PyneCore v6.3.4

19 Sep 06:25

Choose a tag to compare

What's Changed

Bug Fixes

  • Python 3.11 Compatibility: Fixed import error for collections.abc.Buffer which was introduced in Python 3.12
    • Added fallback to bytes type for Python versions < 3.12
    • Ensures PyneCore works correctly on Python 3.11 (minimum supported version)
    • Resolves ImportError when running on older Python versions

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 Buffer type on Python 3.12+
  • Falls back to bytes on Python 3.11
  • Maintains full functionality across all supported Python versions

PyneCore v6.3.3

18 Sep 18:32

Choose a tag to compare

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_order flag 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 Earnings type with related constants for earnings data handling
  • Dividends Type: Added Dividends type 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 usage
  • pyne 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

17 Aug 23:43

Choose a tag to compare

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_counters dictionary 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

15 Aug 13:19

Choose a tag to compare

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_price and trail_offset parameters
  • Dynamic stop price updates: Trailing stops now automatically adjust based on high/low price movements
  • Enhanced Order class: Added trail_price, trail_offset, and trail_triggered attributes
  • 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 PineRichHandler that formats log timestamps using syminfo.timezone
  • Improved time handling: Modified PineLogFormatter to 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 TimeframeEnum to 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 None instead 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

  • febd4f1: fix: resolve order leak in position direction change and implement trailing stop
  • e2a5dcf: feat(log): add custom time handling with Pine Script timezone
  • 0cb4085: fix(ccxt): improve ticker extraction for market details robustness

PyneCore v6.3.0

07 Aug 16:10

Choose a tag to compare

πŸŽ‰ 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 str and Path objects
  • 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

03 Aug 17:05

Choose a tag to compare

πŸš€ New Features

PyneSys API Client for Pine Script Compilation

  • Added pynesys module with API client for remote Pine Script compilation
  • New pyne compile command that uses PyneSys API to compile .pine files 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 pyne without 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.md documentation (210 lines)
  • Updated run.md with 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

27 Jul 06:46

Choose a tag to compare

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

25 Jul 17:44

Choose a tag to compare

πŸ”§ User Experience Improvements

New Features

  • @pyne Magic Docstring Validation: Added pre-import validation to ensure user scripts contain the required @pyne magic 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 .ohlcv extension 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

25 Jul 08:56

Choose a tag to compare

πŸš€ PyneCore v6.1.0 - Breaking Changes Release

⚠️ Breaking Changes

  • Parameter Renaming: equity_path β†’ trade_path in 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 --equity with --trade in CLI commands
  • Update equity_path to trade_path in ScriptRunner calls
  • Output files now use _trade.csv suffix

PyneCore v6.0.18

23 Jul 12:19

Choose a tag to compare

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.