Python требуется нажатие ENTER для продолжения расписания каждую 1 минуту - PullRequest
0 голосов
/ 16 марта 2020

У меня этот код работает правильно в течение дня, но по любой причине программа должна нажать ENTER для продолжения вывода на консоль. Я использую import schedule as sc. В tycoon функция печати crypto, date и price.

cryptos = ['BTC-USDT','ETH-USDT']
logoutput.set_log()
for crypto in cryptos:
    sc.every(1).minutes.do(tycoon, crypto)

while True:
    try:
        sc.run_pending()
    except requests.RequestException as err:
        print ("OOps: Something Else",err)
    except requests.HTTPError as errh:
        print ("Http Error:",errh)
    except requests.ConnectionError as errc:
        print ("Error Connecting:",errc)
    except requests.Timeout as errt:
        print ("Timeout Error:",errt)


LOGGING FILE

...
INFO:schedule:Running job Every 1 minute do tycoon('BTC-USDT') (last run: 2020-03-16 13:27:08, next run: 2020-03-16 13:28:08)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=15min&symbol=BTC-USDT&startAt=1584350888&endAt=1584376088 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=5min&symbol=BTC-USDT&startAt=1584375788&endAt=1584376088 HTTP/1.1" 200 None
INFO:schedule:Running job Every 1 minute do tycoon('ETH-USDT') (last run: 2020-03-16 13:27:55, next run: 2020-03-16 13:28:55)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=15min&symbol=ETH-USDT&startAt=1584350935&endAt=1584376135 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=5min&symbol=ETH-USDT&startAt=1584375835&endAt=1584376135 HTTP/1.1" 200 None
INFO:schedule:Running job Every 1 minute do tycoon('BTC-USDT') (last run: 2020-03-16 13:28:08, next run: 2020-03-16 13:29:08)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=15min&symbol=BTC-USDT&startAt=1584356588&endAt=1584381788 HTTP/1.1" 200 None
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:schedule:Running job Every 1 minute do tycoon('ETH-USDT') (last run: 2020-03-16 15:03:08, next run: 2020-03-16 15:04:08)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=15min&symbol=ETH-USDT&startAt=1584356648&endAt=1584381848 HTTP/1.1" 200 None
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:matplotlib.category:Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
INFO:schedule:Running job Every 1 minute do tycoon('BTC-USDT') (last run: 2020-03-16 15:03:20, next run: 2020-03-16 15:04:20)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443
DEBUG:urllib3.connectionpool:https://openapi-v2.kucoin.com:443 "GET /api/v1/market/candles?type=15min&symbol=BTC-USDT&startAt=1584356660&endAt=1584381860 HTTP/1.1" 200 None
INFO:schedule:Running job Every 1 minute do tycoon('ETH-USDT') (last run: 2020-03-16 15:04:19, next run: 2020-03-16 15:05:19)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): openapi-v2.kucoin.com:443

CONSOLE OUTPUT

...
VENDER BTC-USDT
2020-03-16 13:25:04
Precio:4987.3
VENDER ETH-USDT
2020-03-16 13:25:52
Precio:111.36
VENDER BTC-USDT
2020-03-16 13:26:06
Precio:5006.0
VENDER ETH-USDT
2020-03-16 13:26:53
Precio:112.35
VENDER BTC-USDT
2020-03-16 13:27:07
Precio:5041.5
VENDER ETH-USDT
2020-03-16 13:27:54
Precio:112.62
VENDER BTC-USDT
2020-03-16 13:28:08
Precio:5035.9
VENDER ETH-USDT
**2020-03-16 13:28:55** Here pressed ENTER for continue
Precio:112.34
MANTENER BTC-USDT
2020-03-16 15:03:08
Precio:5044.7
MANTENER ETH-USDT
2020-03-16 15:04:08
Precio:112.31

Можно ли как-нибудь помешать мне нажать ENTER для продолжения?

Как узнать, что программа работает правильно?

1 Ответ

0 голосов
/ 16 марта 2020

import requests, time, json, library as lib, matplotlib.pyplot as plt, talib as tl, numpy, datetime, correo as cor, datasignals as ds, schedule as sc
import candle_chart as cc, sys, gc
import logoutput


def tycoon(crypto):
    now = lib.mynow()
    fechaOK = datetime.datetime.fromtimestamp(int(now)/1000).strftime('%Y-%m-%d %H:%M:%S') 
    buy = lib.buyok()
    sell = lib.sellok() 
    price = lib.price()
    caso = "MANTENER"
    if (buy == 1):
        caso = "COMPRAR"
    if (sell == 1):
        caso = "VENDER"
    existe = ds.read_data_csv(caso, crypto)
    print(caso, crypto)
    print(fechaOK)
    print('Precio:' + price)
     if (existe == 0):
        cc.set_chart_candle(crypto, fechaOK, caso)
    return


Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...