1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-03 19:10:58 +08:00

Add method parameter for volume (#734)

This commit is contained in:
you-n-g
2021-12-09 10:45:25 +08:00
committed by GitHub
parent e50ad4309e
commit e99f00b445

View File

@@ -401,9 +401,9 @@ class Exchange:
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: