Пример #1
0
    def load_raw(
            self,
            augmento_topic="data/example_data/augmento_topics.msgpack.zlib",
            augmento_data="data/example_data/augmento_data.msgpack.zlib",
            bitmex_data="data/example_data/bitmex_data.msgpack.zlib"):

        # load all raw data
        self.aug_topics, self.aug_topics_inv, self.t_aug_data,\
                self.aug_data, self.t_price_data, self.price_data =\
                eh.load_example_data(augmento_topic, augmento_data, bitmex_data)
        print("loaded")
import msgpack
import zlib
import numpy as np
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as md

import helpers.example_helper as eh

# define the location of the input file
filename_augmento_topics = "data/example_data/augmento_topics.msgpack.zlib"
filename_augmento_data = "data/example_data/augmento_data.msgpack.zlib"
filename_bitmex_data = "data/example_data/bitmex_data.msgpack.zlib"

# load the example data
all_data = eh.load_example_data(filename_augmento_topics,
                                filename_augmento_data, filename_bitmex_data)
aug_topics, aug_topics_inv, t_aug_data, aug_data, t_price_data, price_data = all_data

# get the signals we're interested in
aug_signal_a = aug_data[:, aug_topics_inv["Bullish"]]
aug_signal_b = aug_data[:, aug_topics_inv["Bearish"]]

# set up the figure
fig, ax = plt.subplots(2, 1, sharex=True, sharey=False)

# initialise some labels for the plot
datenum_aug_data = [
    md.date2num(datetime.datetime.fromtimestamp(el)) for el in t_aug_data
]
datenum_price_data = [
    md.date2num(datetime.datetime.fromtimestamp(el)) for el in t_price_data