Cira V.2.0.0!

After Xmas cira V2 will be realsed with a new structre and new classes. The new classes include Stock, Portfolio, Exchange. This is classes that you will for the most part be using. But there are also some new files for more modulary.

The main thing is that you now have a new type Stock that makes it more simple to work with.

So all you need to do for a new index found is now:

import cira
import random
import time

cira.alpaca.KEY_FILE = "../mypath/key.json"

portfolio = cira.Portfolio()
exchange = cira.Exchange()

qty = 1 # choose how many stocks should be handled in one session 
while exchange.is_open:
    for stock in random.choices(exchange.stocks, k=qty):
        stock.buy(1)
    for stock in random.choices(portfolio.owned_stocks, k=qty):
        stock.sell(1)
    time.sleep(60*30) # 30 min timer