Functions and Classes List - AxelGard/cira GitHub Wiki
cira/
cira/util.py
def reformat_position(position)
reformat position to be float values
cira/init.py
cira/exchange.py
class Exchange()
This is the class instence of the Exchange.
This class is used for interaction with the exchanges,
for exampel NYSE. The exchange returns data and list of Stocks.
def __init__(self)
None@property
def is_open(self)
returns if exchange is opendef assets_raw(self)
returns a list of all avilabel stocks in exchanges list@property
def symbols(self)
returns a list of all symbols@property
def stocks(self)
returns a list of objects Stocks@property
def historical_data(self)
gathers all historical data on all stocks, {"sym":[data]}
cira/alpaca.py
def authentication_header()
get's key and returns key in json format
def api()
returns object for api
cira/stock.py
class Stock()
This is the class instence of a Stock.
This class is for interaction of a Stock
def __init__(self, symbol: str)
None@property
def price(self) -> float
returns the current price of given symbol (str)@property
def value(self) -> float
takes a string sym. Gets and returns the stock value at closedef buy(self, qty: int)
buys a stock. Takes int qty and a string symdef sell(self, qty: int)
sells a stock. Takes int qty and a string symdef order(self, qty: int, beh: str) -> float
submit order and is a template for order@property
def is_shortable(self) -> bool
checks if stock can be shorted@property
def can_borrow(self) -> bool
check whether the name is currently
available to short at Alpacadef barset(self, limit: int)
returns barset for stock for time period limdef historical_data(self, nr_days=1000)
returns a list of the stocks closing value,
range of 1 to 1000 days@property
def week_pl_change(self)
Percentage change over a week@property
def is_tradable(self)
return if the stock can be traded@property
def position(self)
returns position of stock@property
def today_plpc(self)
stock today's profit/loss percent@property
def plpc(self)
stock sym (str) Unrealized profit/loss percentage@property
def exchange_is_open(self) -> bool
returns if exchange is opendef __repr__(self)
Nonedef __str__(self)
Nonedef __eq__(self, other)
Nonedef __ne__(self, other)
Nonedef __lt__(self, other)
Nonedef __le__(self, other)
Nonedef __gt__(self, other)
Nonedef __ge__(self, other)
Nonedef __add__(self, other)
Nonedef __radd__(self, other)
Nonedef __sub__(self, other)
Nonedef __rsub__(self, other)
Nonedef __mul__(self, other)
Nonedef __rmul__(self, other)
Nonedef __truediv__(self, other)
Nonedef __rdiv__(self, other)
Nonedef __floordiv__(self, other)
Nonedef __rfloordiv__(self, other)
Nonedef __abs__(self)
Nonedef __int__(self)
Nonedef __float__(self)
Nonedef __round__(self, nDigits)
None
cira/config.py
cira/portfolio.py
class Portfolio()
The class Portfolio, is for
interacting with your own protfolio.
def __init__(self)
None@property
def orders(self)
returns a list of all open orders with all diffult args@property
def position(self)
create a list of all owned positiondef owned_stock_qty(self, stock)
returns quantity of owned of a stock Stock (obj)@property
def owned_stocks(self)
returns a list of owned stocksdef sell_list(self, lst)
takes a list of Stocks and sells all stocks in that listdef __repr__(self)
Nonedef __str__(self)
None
cira/logging.py
def format_log_action(act: str, sym: str, qty: int)
formats info for logging
def log(log_data)
writes log data to file