Python要求每1分钟按ENTER键继续计划

2024-05-03 06:42:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我让这段代码正常运行了一天,但由于任何原因,程序需要按ENTER键才能在控制台输出中继续。我使用import schedule as sc。在tycoon函数中打印cryptodateprice

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键继续

如何知道程序是否正常工作


Tags: oftoinfothatplotmatplotlibastype
1条回答
网友
1楼 · 发布于 2024-05-03 06:42:01

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


相关问题 更多 >