Ejemplo n.º 1
0
async def main():
    async with Api() as api:
        settings = Settings.load()
        stock_store = StockStore(api, settings)
        tty = Tty(settings, stock_store)
        if settings.refresh:
            await tty.draw_live()
        else:
            await tty.draw()
Ejemplo n.º 2
0
 def setUp(self) -> None:
     self.api = Api()
     self.api._query = Mock()
     self.settings = Settings(
         positions={
             "AAPL": 1,
             "AMD": 10,
             "SHOP.TO": 100,
             "VGRO.TO": 1000,
         },
         watchlist=["AAPL", "AMD", "SHOP.TO", "VGRO.TO"],
     )
Ejemplo n.º 3
0
def main():
    try:
        api = Api()
        settings = Settings()
        stock_store = StockStore(api, settings)
        tty = Tty(settings, stock_store)
        if settings.refresh:
            tty.draw_live()
        else:
            tty.draw()
    except SystemExit:
        pass
    except:
        if IS_DEBUG:
            raise
        else:
            crash_report()
Ejemplo n.º 4
0
async def main():
    try:
        async with Api() as api:
            settings = Settings()
            stock_store = StockStore(api, settings)
            await stock_store.update_stocks()
            tty = Tty(settings, stock_store)
            if settings.refresh:
                await tty.draw_live()
            else:
                await tty.draw()
    except SystemExit:
        pass
    except:
        if IS_DEBUG:
            raise
        else:
            crash_report()
Ejemplo n.º 5
0
def test_get_forex_rates():
    forex = Api().get_forex_rates("USD")
    assert forex.USD == 1
Ejemplo n.º 6
0
def test_get_quote():
    Api().get_quote("AAPL")
Ejemplo n.º 7
0
from stonky.api import Api
import sys

api = Api()

result = api.get_quote(sys.argv[1])
print(result)