[Add] get_newest_bar_data in database.py

[Add] get_newest_tick_data in database.py
This commit is contained in:
nanoric 2019-04-17 23:16:33 -04:00
parent 71995aeb13
commit 49d863a286

View File

@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from datetime import datetime
from enum import Enum
from typing import Sequence, TYPE_CHECKING
from typing import Sequence, TYPE_CHECKING, Optional
if TYPE_CHECKING:
from vnpy.trader.constant import Interval, Exchange # noqa
@ -51,3 +51,28 @@ class BaseDatabaseManager(ABC):
datas: Sequence["TickData"],
):
pass
@abstractmethod
def get_newest_bar_data(
self,
symbol: str,
exchange: "Exchange",
interval: "Interval"
) -> Optional["BarData"]:
"""
If there is data in database, return the one with greatest datetime(newest one)
otherwise, return None
"""
pass
@abstractmethod
def get_newest_tick_data(
self,
symbol: str,
exchange: "Exchange",
) -> Optional["TickData"]:
"""
If there is data in database, return the one with greatest datetime(newest one)
otherwise, return None
"""
pass