Пример #1
0
    def setUpClass(cls):
        cls.writer = writer("tmp_J32JFASDK", host="mongo")
        cls.reader = reader("tmp_J32JFASDK", host="mongo")

        # write assets into test database. Writing is slow!
        cls.writer.update_assets(frame=read_frame("price.csv", parse_dates=True))
        cls.writer.update_symbols(frame=read_frame("symbols.csv"))
        cls.writer.update_portfolio("test", test_portfolio(), group="test")
Пример #2
0
    def setUpClass(cls):
        cls.writer = writer("tmp_JKJFDAFJJKFD", host="mongo")
        cls.reader = reader("tmp_JKJFDAFJJKFD", host="mongo")

        # write assets into test database. Writing is slow!
        assets = read_frame("price.csv", parse_dates=True)

        for asset in assets:
            cls.writer.update_asset(asset, assets[asset])

        frame = read_frame("symbols.csv")
        cls.writer.update_symbols(frame)

        p = test_portfolio()
        cls.writer.update_portfolio("test", p, group="test", comment="test")
Пример #3
0
#!/usr/bin/env python
import logging

from pyutil.decorators import attempt
from pyutil.mongo.archive import reader

# I use the attempt decorator here. The attempt decorator embeds the function into try/except and reports any exception
# to the logger...:

@attempt
def f(logger, archive):
    for key in archive.portfolios.keys():
        logger.debug(key)
        portfolio = archive.portfolios[key]
        print(portfolio.nav.monthlytable)


if __name__ == '__main__':
    f(logger=logging.getLogger(__name__), archive=reader(name="production", host="quantsrv"))