Beispiel #1
0
    def run(self, *args, **kwargs):
        while True:
            df = LoadNet().get_QVIX()
            self.update_qvix.emit(df)

            df_north = LoadNet().get_north()
            self.update_north.emit(df_north)

            df_vol, cha = Volume().update()
            data, last = LoadNet().get_50_163()
            ser = (data['current'] - last) / last
            self.update_vol.emit(df_vol, ser)

            if not self.data_model.df_op.empty:
                df_month = self.data_model.iv_month_50300()
                self.update_month.emit(df_month)

                df_iv50, df_iv300 = self.data_model.get_iv()
                self.update_iv.emit(df_iv50, df_iv300)

                hp = HoldPositions()
                greek = hp.update(self.data_model.df_op)
                self.update_greek.emit(greek)

            time.sleep(3)
Beispiel #2
0
    def update(self):
        #ax.cla()
        a = LoadNet().get_sz50_price()
        #a.cumsum(axis=0)
        str_time = a[31]
        str_time_end = "15:00:00"
        str_volume = a[9]
        tomorrow = float(a[2])
        current = float(a[3])
        #print(str_time,str_volume)
        time = pd.datetime.strptime(str_time, '%H:%M:%S')
        min_1 = pd.Timedelta(minutes=1)
        time_end = time + min_1

        #mean_data['current'][mean_data.index>time.time()] = int(str_volume)/10000
        self.mean_data.loc[self.mean_data.index > time.time(),
                           'current'] = int(str_volume) / 10000

        self.diff_data = self.mean_data.copy()
        self.diff_data['current'] = pd.to_numeric(self.diff_data['current'])
        self.diff_data['current'] = self.diff_data['current'].diff(1)
        self.diff_data.iloc[0, 1] = float(self.mean_data.iloc[0, 1])
        self.mean_data['mean'] = self.mean_data['current'] / self.mean_data[
            'VOL-TDX.VOLUME']
        self.cha = (current - tomorrow) / tomorrow * 100
        self.res = self.mean_data['mean'][
            self.mean_data.index <= time_end.time()]
        return self.mean_data['mean'][
            self.mean_data.index <= time_end.time()], self.cha
Beispiel #3
0
 def __init__(self):
     self.load = LoadNet()
     self.months = self.load.check_month()
     self.day_later = self.load.get_op_expire_day('2019')
     #print(self.day_later)
     self.etf_price = 2.95
     self.data_price = pd.DataFrame()
     self.data_iv = pd.DataFrame()
     self.histroy_high = 300
Beispiel #4
0
 def draw_qvix(self):
     self.ax_QVIX.cla()
     #print (LoadNet().get_QVIX())
     df =LoadNet().get_QVIX()
     # iv = df['QVIX'].astype(float)
     # time =df.index.values
     # print(iv,time)
     # self.ax_QVIX.plot(time,iv)
     pd.to_datetime(df['Time'])
     df.index = df['Time']
     #print(df.columns)
     df = df.drop(['Time','Pre','max','min'],axis=1)
     df.plot(ax=self.ax_QVIX)
Beispiel #5
0
    def __init__(self):
        self.ln = LoadNet()

        self.stock_info_50 = self.ln.get_sz50_price()
        self.stock_info_300 = self.ln.get_sz300_price()
        self.stock_price_50etf = 0.0
        self.stock_price_300etf = 0.0
        self.df_op = pd.DataFrame()

        self.df_codes = self.init_allcodes()

        t = threading.Thread(target=self.loop)
        t.start()
Beispiel #6
0
    def __init__(self):
        self.loadsina = LoadNet()
        self.month = self.loadsina.check_month()

        self.interestRate = 3.00
        self.stockPrice = float(self.loadsina.get_50etf_price()[3])
        self.stockPrice_future = self.stockPrice
        self.iv_future = 0
        self.dayLater = 0

        super(Windows, self).__init__()
        self.setGeometry(20, 50, 1800, 1200)
        self.currentItem = None
        self.create_ui()

        self.fill_dayWidget()
Beispiel #7
0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from get_day_histroy import history
import matplotlib.font_manager as font_manager
from load_sina import LoadNet

his = history()
mean_data = his.get_dayMean()
ln = LoadNet()

mean_data['current'] = 0
mean_data['mean'] = 0
POINTS = 100
sin_list = [0] * POINTS
indx = 0
zx_index = []

fig, ax = plt.subplots()
# ax.set_ylim([-2, 2])
# ax.set_xlim([0, POINTS])
# ax.set_autoscale_on(False)
#ax.set_xticks(range(0, 100, 10))
# ax.set_yticks(range(-2, 3, 1))
#ax.grid(True)

#line_sin, = ax.plot(mean_data, label='volume', color='cornflowerblue')
ax.legend(loc='upper center', ncol=4, prop=font_manager.FontProperties(size=8))

print(mean_data)
diff_data = pd.DataFrame()