<s> import sqlite3 <EOL> from sharpefolio import stocks <EOL> from sharpefolio import calc <EOL> connection = sqlite3 . connect ( '<STR_LIT>' ) <EOL> connection . row_factory = sqlite3 . Row <EOL> stock_repository = stocks . StockSqliteRepository ( connection ) <EOL> stock_mapper = stocks . StockMapper ( stock_repository ) <EOL> price_repository = stocks . PriceSqliteRepository ( connection ) <EOL> price_mapper = stocks . PriceMapper ( price_repository ) <EOL> stock = stock_mapper . find_by_symbol ( '<STR_LIT>' ) <EOL> prices_collection = price_mapper . find_by_stock_id ( stock . id ) <EOL> prices = [ price . closing_price for price in prices_collection ] <EOL> ratio = calc . Ratio ( ) <EOL> sharpe = ratio . sharpe ( prices ) <EOL> sortino = ratio . sortino ( prices ) <EOL> print '<STR_LIT>' , sharpe , '<STR_LIT>' , sortino </s>
