Welcome to Skynet’s documentation!

Terminator

terminator.aws_sns(phone: str, text: str) → None

Triggers an SMS notification via AWS SimpleNotificationService.

Parameters
  • phone – Phone number of the recipient.

  • text – Text which has to be sent.

terminator.file_parser(input_file: str = 'stocks.json') → dict

Reads the input file and loads the file as dictionary.

Parameters

input_file – Takes the input file name as an argument.

Returns

Returns a json blurb.

Return type

dict

terminator.get_change(current: float, previous: float) → float

Calculates the percentage change between the current value and previous value.

Parameters
  • current – Current price of stock.

  • previous – Previous price of stock.

Returns

Returns the difference percentage.

Return type

float

terminator.market_status() → bool

Checks market status and returns True only if markets are open.

Returns

True if markets are open on the current date.

Return type

bool

terminator.monitor() → None

Triggers formatter and sends an SMS notification if there were any bothering changes in price.

terminator.notify(phone: str, text: str) → None

Triggers notification using gmail-connector which uses the SMS gateway of the carrier.

Parameters
  • phone – Phone number of the recipient.

  • text – Text which has to be sent.

terminator.should_i_notify(change_percent: int = 5) → dict

Looks for the feed file and triggers the analyzer if feed is present.

Parameters

change_percent – Takes the change percentage from previous notification as an argument. Defaults to 5%.

See also

Checks the data written in previous.yaml file and compares the % difference with current price. If the difference is less than 5% or no difference at all, returns an empty dict.

Returns

Dictionary of the tickers and the price as key value pairs.

Return type

dict

terminator.write_previous(data: dict) → None

Writes the data received into a yaml file.

Parameters

data – Data to be written into yaml.

Analyzer

class gatherer.analyzer.Analyzer

Initiates Analyzer object to instantiate the class methods robinhood and yfinance using their API.

>>> Analyzer
classmethod formatter(stocks_dict: dict) → dict

Triggers the stock checker and formats the SMS into a dictionary.

Returns

Returns a dictionary of {stock_ticker: [SMS_text, price]}

Return type

dict

classmethod robinhood(stock_ticker: str, stock_max: float, stock_min: float, short: bool = True) → list

Checks whether the current price of the stock has increased or decreased.

Parameters
  • stock_ticker – Stock ticker value.

  • stock_max – Maximum value after which a notification has to be triggered.

  • stock_min – Minimum value below which a notification has to be triggered.

  • short – Boolean flag to send a short summary vs long description.

Returns

A list of configured notification message and the price.

Return type

list

classmethod yfinance(stock_ticker: str, stock_max: float, stock_min: float, short: bool = True) → list

Checks whether the current price of the stock has increased or decreased.

Parameters
  • stock_ticker – Stock ticker value.

  • stock_max – Maximum value after which a notification has to be triggered.

  • stock_min – Minimum value below which a notification has to be triggered.

  • short – Boolean flag to send a short summary vs long description.

Returns

A list of configured notification message and the price.

Return type

list

Tracer

gatherer.traces.prefix(level: str = 'DEBUG') → str

Replicates the logging config to print colored statements accordingly.

Parameters

level – Takes the log level as an argument.

Returns

A well formatted prefix to be added before a print statement.

Return type

str

Indices and tables