mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 17:18:05 +00:00
docs: add license rationale, Python/PineScript guides, API updates
- Add docs/license.md with Apache 2.0 rationale and patent protection analysis - Add docs/python.md and docs/pinescript.md platform guides - Expand README license section with disclosure and link to rationale - Update docs/api.md and docs/architecture.md - Update Python bindings: helpers, all indicator modules, pyproject.toml - Add Python tests for Arrow and Polars integration - Update TValue core type and documentation - Add fix_length_to_period tooling script
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
0.8.2
|
||||
0.8.3
|
||||
@@ -9,7 +9,7 @@
|
||||
| **Output range** | Varies (see docs) |
|
||||
| **Warmup** | 1 bar |
|
||||
|
||||
### TL;DR
|
||||
## TL;DR
|
||||
|
||||
- `TValue` is the fundamental atomic unit of data in QuanTAlib.
|
||||
- No configurable parameters; computation is stateless per bar.
|
||||
@@ -73,16 +73,23 @@ var t1 = new TValue(DateTime.UtcNow, 100.5);
|
||||
var t2 = new TValue(DateTime.UtcNow.Ticks, 100.5);
|
||||
```
|
||||
|
||||
### Implicit Conversions
|
||||
### Conversions
|
||||
|
||||
```csharp
|
||||
TValue tv = new TValue(DateTime.UtcNow, 42.0);
|
||||
|
||||
// Implicitly converts to double
|
||||
double val = tv; // 42.0
|
||||
// Explicitly converts to double (requires cast)
|
||||
double val = (double)tv; // 42.0
|
||||
|
||||
// Implicitly converts to DateTime
|
||||
DateTime dt = tv; // DateTime object
|
||||
|
||||
// Implicitly converts from double (uses DateTime.UtcNow)
|
||||
TValue fromDouble = 110.4; // same as new TValue(DateTime.UtcNow, 110.4)
|
||||
|
||||
// Enables ergonomic indicator APIs
|
||||
var sma = new Sma(14);
|
||||
var result = sma.Update(110.4); // double → TValue implicit conversion
|
||||
```
|
||||
|
||||
### String Representation
|
||||
|
||||
@@ -26,6 +26,13 @@ public readonly record struct TValue(long Time, double Value) : ISpanFormattable
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator DateTime(TValue tv) => new(tv.Time, DateTimeKind.Utc);
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts a raw double to a TValue with DateTime.UtcNow timestamp.
|
||||
/// Enables ergonomic APIs like <c>sma.Update(110.4)</c>.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator TValue(double value) => new(DateTime.UtcNow, value);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user