<commit_before>import httplib2

from bs4 import BeautifulSoup

import ebroker.utils as utils

class EasyClickLots:
    
    lot_url = "http://www.rmsystem.cz/burza-sluzby/typy-obchodu/pokyn-easyclick"
    lot_table_id = "ec-lot"

    def __init__(self):
        self._lots = self.load_lots()

    def load_lots(self):
        http = httplib2.Http()
        (headers, html) = http.request(EasyClickLots.lot_url, "GET")
        soup = BeautifulSoup(html)
        table  = soup.find(id=EasyClickLots.lot_table_id)
        trs = table.find_all("tr")
        
        lots = {}
        for i in range(1, len(trs)):
            tds = trs[i].find_all("td")
            if(len(tds) >= 1):
                ticker = int(utils.get_ticker_from_link(tds[0].contents[0]['href']))
                name  =  tds[0].contents[0].contents[0]
                lot = int(tds[1].contents[0].replace(" ", ""))
                lots.update({ticker : EClot(ticker, name, lot)})

        return lots

    def get_lots(self):
        return self._lots

    def get_ec_lot(self, ticker):
        return self._lots.get(ticker)


class EClot:
    def __init__(self, ticker, name, lot):
        self._ticker = ticker
        self._name = name
        self._lot  = lot

    @property
    def ticker(self):
        return self._ticker

    @property
    def name(self):
        return self._name

    @property
    def lot(self):
        return self._lot

    def round_lots(self, amount):
        return (amount // self._lot) * self._lot<commit_msg>Add CEZ EC lot id and some documentation<commit_after>import httplib2

from bs4 import BeautifulSoup

import ebroker.utils as utils

class EasyClickLots:
    
    lot_url = "http://www.rmsystem.cz/burza-sluzby/typy-obchodu/pokyn-easyclick"
    lot_table_id = "ec-lot"

    CEZ = 11392

    def __init__(self):
        self._lots = self.load_lots()

    def load_lots(self):
        http = httplib2.Http()
        (headers, html) = http.request(EasyClickLots.lot_url, "GET")
        soup = BeautifulSoup(html)
        table  = soup.find(id=EasyClickLots.lot_table_id)
        trs = table.find_all("tr")
        
        lots = {}
        for i in range(1, len(trs)):
            tds = trs[i].find_all("td")
            if(len(tds) >= 1):
                ticker = int(utils.get_ticker_from_link(tds[0].contents[0]['href']))
                name  =  tds[0].contents[0].contents[0]
                lot = int(tds[1].contents[0].replace(" ", ""))
                lots.update({ticker : EClot(ticker, name, lot)})

        return lots

    def get_lots(self):
        return self._lots

    def get_ec_lot(self, ticker):
        return self._lots.get(ticker)


class EClot:
    def __init__(self, ticker, name, lot):
        self._ticker = ticker
        self._name = name
        self._lot  = lot

    @property
    def ticker(self):
        return self._ticker

    @property
    def name(self):
        return self._name

    @property
    def lot(self):
        return self._lot

    def round_lots(self, amount):
        '''
        Round the amount always DOWN based on the minimum EC lot amount.
        Returned value is maximum multiple of EC lot, which is less or equal than given amount.
        E.g. if EC lot is 50, than 80 will be rounded to 50, 120 to 100 etc.
        '''
        return (amount // self._lot) * self._lot
{'fraction_non_alphanumeric': 0.11759425493716337, 'fraction_numerical': 0.012268102932375824, 'mean_word_length': 2.112662942271881, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6505290', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1122, 'n_words': 253}