mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-01 10:01:19 +08:00
black format
This commit is contained in:
@@ -4,6 +4,7 @@ import pandas as pd
|
||||
from dataclasses import dataclass, field
|
||||
from typing import ClassVar
|
||||
|
||||
|
||||
@dataclass
|
||||
class Order:
|
||||
"""
|
||||
@@ -17,19 +18,18 @@ class Order:
|
||||
factor : float
|
||||
presents the weight factor assigned in Exchange()
|
||||
"""
|
||||
stock_id : str
|
||||
amount : float
|
||||
start_time : pd.Timestamp
|
||||
end_time : pd.Timestamp
|
||||
direction : int
|
||||
factor : float
|
||||
deal_amount : float = field(init=False)
|
||||
SELL : ClassVar[int] = 0
|
||||
BUY : ClassVar[int] = 1
|
||||
|
||||
|
||||
stock_id: str
|
||||
amount: float
|
||||
start_time: pd.Timestamp
|
||||
end_time: pd.Timestamp
|
||||
direction: int
|
||||
factor: float
|
||||
deal_amount: float = field(init=False)
|
||||
SELL: ClassVar[int] = 0
|
||||
BUY: ClassVar[int] = 1
|
||||
|
||||
def __post_init__(self):
|
||||
if self.direction not in {Order.SELL, Order.BUY}:
|
||||
raise NotImplementedError("direction not supported, `Order.SELL` for sell, `Order.BUY` for buy")
|
||||
self.deal_amount = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user