mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-19 11:08:05 +00:00
VIDYA indicator with adaptive smoothing based on market volatility.
This commit is contained in:
@@ -18,6 +18,7 @@ The file must have a header row and follow this column order:
|
||||
- **Prices/Volume**: Numeric values
|
||||
|
||||
Example:
|
||||
|
||||
```csv
|
||||
Date,Open,High,Low,Close,Volume
|
||||
2024-01-01,100.0,105.0,99.0,102.5,10000
|
||||
@@ -38,11 +39,13 @@ public class CsvFeed : IFeed
|
||||
## Usage
|
||||
|
||||
### 1. Loading Data
|
||||
|
||||
```csharp
|
||||
var feed = new CsvFeed("path/to/data.csv");
|
||||
```
|
||||
|
||||
### 2. Streaming Data (Simulation)
|
||||
|
||||
```csharp
|
||||
// Get first bar
|
||||
var bar = feed.Next(isNew: true);
|
||||
@@ -63,6 +66,7 @@ while (true)
|
||||
```
|
||||
|
||||
### 3. Fetching a Batch
|
||||
|
||||
```csharp
|
||||
long startTime = new DateTime(2024, 1, 1).Ticks;
|
||||
var batch = feed.Fetch(10, startTime, TimeSpan.FromDays(1));
|
||||
|
||||
@@ -17,6 +17,7 @@ The price evolution follows the stochastic differential equation:
|
||||
$$ dS_t = \mu S_t dt + \sigma S_t dW_t $$
|
||||
|
||||
Where:
|
||||
|
||||
- $S_t$: Asset price at time $t$
|
||||
- $\mu$: Drift (expected return)
|
||||
- $\sigma$: Volatility (standard deviation of returns)
|
||||
@@ -37,6 +38,7 @@ public class GBM : IFeed
|
||||
## Usage
|
||||
|
||||
### 1. Initialization
|
||||
|
||||
```csharp
|
||||
// Default: Start at 100, 5% drift, 20% volatility
|
||||
var gbm = new GBM();
|
||||
@@ -46,6 +48,7 @@ var volatileGbm = new GBM(startPrice: 50.0, mu: 0.10, sigma: 0.50);
|
||||
```
|
||||
|
||||
### 2. Streaming Generation
|
||||
|
||||
```csharp
|
||||
// Generate a new bar
|
||||
var bar = gbm.Next(isNew: true);
|
||||
@@ -59,6 +62,7 @@ for (int i = 0; i < 5; i++)
|
||||
```
|
||||
|
||||
### 3. Batch Generation
|
||||
|
||||
```csharp
|
||||
long startTime = DateTime.UtcNow.Ticks;
|
||||
var interval = TimeSpan.FromMinutes(1);
|
||||
|
||||
Reference in New Issue
Block a user