Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
51bitquant committed Jun 9, 2023
1 parent f172b26 commit 828ed42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions howtrader/trader/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_default_setting(self, gateway_name: str) -> Optional[Dict[str, Any]]:

def get_all_gateway_names(self) -> List[str]:
"""
Get all names of gatewasy added in main engine.
Get all names of gateways added in main engine.
"""
return list(self.gateways.keys())

Expand Down Expand Up @@ -585,7 +585,7 @@ def get_all_active_orders(self, vt_symbol: str = "") -> List[OrderData]:
def get_all_active_quotes(self, vt_symbol: str = "") -> List[QuoteData]:
"""
Get all active quotes by vt_symbol.
If vt_symbol is empty, return all active qutoes.
If vt_symbol is empty, return all active quotes.
"""
if not vt_symbol:
return list(self.active_quotes.values())
Expand Down
14 changes: 10 additions & 4 deletions howtrader/trader/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from datetime import datetime
from logging import INFO
from decimal import Decimal

import pandas as pd
from .constant import Direction, Exchange, Interval, Offset, Status, Product, OptionType, OrderType

ACTIVE_STATUSES = set([Status.SUBMITTING, Status.NOTTRADED, Status.PARTTRADED])
import pandas as pd
ACTIVE_STATUSES = {Status.SUBMITTING, Status.NOTTRADED, Status.PARTTRADED} # define the active status set.


@dataclass
class BaseData:
Expand Down Expand Up @@ -266,6 +266,7 @@ def __post_init__(self) -> None:
""""""
self.vt_symbol: str = f"{self.symbol}.{self.exchange.value}"


@dataclass
class PremiumRateData(BaseData):
"""
Expand Down Expand Up @@ -297,6 +298,7 @@ def __post_init__(self) -> None:
""""""
self.vt_symbol: str = f"{self.symbol}.{self.exchange.value}"


@dataclass
class QuoteData(BaseData):
"""
Expand Down Expand Up @@ -405,6 +407,7 @@ def __post_init__(self) -> None:
""""""
self.vt_symbol: str = f"{self.symbol}.{self.exchange.value}"


@dataclass
class OrderQueryRequest:
"""
Expand All @@ -418,6 +421,7 @@ def __post_init__(self):
""""""
self.vt_symbol = f"{self.symbol}.{self.exchange.value}"


@dataclass
class HistoryRequest:
"""
Expand All @@ -435,6 +439,7 @@ def __post_init__(self) -> None:
""""""
self.vt_symbol: str = f"{self.symbol}.{self.exchange.value}"


@dataclass
class QuoteRequest:
"""
Expand Down Expand Up @@ -474,6 +479,7 @@ def create_quote_data(self, quoteid: str, gateway_name: str) -> QuoteData:
)
return quote


class GridPositionCalculator(object):
"""
用来计算网格头寸的平均价格
Expand Down Expand Up @@ -531,4 +537,4 @@ def update_position(self, trade: TradeData):
self.pos)

elif previous_pos > 0 > self.pos:
self.avg_price = trade.price
self.avg_price = trade.price
2 changes: 2 additions & 0 deletions howtrader/trader/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _get_trader_dir(temp_name: str) -> Tuple[Path, Path]:

return cwd, temp_path


TRADER_DIR, TEMP_DIR = _get_trader_dir("howtrader")
sys.path.append(str(TRADER_DIR))

Expand Down Expand Up @@ -123,6 +124,7 @@ def round_to(value: Union[Decimal, float, int], target: Union[Decimal, float, in
rounded = value.quantize(target)
return rounded


def floor_to(value: Union[Decimal, float, int], target: Union[Decimal, float, int]) -> Decimal:
"""
Similar to math.floor function, but to target float number.
Expand Down

0 comments on commit 828ed42

Please sign in to comment.