使用程序分析最近半年币种跌幅排名
一、程序
以OKX的SWAP做为分析对象,程序如下:
exchange = Exchange("okexv5") #
symbols = exchange.symbols(market='SWAP')
for symbol, item in symbols.items():
bulldays, beardays = 0, 0
currenttime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
if item['cttype'] != 'linear':
continue
if item["quote"] not in ["USDT"]: # 计价货币过滤
continue
# print(150 * "=")
kline = exchange.kline(symbol = symbol, interval = '1day', limit = 180)
stamp, open, high, low, close, volume = kline
# print(stamp[0])
if len(close) < 180: