Skip to content

Commit

Permalink
Start ReferenceMarket
Browse files Browse the repository at this point in the history
  • Loading branch information
chanhosuh authored and allt0ld committed Jul 6, 2024
1 parent bd156a4 commit 9c45f17
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions curvesim/templates/reference_market.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from abc import ABC, abstractmethod
from typing import List, NewType

from typing_extensions import Self

from curvesim.logging import get_logger

logger = get_logger(__name__)


TimeStep = NewType("TimeStep", int)


class SimAsset:
id: str

def __init__(self, _id: str) -> Self:
self.id = _id


class ReferenceMarket(ABC):
"""
Fictionalized external venue used as a reference for trading strategies.
"""

@abstractmethod
def prices(self, sim_assets: List[SimAsset], timestep: TimeStep) -> List[float]:
"""
This particular signature supposes:
- an infinite-depth external venue, i.e. we can trade at any size
at the given price without market impact.
- the "orderbook" is symmetric, i.e. trade direction doesn't matter.
"""
raise NotImplementedError

0 comments on commit 9c45f17

Please sign in to comment.