instances.md
1 # Instances API 2 3 The Instances module manages asset instances within strategies, handling position tracking, margin management, and asset-specific data. It provides the bridge between abstract assets and their concrete usage in trading strategies. 4 5 ## Overview 6 7 The Instances module handles: 8 - Asset instance creation and management 9 - Position tracking for spot and margin trading 10 - OHLCV data association with assets 11 - Fee calculation and management 12 - Balance and cash tracking 13 - Margin and leverage management 14 15 ## Core Types 16 17 ### Asset Instance 18 19 20 ### Position Types 21 22 23 ## Asset Instance Management 24 25 ### Basic Asset Instance Operations 26 27 28 ### Asset Instance Information 29 30 31 ### Data Access and Management 32 33 34 ## Position Management 35 36 ### Spot Trading Positions 37 38 39 ### Margin Trading Positions 40 41 42 ## Fee Management 43 44 ### Fee Calculation 45 46 47 ## Cash and Balance Management 48 49 ### Cash Operations 50 51 52 ### Portfolio Value Calculation 53 54 55 ## Performance Optimization 56 57 ### Efficient Instance Operations 58 59 60 ## Integration Examples 61 62 ### Strategy Integration 63 64 65 ## Complete API Reference 66 67 ```@autodocs 68 Modules = [Planar.Engine.Instances] 69 ``` 70 71 ## See Also 72 73 - **[Instruments API](instruments.md)** - Financial instrument definitions 74 - **[Strategies API](strategies.md)** - Strategy base classes and interfaces 75 - **[Data API](../data.md)** - Data structures and management 76 - **[Executors API](executors.md)** - Order execution and management 77 - **[Strategy Development Guide](../guides/strategy-development.md)** - Building trading strategies 78 - **[Advanced Trading Guide](../advanced/risk-management.md)** - Margin and derivative trading