sosobtc的K线数据获取-Python版

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import hashlib, hmac
import urllib.request, urllib.parse
import time, datetime
import json
import random
import re
import numpy as np

class SoSoBTC:

    # step 为秒数,600为10分钟
    def __init__(self, step):
        self.__step   = step
        self.__minute = int(step / 60)     # 分钟周期
        self.__hour   = int(step / 3600)   # 小时周期
        self.__day    = int(step / 86400)  # 日周期
        if (self.__day >= 1):
            self.__period = "d"
            self.__unit   = self.__day
        elif (self.__hour >= 1):
            self.__period = "H"
            self.__unit   = self.__hour
        elif (self.__minute >= 1):
            self.__period = "M"
            self.__unit   = self.__minute
            
        self.__url    = 'https://k.sosobtc.com/data/'
        print("%s 周期 %s %s" % (datetime.dat

猜你喜欢

转载自blog.csdn.net/bitquant/article/details/105647583