Example #1
0
                                                      date)
                    download_file(path, file_name, date_range, folder)

                    if checksum == 1:
                        checksum_path = "data/spot/daily/klines/{}/{}/".format(
                            symbol.upper(), interval)
                        checksum_file_name = "{}-{}-{}.zip.CHECKSUM".format(
                            symbol.upper(), interval, date)
                        download_file(checksum_path, checksum_file_name,
                                      date_range, folder)

        current += 1


if __name__ == "__main__":
    parser = get_parser('klines')
    args = parser.parse_args(sys.argv[1:])

    if not args.symbols:
        print("fetching all symbols from exchange")
        symbols = get_all_symbols()
        num_symbols = len(symbols)
    else:
        symbols = args.symbols
        num_symbols = len(symbols)

    if args.dates:
        dates = args.dates
    else:
        dates = pd.date_range(end=datetime.today(),
                              periods=MAX_DAYS).to_pydatetime().tolist()
Example #2
0
                file_name = "{}-trades-{}.zip".format(symbol.upper(), date)
                download_file(path, file_name, date_range, folder)

                if checksum == 1:
                    checksum_path = "data/spot/daily/trades/{}/".format(
                        symbol.upper())
                    checksum_file_name = "{}-trades-{}.zip.CHECKSUM".format(
                        symbol.upper(), date)
                    download_file(checksum_path, checksum_file_name,
                                  date_range, folder)

        current += 1


if __name__ == "__main__":
    parser = get_parser('trades')
    args = parser.parse_args(sys.argv[1:])

    if not args.symbols:
        print("fetching all symbols from exchange")
        symbols = get_all_symbols()
        num_symbols = len(symbols)
    else:
        symbols = args.symbols
        num_symbols = len(symbols)
        print("fetching {} symbols from exchange".format(num_symbols))

    if args.dates:
        dates = args.dates
    else:
        dates = pd.date_range(end=datetime.today(),
from sklearn.cluster import MiniBatchKMeans
from skimage.io import imread
from sklearn.externals import joblib
import pickle
import utility
import numpy as np
from sklearn.utils.random import sample_without_replacement
from sklearn.model_selection import train_test_split

args = utility.get_parser().parse_args()

DATASET = args.data
NUM_PIXELS = args.num_pixels
SINGLE_CLUSTERS = args.single_clusters
DOUBLE_CLUSTERS = args.double_clusters

image_paths, _ = utility.read_data(DATASET)
image_paths, _ = train_test_split(image_paths, test_size = 1500, random_state = 42)

kmeans_single = MiniBatchKMeans(n_clusters = SINGLE_CLUSTERS)
kmeans_double = MiniBatchKMeans(n_clusters = DOUBLE_CLUSTERS)

pca = joblib.load('resources/pca.pkl')
with open('resources/bounds.pkl', 'rb') as f:
    bounds = pickle.load(f)

batch = np.zeros((NUM_PIXELS, 3))

for i, img in enumerate(image_paths):
    image = imread(img)
    dx, dy, dz = image.shape
Example #4
0
            path = "data/spot/daily/aggTrades/{}/".format(symbol.upper())
            file_name = "{}-aggTrades-{}.zip".format(symbol.upper(), date)
            download_file(path, file_name)

            if checksum == 1:
                checksum_path = "data/spot/daily/aggTrades/{}/".format(
                    symbol.upper())
                checksum_file_name = "{}-aggTrades-{}.zip.CHECKSUM".format(
                    symbol.upper(), date)
                download_file(checksum_path, checksum_file_name)

        current += 1


if __name__ == "__main__":
    parser = get_parser('aggTrades')
    args = parser.parse_args(sys.argv[1:])

    if not args.symbols:
        print("fetching all symbols from exchange")
        symbols = get_all_symbols()
        num_symbols = len(symbols)
    else:
        symbols = args.symbols
        num_symbols = len(symbols)
        print("fetching {} symbols from exchange".format(num_symbols))

    if args.dates:
        dates = args.dates
    else:
        dates = pd.date_range(end=datetime.today(),