mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-17 01:14:35 +08:00
Use literal syntax to create data structure
Signed-off-by: shubhendra <withshubh@gmail.com>
This commit is contained in:
@@ -61,7 +61,7 @@ def get_position_value(evaluate_date, position):
|
|||||||
# load close price for position
|
# load close price for position
|
||||||
# position should also consider cash
|
# position should also consider cash
|
||||||
instruments = list(position.keys())
|
instruments = list(position.keys())
|
||||||
instruments = list(set(instruments) - set(["cash"])) # filter 'cash'
|
instruments = list(set(instruments) - {"cash"}) # filter 'cash'
|
||||||
fields = ["$close"]
|
fields = ["$close"]
|
||||||
close_data_df = D.features(
|
close_data_df = D.features(
|
||||||
instruments,
|
instruments,
|
||||||
@@ -80,7 +80,7 @@ def get_position_list_value(positions):
|
|||||||
instruments = set()
|
instruments = set()
|
||||||
for day, position in positions.items():
|
for day, position in positions.items():
|
||||||
instruments.update(position.keys())
|
instruments.update(position.keys())
|
||||||
instruments = list(set(instruments) - set(["cash"])) # filter 'cash'
|
instruments = list(set(instruments) - {"cash"}) # filter 'cash'
|
||||||
instruments.sort()
|
instruments.sort()
|
||||||
day_list = list(positions.keys())
|
day_list = list(positions.keys())
|
||||||
day_list.sort()
|
day_list.sort()
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ def get_cls_kwargs(config: Union[dict, str], module) -> (type, dict):
|
|||||||
|
|
||||||
|
|
||||||
def init_instance_by_config(
|
def init_instance_by_config(
|
||||||
config: Union[str, dict, object], module=None, accept_types: Union[type, Tuple[type]] = tuple([]), **kwargs
|
config: Union[str, dict, object], module=None, accept_types: Union[type, Tuple[type]] = (), **kwargs
|
||||||
) -> object:
|
) -> object:
|
||||||
"""
|
"""
|
||||||
get initialized instance with config
|
get initialized instance with config
|
||||||
|
|||||||
Reference in New Issue
Block a user