def main(): url = "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=KZZ_LB2.0&token=70f12f2f4f091e459a279469fe49eca5" # 东方财富 print(url) json_data = get_data(url) subscribe_reminder(json_data) winning_reminder(json_data) print("*" * 40 + "\n\n\n")
def main(): # url = "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=KZZ_LB2.0&token=70f12f2f4f091e459a279469fe49eca5" # 东方财富 url = "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=KZZ_LB2.0&token=70f12f2f4f091e459a279469fe49eca5&p=1&st=STARTDATE&sr=-1&ps=50" print(url) json_data = get_data(url) icals = valid_bonds(json_data) # subscribe_reminder(json_data) # winning_reminder(json_data) print("*" * 40 + "\n\n\n")
''' import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from xgboost import XGBClassifier import xgboost as xgb from sklearn.model_selection import StratifiedKFold from sklearn import metrics from get_all_data import get_data from xgboost import plot_importance from matplotlib import pyplot as plt bst2 = xgb.Booster(model_file='./model/xgb.model') train_X, test_X, train_y, test_y = get_data(ues_smote=True) # print(test_X.shape) # random = np.random.random((1,135)) # print(random) dtest = xgb.DMatrix(test_X) #np.array([[0]*135]) y_pred = bst2.predict(dtest) # print('test_y', test_y,len(test_y)) # print('dtest', dtest.num_col()) # print('y_pred',y_pred) pred_list = [] for pred in y_pred: pred_list.append(pred[1])
from xgboost import XGBClassifier import xgboost as xgb import pandas as pd import numpy as np from pylab import mpl import matplotlib.mlab as mlab import matplotlib.pyplot as plt from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedKFold from sklearn import metrics from xgboost import plot_importance import matplotlib.pyplot as plt import uuid from get_all_data import get_data X_train, X_test, y_train, y_test = get_data(ues_smote=True) kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=3) useTrainCV = True cv_folds = None early_stopping_rounds = 50 xgb1 = XGBClassifier( alpha=1, # L1正则化系数,默认为1 seed=4, # 随机种子 复现 scale_pos_weight=1, # 正样本的权重,在二分类任务中,当正负样本比例失衡时,设置正样本的权重,模型效果更好。例如,当正负样本比例为1:10时scale_pos_weight=10。 num_class=2, nthread=-1, # nthread=-1时,使用全部CPU进行并行运算(默认)nthread=1时,使用1个CPU进行运算。 silent=1, # silent=0时,不输出中间过程(默认)silent=1时,输出中间过程 subsample=0.8, # 使用的数据占全部训练集的比例。防止overfitting。默认值为1,典型值为0.5-1。