Commit ce855a22 authored by 赵杰's avatar 赵杰

交易日历

parent c003112f
......@@ -16,6 +16,7 @@ from decimal import Decimal
from app.api.engine import tamp_user_engine, tamp_product_engine, TAMP_SQL
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from app.utils.fund_rank import get_trade_cal
class UserCustomerDataAdaptor:
......@@ -48,6 +49,16 @@ class UserCustomerDataAdaptor:
@staticmethod
def get_trade_cal(start_date, end_date):
try:
df = get_trade_cal()
df = df[df["cal_date"] >= start_date]
df.drop(['end_date'], axis=1, inplace=True)
df.rename(columns={'cal_date': 'end_date'}, inplace=True)
df["datetime"] = df["end_date"].apply(lambda x: datetime.datetime.strptime(x, "%Y%m%d"))
return df
except:
pass
ts.set_token('ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc')
pro = ts.pro_api()
if end_date is not None:
......
......@@ -18,7 +18,7 @@ from app.api.engine import tamp_user_engine, tamp_product_engine, TAMP_SQL, tamp
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from app.utils.fund_rank import get_frequency
from app.utils.fund_rank import get_frequency, get_trade_cal
class UserCustomerDataAdaptor:
......@@ -51,6 +51,16 @@ class UserCustomerDataAdaptor:
@staticmethod
def get_trade_cal(start_date, end_date):
try:
df = get_trade_cal()
df = df[df["cal_date"] >= start_date]
df.drop(['end_date'], axis=1, inplace=True)
df.rename(columns={'cal_date': 'end_date'}, inplace=True)
df["datetime"] = df["end_date"].apply(lambda x: datetime.datetime.strptime(x, "%Y%m%d"))
return df
except:
pass
ts.set_token('ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc')
pro = ts.pro_api()
if end_date is not None:
......
......@@ -18,7 +18,7 @@ from app.api.engine import tamp_user_engine, tamp_product_engine, TAMP_SQL, tamp
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from app.utils.fund_rank import get_frequency
from app.utils.fund_rank import get_frequency, get_trade_cal
class UserCustomerDataAdaptor:
......@@ -51,6 +51,16 @@ class UserCustomerDataAdaptor:
@staticmethod
def get_trade_cal(start_date, end_date):
try:
df = get_trade_cal()
df = df[df["cal_date"] >= start_date]
df.drop(['end_date'], axis=1, inplace=True)
df.rename(columns={'cal_date': 'end_date'}, inplace=True)
df["datetime"] = df["end_date"].apply(lambda x: datetime.datetime.strptime(x, "%Y%m%d"))
return df
except:
pass
ts.set_token('ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc')
pro = ts.pro_api()
if end_date is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment