Skip to content

Commit

Permalink
Cannot use Self
Browse files Browse the repository at this point in the history
  • Loading branch information
lsbardel committed Jul 6, 2023
1 parent cac83f3 commit 82a8dfc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions quantflow/sp/heston.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Self
from __future__ import annotations

import numpy as np
from pydantic import Field
Expand All @@ -25,7 +25,7 @@ class Heston(StochasticProcess1D):
rho: float = Field(default=0, ge=-1, le=1, description="Correlation")

@classmethod
def create(cls, vol: float, kappa: float, sigma: float, rho: float) -> Self:
def create(cls, vol: float, kappa: float, sigma: float, rho: float) -> Heston:
return cls(
variance_process=CIR(
rate=vol * vol, kappa=kappa, sigma=sigma, theta=vol * vol
Expand Down
4 changes: 2 additions & 2 deletions quantflow/sp/ou.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Self
from __future__ import annotations

import numpy as np
from pydantic import Field
Expand All @@ -23,7 +23,7 @@ class OU(IntensityProcess):
@classmethod
def create(
cls, rate: float = 1, kappa: float = 1, a: float = 1, decay: float | None = None
) -> Self:
) -> OU:
return cls(rate=rate, kappa=kappa, a=a, decay=decay or a / rate)

@property
Expand Down
6 changes: 4 additions & 2 deletions quantflow/utils/paths.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import os
from typing import Any, Self
from typing import Any

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -51,7 +53,7 @@ def ys(self) -> list[list[float]]:
"""Paths as list of list (for visualization tools)"""
return self.data.transpose().tolist()

def integrate(self) -> Self:
def integrate(self) -> Paths:
"""Integrate paths"""
return self.__class__(
t=self.t, data=cumtrapz(self.data, dx=self.dt, axis=0, initial=0)
Expand Down

0 comments on commit 82a8dfc

Please sign in to comment.