Skip to content

Functions and Classes List

Axel Gard edited this page Jul 13, 2021 · 12 revisions

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 open

def 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 close

def buy(self, qty: int)
buys a stock. Takes int qty and a string sym

def sell(self, qty: int)
sells a stock. Takes int qty and a string sym

def 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 Alpaca

def barset(self, limit: int)
returns barset for stock for time period lim

def 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 open

def __repr__(self)
None

def __str__(self)
None

def __eq__(self, other)
None

def __ne__(self, other)
None

def __lt__(self, other)
None

def __le__(self, other)
None

def __gt__(self, other)
None

def __ge__(self, other)
None

def __add__(self, other)
None

def __radd__(self, other)
None

def __sub__(self, other)
None

def __rsub__(self, other)
None

def __mul__(self, other)
None

def __rmul__(self, other)
None

def __truediv__(self, other)
None

def __rdiv__(self, other)
None

def __floordiv__(self, other)
None

def __rfloordiv__(self, other)
None

def __abs__(self)
None

def __int__(self)
None

def __float__(self)
None

def __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 position

def owned_stock_qty(self, stock)
returns quantity of owned of a stock Stock (obj)

@property
def owned_stocks(self)

returns a list of owned stocks

def sell_list(self, lst)
takes a list of Stocks and sells all stocks in that list

def __repr__(self)
None

def __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