コード例 #1
0
    def __init__(
        self,
        quotes: pd.DataFrame,
        frequency: FREQUENCY,
        # records: List[FuturesTransaction],
        book_title: str,
        agent: TradingAgent,
        flip_position: bool = False,
        font_color: str = "w",
        font_size: float = 10.0,
        font_src: Optional[str] = None,
        font_properties: Optional[fm.FontProperties] = None,
    ) -> None:
        assert quotes is not None

        super().__init__(
            font_color=font_color,
            font_size=font_size,
            font_src=font_src,
            font_properties=font_properties,
        )

        self._quotes = quotes
        self._frequency = frequency

        # self._records = records
        self._records = agent.read_records(title=book_title)

        self._flip_position = flip_position
コード例 #2
0
def read_records(title: str) -> Optional[List[FuturesTransaction]]:
    root = os.path.join(cast(str, os.getenv("HOME")), "Documents", "database",
                        "testing", "json")

    agent = TradingAgent(root=root, new_user=True)
    return agent.read_records(title)