sosobtcのKラインデータ収集-Pythonバージョン



K Line Data Acquisition Sosobtc Python Version



#!/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 is the number of seconds, 600 is 10 minutes def __init__(self, step): self.__step = step self.__minute = int(step / 60) # minute period self.__hour = int(step / 3600) # hour period self.__day = int(step / 86400) # Daily period 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 period%s %s'% (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), self.__unit, self.__period )) # K line (K line) symble exchange currency