Пример #1
0
def GetTop10Holder(mFilename, startDate, endDate):
    engine = create_engine(
        'mysql://root:@localhost/Financedata?charset=utf8')  # 连接数据库
    codes = pd.read_csv(mFilename)
    pro = ts.pro_api()
    for codename in codes['ts_code']:
        df = pro.top10_floatholders(ts_code=codename,
                                    start_date=startDate,
                                    end_date=endDate)
        df.to_csv('D:\\StockFile\\HolderData\\' + codename + '.csv',
                  encoding='utf_8_sig')
        #df.to_sql(codename, engine, if_exists='append')
        datetime.sleep(1)
Пример #2
0
def updateAuto():
    current = datetime.datetime.now().minute
    con = fxcmpy.fxcmpy(config_file='fxcm.cfg', server='demo')
    while True:
        time.sleep(5)
        if datetime.datetime.now().minute != current:
            current = datetime.datetime.now().minute
            data2 = con.get_candles('BTC/USD', period='m1', number=1)
            data2 = preprocess(data2)
            print(current)
            with open('data/BTC.csv', 'a', newline='') as f:
                data2.to_csv(f, mode='a', index=False, header=f.tell() == 0)
        else:
            continue
Пример #3
0
def Timer():
    while flag == True:
        print Time
        datetime.sleep(20)
Пример #4
0
def sleep_till_end(trader):
    while True:
        t = trader.get_last_trade_time()
        t = t.time()
        if t < dt.time(14, 0, 0):
            dt.sleep(60 * 61)
        elif t < dt.time(15, 00, 0):
            dt.sleep(60 * 31)
        elif t < dt.time(15, 30, 0):
            dt.sleep(60 * 16)
        elif t < dt.time(15, 45, 0):
            dt.sleep(60 * 3)
        elif t < dt.time(15, 55, 0):
            dt.sleep(60 * 2)
        elif t < dt.time(15, 58, 30):
            dt.sleep(60 * 1)
        elif t < dt.time(15, 59, 0):
            dt.sleep(10)
        else:
            break
    return True
Пример #5
0
                    def d_input():
                        d = input("Press e/E to go back to what to do:  ")
                        if d == "e" or d == "E  ":
                            what_to_do_logic()
                        else:
                            print("You have inputed the wrong input")
                            d_input()

                    d_input()

                elif asking == "C." or asking == "c." or asking == "c" or asking == "C":
                    print("Good Bye. Thankyou " + username)
                else:
                    print(
                        "You did not put the write input above. Please try again."
                    )
                    what_to_do_logic()

            what_to_do_logic()
#            return('exist')
        break
    else:
        print("Username and password are not recognised")
        again = input("Do u want to try again?(y/n): ")
        if again.lower() == "n":
            print("Good Bye")
            time.sleep(1)
            #                return('exit')
            break
Пример #6
0
    elif cmd == 'stupid1':
        # рассказать анекдот
        speak("Look at your self, my boy")

    else:
        print('Please repeat!')


# запуск
r = sr.Recognizer()
m = sr.Microphone(device_index=1)

with m as source:
    r.adjust_for_ambient_noise(source)

speak_engine = pyttsx3.init()

# Только если у вас установлены голоса для синтеза речи!
voices = speak_engine.getProperty('voices')
speak_engine.setProperty('voice', voices[0].id)

# forced cmd test
speak("My boy did't teach to tell funny story, but is his job")

speak("Golos is HERE my boy")
speak("Golos is listening")

stop_listening = r.listen_in_background(m, callback)
while True:
    datetime.sleep(0.1)  # infinity loop
Пример #7
0
def listen():
    with m as source:
        r.adjust_for_ambient_noise(source)
    stop_listening = r.listen_in_background(m, callback)
    while True:
        datetime.sleep(0.1)