Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qianyun210603 committed Dec 12, 2023
1 parent 9879fff commit 0c7e2e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qlib/backtest/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_quote_from_qlib(self, subscribe_fields_alias: Dict[str, str] = None) ->
LT_FLT = "float" # float: the trading limitation is based on `abs($change) < limit_threshold`
LT_NONE = "none" # none: there is no trading limitation

def get_instrument_info(self, symbol: str) -> Optional[Dict]:
def get_instrument_info(self, symbol: str) -> Any:
return self.instrument_info.get(symbol, None)

def _get_limit_type(self) -> str:
Expand Down
1 change: 1 addition & 0 deletions qlib/backtest/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ def _buy_stock(self, stock_id: str, trade_val: float, cost: float, trade_price:
else:
# exist, add amount
self.position[stock_id]["amount"] += trade_amount
self.position[stock_id]["cost_basis"] += trade_val + cost

self.position["cash"] -= trade_val + cost

Expand Down

0 comments on commit 0c7e2e7

Please sign in to comment.