38 lines
828 B
Python
38 lines
828 B
Python
|
|
"""Venue adapter contracts for DITAv2."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from dataclasses import dataclass, field
|
||
|
|
from datetime import datetime
|
||
|
|
from typing import Any, Dict, List, Optional, Protocol
|
||
|
|
|
||
|
|
from .contracts import (
|
||
|
|
KernelCommandType,
|
||
|
|
KernelIntent,
|
||
|
|
KernelEventKind,
|
||
|
|
TradeSide,
|
||
|
|
VenueEvent,
|
||
|
|
VenueEventStatus,
|
||
|
|
VenueOrder,
|
||
|
|
VenueOrderStatus,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
class VenueAdapter(Protocol):
|
||
|
|
"""Abstract venue adapter used by the kernel."""
|
||
|
|
|
||
|
|
def submit(self, intent: KernelIntent) -> List[VenueEvent]:
|
||
|
|
...
|
||
|
|
|
||
|
|
def cancel(self, order: VenueOrder, *, reason: str = "") -> List[VenueEvent]:
|
||
|
|
...
|
||
|
|
|
||
|
|
def open_orders(self) -> List[VenueOrder]:
|
||
|
|
...
|
||
|
|
|
||
|
|
def open_positions(self) -> List[Dict[str, Any]]:
|
||
|
|
...
|
||
|
|
|
||
|
|
def reconcile(self) -> List[VenueEvent]:
|
||
|
|
...
|