示例#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()
示例#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"],
     )
示例#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()
示例#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()
示例#5
0
def test_get_forex_rates():
    forex = Api().get_forex_rates("USD")
    assert forex.USD == 1
示例#6
0
def test_get_quote():
    Api().get_quote("AAPL")
示例#7
0
from stonky.api import Api
import sys

api = Api()

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