Exemple #1
0
 def __init__(self):
     # print("Setting configurations")
     config = GlobalConfig()
     self.host = config.getConfig('Oracle', 'host')
     self.user = config.getConfig('Oracle', 'user')
     self.passwd = config.getConfig('Oracle', 'passwd')
     self.db = config.getConfig('Oracle', 'db')
Exemple #2
0
 def __init__(self):
     gc = GlobalConfig()
     path = gc.getConfig('SubConfigPath', 'BPI_conf_win')
     # path = gc.getConfig('SubConfigPath', 'BPI_conf_linux')
     # print(path)
     self.cp = configparser.ConfigParser()
     self.cp.read(path, encoding='utf-8-sig')
Exemple #3
0
 def __init__(self):
     config = GlobalConfig()
     path = config.getConfig('SubConfigPath', 'StressTesting_win')
     self.cp = configparser.ConfigParser()
     self.cp.read(path, encoding='utf-8-sig')
     td = TradingDay()
     self.ltd = td.getLastTradingDay()
Exemple #4
0
 def __init__(self):
     # get threshold
     config = GlobalConfig()
     path = config.getConfig('SubConfigPath', 'monitor_win')
     # path = config.getConfig('SubConfigPath', 'monitor_linux')
     # print(path)
     self.cp = configparser.ConfigParser()
     self.cp.read(path, encoding='utf-8-sig')
 def __init__(self):
     config = GlobalConfig()
     path = config.getConfig('SubConfigPath', 'StressTesting_win')
     self.cp = configparser.ConfigParser()
     self.cp.read(path, encoding='utf-8-sig')
     td = TradingDay()
     self.ltd = td.getLastTradingDay()
     print("---- %s has been initialized! ----" % self.__class__.__name__)
Exemple #6
0
 def __init__(self):
     config = GlobalConfig()
     self.table = config.getConfig('mysql_tables', 'product')
     self.sqlStatement = "select * from %s" % self.table
     # print(self.sqlStatement)
     self.df = pd.DataFrame()
     self.mysql = MySQLConnector()
     self.conn = self.mysql.getConn()
Exemple #7
0
 def __init__(self):
     config = GlobalConfig()
     path = config.getConfig('SubConfigPath', 'API_conf_win')
     # path = config.getConfig('SubConfigPath', 'API_conf_linux')
     # print(path)
     self.cp = configparser.ConfigParser()
     self.cp.read(path, encoding='utf-8-sig')
     td = TradingDay()
     self.ltd = td.getLastTradingDay()
Exemple #8
0
    def __init__(self, productID, EndDate=None):
        config = GlobalConfig()
        path = config.getConfig('SubConfigPath', 'StressTesting_win')
        self.cp = configparser.ConfigParser()
        self.cp.read(path, encoding='utf-8-sig')
        td = TradingDay()
        self.ltd = td.getLastTradingDay()

        self.productID = productID
        self.EndDate = EndDate
Exemple #9
0
    def __init__(self):
        config = GlobalConfig()
        path = config.getConfig('SubConfigPath', 'StressTesting_win')
        self.cp = configparser.ConfigParser()
        self.cp.read(path, encoding='utf-8-sig')

        # database init
        self.oc = OracleConnector()
        self.oracle_connection = self.oc.getConn()
        self.ms = MySQLConnector()
        self.mysql_connection = self.ms.getConn()
Exemple #10
0
 def __init__(self):
     # print("Setting configurations")
     config = GlobalConfig()
     self.host = config.getConfig('mysql', 'host')
     self.port = config.getIntConfig('mysql', 'port')
     self.user = config.getConfig('mysql', 'user')
     self.passwd = config.getConfig('mysql', 'passwd')
     self.db = config.getConfig('mysql', 'db')
     self.use_unicode = config.getBooleanConfig('mysql', 'use_unicode')
     self.charset = config.getConfig('mysql', 'charset')
Exemple #11
0
 def getProductDurationSinceFounded(self, productid, enddate=None):
     gc = GlobalConfig()
     start_temp = gc.getConfig(productid, 'Start_date')
     start = start_temp.replace("-", "")
     end_temp = gc.getConfig(productid, 'End_date')
     end_temp2 = end_temp.replace("-", "")
     lasttradeday = self.getLastTradingDay()
     if enddate is None:
         if end_temp2 == "notyet":
             end = lasttradeday
         elif lasttradeday > end_temp2:
             end = end_temp2
     else:
         end = enddate
     tradedays = self.getDuration(start, end)
     return tradedays
Exemple #12
0
def singleImport(pid):
    m = GlobalConfig()
    start_temp = m.getConfig(pid, 'Start_date')
    start = start_temp.replace("-", "")
    end_temp = m.getConfig(pid, 'End_date')
    end_temp2 = end_temp.replace("-", "")
    today = time.strftime("%Y%m%d")  #TODO use yeaterday tmp = (datetime.date.today() - datetime.timedelta(days = 1)).strftime("%Y%m%d")
    if end_temp2 is "notyet":
        end = today
    elif today > end_temp2:
        end = end_temp2
    tradedays = tradeDayCollect(start, end)
    print(tradedays)
    for td in tradedays:
        array = DGBPI.composeArray(pid, td)
        print(array)
        DGBPI.insertArray(array)
Exemple #13
0
 def __init__(self):
     config = GlobalConfig()
     self.mailserver = config.getConfig('email', 'mailserver')
     self.from_addr = config.getConfig('email', 'from_addr')
     self.sender_password = config.getConfig('email', 'sender_password')
     self.recipient = config.getConfig('email', 'recipient')
     td = TradingDay()
     self.date_of_subject = td.getLastTradingDay()
     self.subject = config.getConfig('email', 'subject') + self.date_of_subject
     self.attachmentFilePath = config.getConfig('email', 'attachmentFilePath')
Exemple #14
0
 def getProductNaturalDurationSinceFounded(self, productid, enddate=None):
     gc = GlobalConfig()
     start_temp = gc.getConfig(productid, 'Start_date')
     start = start_temp.replace("-", "")
     end_temp = gc.getConfig(productid, 'End_date')
     end_temp2 = end_temp.replace("-", "")
     lasttradeday = self.getLastTradingDay()
     if enddate is None:
         if end_temp2 == "notyet":
             end = lasttradeday
         elif lasttradeday > end_temp2:
             end = end_temp2
     else:
         end = enddate
     date1 = datetime.datetime.strptime(start, "%Y%m%d")
     date2 = datetime.datetime.strptime(end, "%Y%m%d")
     num = (date2 - date1).days
     return num + 1
Exemple #15
0
from StressTesting.StockFilter import StockFilter
import pandas as pd
import numpy as np
from Common.GlobalConfig import GlobalConfig
from Common.MySQLConnector import MySQLConnector
from Common.OracleConnector import OracleConnector
from StressTesting.BondFilter import BondFilter
from StressTesting.Bond_CategorySum import Bond_CategorySum

pd.set_option('display.max_columns', 10000, 'display.max_rows', 10000)
np.set_printoptions(suppress=True)
from StressTesting.FutureFilter import FutureFilter

gc = GlobalConfig()
product_list_tmp = gc.getConfig('product', 'list')
product_list = product_list_tmp.split(", ")
# product_list.append('700001')
# print(product_list)
# product = "FB0003"
date = "20190228"

# print(index_list)
# print(stock_df_list)

df_beta = pd.read_excel(
    "E:\\风控合规\\20190319_2019上半年压力测试\\压力测试-2019年上半年(已填写基础数据)\\beta.xlsx",
    sheetname="Sheet1")


# print(df_beta)
def stockbeta(product, date):
Exemple #16
0
def singleImport(pid):
    m = GlobalConfig()
    start_temp = m.getConfig(pid, 'Start_date')
    start = start_temp.replace("-", "")
    end_temp = m.getConfig(pid, 'End_date')
    end_temp2 = end_temp.replace("-", "")
    today = time.strftime("%Y%m%d")  #TODO use yeaterday tmp = (datetime.date.today() - datetime.timedelta(days = 1)).strftime("%Y%m%d")
    if end_temp2 is "notyet":
        end = today
    elif today > end_temp2:
        end = end_temp2
    tradedays = tradeDayCollect(start, end)
    print(tradedays)
    for td in tradedays:
        array = DGBPI.composeArray(pid, td)
        print(array)
        DGBPI.insertArray(array)





pid = 'FB0004'
singleImport(pid)

m = GlobalConfig()
product_list = m.getConfig('product', 'list')
for p in product_list:
    singleImport(p)

Exemple #17
0
 def getProduct(self, product_number):
     config = GlobalConfig()
     self.ProductID = config.getConfig(product_number, 'ID')
     self.StartDate = config.getConfig(product_number, 'Start_date')
     self.EndDate = config.getConfig(product_number, 'End_date')
     return self.ProductID, self.StartDate, self.EndDate