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