Skip to content

Commit

Permalink
Add method parameter for volume (microsoft#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
you-n-g authored Dec 9, 2021
1 parent 5d30c4e commit e6a7ef1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qlib/backtest/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ def get_quote_info(self, stock_id, start_time, end_time, method="ts_data_last"):
def get_close(self, stock_id, start_time, end_time, method="ts_data_last"):
return self.quote.get_data(stock_id, start_time, end_time, field="$close", method=method)

def get_volume(self, stock_id, start_time, end_time):
def get_volume(self, stock_id, start_time, end_time, method="sum"):
"""get the total deal volume of stock with `stock_id` between the time interval [start_time, end_time)"""
return self.quote.get_data(stock_id, start_time, end_time, field="$volume", method="sum")
return self.quote.get_data(stock_id, start_time, end_time, field="$volume", method=method)

def get_deal_price(self, stock_id, start_time, end_time, direction: OrderDir, method="ts_data_last"):
if direction == OrderDir.SELL:
Expand Down

0 comments on commit e6a7ef1

Please sign in to comment.