transparency_epias/markets/intradayClient.py
def trade_history(self, startDate, endDate, contract_type):

        '''
        This function returns 5 lists according to contract_type argument which including:
            -Datetime information as first item.
            -Contract id infromation as second item. 
            -Contract name information as third item.
            -Quantity values as fourth item.
            -Price values as fifth item.

        Parameters:

        startDate: Start date in YYYY-MM-DD format.
        endDate: End date in YYYY-MM-DD format.
        contract_type: Block or Hourly

        '''
        val.date_check(startDate, endDate)

        query = "market/intra-day-trade-history?startDate="+f'{startDate}'+"&endDate="+f'{endDate}'

        json_result = self.get_request_result(query)

        response_list = json_result['body']

        key_list = list(json_result['body'].keys())

        key_name = key_list[0]

        response_list = json_result['body'][f'{key_name}']
        
        hourly_date_list = []
        houry_id_list = []
        hourly_quantity = []
        hourly_price = []
        houryl_contract_list = []

        block_date_list = []
        block_id_list = []
        block_quantity = []
        block_price = []
        block_contract_list = []

        block_key = 'PB'
        
        for item in response_list:
            contract_name = item['conract']
            
            if block_key in contract_name:
                block_quantity.append(item['quantity'])
                block_price.append(item['price'])
                block_id_list.append(item['id'])
                block_date_list.append(item['date'])
                block_contract_list.append(item['conract'])
            else:
                hourly_quantity.append(item['quantity'])
                hourly_price.append(item['price'])
                houry_id_list.append(item['id'])
                hourly_date_list.append(item['date'])
                houryl_contract_list.append(item['conract'])

        if contract_type == 'Block':

            return block_date_list, block_id_list, block_contract_list, block_quantity, block_price

        elif contract_type == 'Hourly':

            return hourly_date_list, houry_id_list, houryl_contract_list, hourly_quantity, hourly_price

        else:
            
            raise Exception('contract_type argument has to be Block or Hourly!')

        This function returns 5 lists according to contract_type argument which including:
            -Datetime information as first item.
            -Contract id infromation as second item. 
            -Contract name information as third item.
            -Quantity values as fourth item.
            -Price values as fifth item.

        Parameters:

        startDate: Start date in YYYY-MM-DD format.
        endDate: End date in YYYY-MM-DD format.
        contract_type: Block or Hourly

        
This function returns 5 lists according to contract_type argument which including:
Datetime information as first item.
Contract id infromation as second item.
Contract name information as third item.
Quantity values as fourth item.
Price values as fifth item.



Start date in YYYY-MM-DD format.
endDate: End date in YYYY-MM-DD format.
contract_type: Block or Hourly
This function returns 5 lists according to contract_type argument which including : Datetime information as first item . Contract id infromation as second item . Contract name information as third item . Quantity values as fourth item . Price values as fifth item . Start date in YYYY - MM - DD format . endDate : End date in YYYY - MM - DD format . contract_type : Block or Hourly
def trade_history(self, startDate, endDate, contract_type):
        val.date_check(startDate, endDate)
        query = "market/intra-day-trade-history?startDate="+f'{startDate}'+"&endDate="+f'{endDate}'
        json_result = self.get_request_result(query)
        response_list = json_result['body']
        key_list = list(json_result['body'].keys())
        key_name = key_list[0]
        response_list = json_result['body'][f'{key_name}']
        hourly_date_list = []
        houry_id_list = []
        hourly_quantity = []
        hourly_price = []
        houryl_contract_list = []
        block_date_list = []
        block_id_list = []
        block_quantity = []
        block_price = []
        block_contract_list = []
        block_key = 'PB'
        for item in response_list:
            contract_name = item['conract']
            if block_key in contract_name:
                block_quantity.append(item['quantity'])
                block_price.append(item['price'])
                block_id_list.append(item['id'])
                block_date_list.append(item['date'])
                block_contract_list.append(item['conract'])
            else:
                hourly_quantity.append(item['quantity'])
                hourly_price.append(item['price'])
                houry_id_list.append(item['id'])
                hourly_date_list.append(item['date'])
                houryl_contract_list.append(item['conract'])
        if contract_type == 'Block':
            return block_date_list, block_id_list, block_contract_list, block_quantity, block_price
        elif contract_type == 'Hourly':
            return hourly_date_list, houry_id_list, houryl_contract_list, hourly_quantity, hourly_price
        else:
            raise Exception('contract_type argument has to be Block or Hourly!')
def trade_history ( self , startDate , endDate , contract_type ) : val . date_check ( startDate , endDate ) query = "market/intra-day-trade-history?startDate=" + f'{startDate}' + "&endDate=" + f'{endDate}' json_result = self . get_request_result ( query ) response_list = json_result [ 'body' ] key_list = list ( json_result [ 'body' ] . keys ( ) ) key_name = key_list [ 0 ] response_list = json_result [ 'body' ] [ f'{key_name}' ] hourly_date_list = [ ] houry_id_list = [ ] hourly_quantity = [ ] hourly_price = [ ] houryl_contract_list = [ ] block_date_list = [ ] block_id_list = [ ] block_quantity = [ ] block_price = [ ] block_contract_list = [ ] block_key = 'PB' for item in response_list : contract_name = item [ 'conract' ] if block_key in contract_name : block_quantity . append ( item [ 'quantity' ] ) block_price . append ( item [ 'price' ] ) block_id_list . append ( item [ 'id' ] ) block_date_list . append ( item [ 'date' ] ) block_contract_list . append ( item [ 'conract' ] ) else : hourly_quantity . append ( item [ 'quantity' ] ) hourly_price . append ( item [ 'price' ] ) houry_id_list . append ( item [ 'id' ] ) hourly_date_list . append ( item [ 'date' ] ) houryl_contract_list . append ( item [ 'conract' ] ) if contract_type == 'Block' : return block_date_list , block_id_list , block_contract_list , block_quantity , block_price elif contract_type == 'Hourly' : return hourly_date_list , houry_id_list , houryl_contract_list , hourly_quantity , hourly_price else : raise Exception ( 'contract_type argument has to be Block or Hourly!' )
This function returns 5 lists according to contract_type argument which including:
Datetime information as first item.
This function returns 5 lists according to contract_type argument which including : Datetime information as first item .
'''
        This function returns 5 lists according to contract_type argument which including:
            -Datetime information as first item.
            -Contract id infromation as second item. 
            -Contract name information as third item.
            -Quantity values as fourth item.
            -Price values as fifth item.

        Parameters:

        startDate: Start date in YYYY-MM-DD format.
        endDate: End date in YYYY-MM-DD format.
        contract_type: Block or Hourly

        '''
self
startDate
endDate
contract_type