Update: 代码格式修正

This commit is contained in:
binz 2024-06-04 22:29:56 +08:00
parent 4628cfc56c
commit 8336556860
3 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import pandas as pd import pandas as pd
import os, sys import os
import sys
sys.path.append("/home/lenovo/quant/tools/get_factor_tools/") sys.path.append("/home/lenovo/quant/tools/get_factor_tools/")
from db_tushare import get_factor_tools from db_tushare import get_factor_tools

View File

@ -1,5 +1,6 @@
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
import sys,os import sys
import os
import pandas as pd import pandas as pd
import numpy as np import numpy as np
import time import time

View File

@ -1,10 +1,8 @@
import pandas as pd import pandas as pd
import numpy as np import numpy as np
import sys, os import sys
import os
import copy import copy
sys.path.append("/home/lenovo/quant/tools/get_factor_tools/")
from db_tushare import get_factor_tools
gft = get_factor_tools()
from typing import Union, Iterable, Dict from typing import Union, Iterable, Dict
from ordered_set import OrderedSet from ordered_set import OrderedSet
@ -12,6 +10,10 @@ from ordered_set import OrderedSet
from account import Account from account import Account
from dataloader import DataLoader from dataloader import DataLoader
sys.path.append("/home/lenovo/quant/tools/get_factor_tools/")
from db_tushare import get_factor_tools
gft = get_factor_tools()
class Trader(Account): class Trader(Account):
""" """
@ -221,7 +223,7 @@ class Trader(Account):
weight_list = date_weight.loc[next_position['stock_code'].to_list()].values weight_list = date_weight.loc[next_position['stock_code'].to_list()].values
weight_list = total_weight * weight_list / sum(weight_list) weight_list = total_weight * weight_list / sum(weight_list)
return weight_list return weight_list
except: except Exception:
raise ValueError(f'not found stock weight in {date}') raise ValueError(f'not found stock weight in {date}')
def get_next_position(self, date, factor): def get_next_position(self, date, factor):