Exemplo n.º 1
0
def main():
    logger.enable(__name__)
    processor = Jamboree()
    example_handler = ExampleSearchHandler()
    example_handler.processor = processor
    example_handler["name"] = "Boi Gurl"
    example_handler["category"] = "marketsx"
    example_handler["sample_tags"] = ["four", "five", "six"]
    # TODO: Figure out subcategory update
    example_handler["subcategories"] = {
        "hello": "world",
        "country": "US",
    }
    example_handler["secondsub"] = {"my": "jac"}
    example_handler.replacement["secondsub"] = {"my": "jack"}
    example_handler["live"] = False

    # example_handler.remove()
    example_handler.insert(allow_duplicates=True)
    records1 = example_handler.find()

    records2 = example_handler.find()

    records3 = example_handler.find()

    logger.warning((records1, len(records1)))
    logger.success((records2, len(records2)))
    logger.error((records3, len(records3)))
Exemplo n.º 2
0
 def __init__(self):
     # List of datasets we intend to download from yahoo finance
     self.datalist = ["MSFT", "AAPL", "GOOG"]
     self.datasets = []
     self.dataset_info = {}
     self.processor = Jamboree()
     self.pricedata_management = PriceData()
     self.pricedata_management.processor = self.processor
     self.dow_metadata = []
     self.reloaded_datasets = []
     self.episodes = []
     self._raw = []
     self.set_name = "default_test"
Exemplo n.º 3
0
def main():
    import pandas_datareader.data as web
    # data_msft = web.DataReader('MSFT','yahoo',start='2019/9/1',end='2020/1/30').round(2)
    # data_apple = web.DataReader('AAPL','yahoo',start='2019/9/1',end='2020/1/30').round(2)
    episode_id = uuid.uuid4().hex
    jambo = Jamboree()
    jam_processor = Jamboree()
    data_hander = PriceData()
    data_hander.processor = jam_processor
    trx_tron = data_hander.build("Tron",
                                 "TRX",
                                 country="Japan",
                                 sector="oil",
                                 market="commodities",
                                 exchange="binance")
    # The episode and live parameters are probably not good for the scenario. Will probably need to switch to something else to identify data
    trx_tron.episode = episode_id
    trx_tron.live = False
    trx_tron.reset()

    res = trx_tron.multi_search(country="jap")
    pprint.pprint(res)
Exemplo n.º 4
0
def main():
    import pandas_datareader.data as web
    # data_msft = web.DataReader('MSFT','yahoo',start='2019/9/1',end='2020/1/30').round(2)
    # data_apple = web.DataReader('AAPL','yahoo',start='2019/9/1',end='2020/1/30').round(2)
    episode_id = uuid.uuid4().hex
    jambo = Jamboree()
    jam_processor = Jamboree()
    data_hander = OrderbookData()
    data_hander.processor = jam_processor
    data_hander.event = jambo
    # The episode and live parameters are probably not good for the scenario. Will probably need to switch to something else to identify data
    data_hander.episode = episode_id
    data_hander.live = False
    data_hander['subcategories'] = {
        "market": "stock",
        "country": "Mexico",
        "sector": "tech",
        "exchange": "binance",
    }
    data_hander['name'] = "ETH Ethereum"
    data_hander.reset()
    # data_hander.store_time_df(data_msft, is_bar=True)

    data_hander['name'] = "BTC Bitcoin"
    # data_hander.reset()
    # data_hander.store_time_df(data_apple, is_bar=True)

    start = maya.now()._epoch
    # res1 = data_hander.by_name("Bitcoin")

    # logger.debug(res1)
    end = maya.now()._epoch
    logger.info(end - start)

    res = data_hander.multi_part_search(market="stock",
                                        exchange="binance",
                                        country="Mexico")
    logger.warning(res)
Exemplo n.º 5
0
def main():
    jambo = Jamboree()
    sample_env_handler = SampleEnvHandler()
    sample_env_handler.limit = 250
    sample_env_handler.processor = jambo
    # with timecontext():
    current_time = maya.now()._epoch
    mult = 60

    # Create a new set of records and swap to another location to be acted on.
    sample_env_handler['episode'] = uuid.uuid1().hex
    with timecontext():
        super_index = 0
        for _ in range(100):
            v1 = random.uniform(0, 12)
            sample_env_handler.save({
                "value":
                v1,
                "time": (current_time + (mult * super_index))
            })
            super_index += 1

        many_list = []
        catch_index_1 = random.randint(super_index - 10, super_index + 3)
        catch_index_2 = random.randint(super_index - 10, super_index + 3)
        last_by_time = (current_time + (mult * catch_index_1))
        last_by_time_2 = (current_time + (mult * catch_index_2))
        for _ in range(10):
            item = {
                "valuesssssss": random.uniform(0, 12),
                "time": (current_time + (mult * super_index))
            }
            many_list.append(item)
            super_index += 1

        sample_env_handler.save_many(many_list)
        latest = sample_env_handler.last()
        last_by = sample_env_handler.last_by(last_by_time, ar="relative")
        last_by_2 = sample_env_handler.last_by(last_by_time_2, ar="relative")

        t1 = last_by.get('time', time.time())
        t2 = last_by_2.get('time', time.time())

        logger.info(latest)
        logger.success(t1)
        logger.error(t2)
Exemplo n.º 6
0
            "is_filter": True,
            "values": {
                "is_exact": True,
                "term": submetatype
            }
        }
        self._search['name'] = self.name
        self._search['category'] = self.category
        self._search['subcategories'] = self.subcategories
        self._search['abbreviation'] = self.abbreviation
        self._search.processor = self.processor
        return self._search

    def reset(self):
        self.check()
        qo = self.setup_query()
        qo.pop("mtype", None)
        if self.description is not None:
            qo['description'] = self.description

        return self.search.Create(allow_duplicates=False,
                                  no_overwrite_must_have=True,
                                  **qo)


if __name__ == "__main__":
    jambo = Jamboree()
    metahandler = MetaHandler()
    metahandler.event = jambo
    metahandler.reset()
Exemplo n.º 7
0
        _multi["submetatype"] = item["submetatype"]
        _multi["category"] = item["category"]
        _multi["metatype"] = item["metatype"]
        _multi["subcategories"] = (item["subcategories"]).to_dict()
        _multi.reset()
        return _multi


if __name__ == "__main__":
    with example_space("Multi-Data-Management") as example:
        # set_name = uuid.uuid4().hex
        with logger.catch():
            set_name = "ac688d95336e41bdbe61c5c804d07f1a"
            episode = uuid.uuid4().hex
            # jam = Jamboree()
            jam_proc = Jamboree()
            multi_data = MultiDataManagement()
            multi_data.processor = jam_proc
            # The episode and live parameters are probably not good for the scenario.
            # Will probably need to switch to something else to identify data.
            multi_data["name"] = set_name
            multi_data["category"] = "markets"
            multi_data["subcategories"] = {
                "market": "stock",
                "country": "US",
                "sector": "techologyyyyyyyy",
            }
            multi_data["submetatype"] = "DINGO"
            multi_data["abbreviation"] = "MSFT"
            multi_data.episode = episode
            multi_data.live = False