def build_placement(self): placements = { 'Colocacion flotante': 5, 'Mecanismo clic': 6, 'Fibra de vidrio': 7 } self.floor.set_placement( Placement(self.placement, Price(placements[self.placement])))
def GetCurrentData(self, currency): ''' Get the current data from the API. @param currency: currency code of interest @returns: current bitcoin price data as a Price object. ''' url = self._apiCurrentPriceCode.format(currency) jsonData = self._getApiJsonResponse(url) price = jsonData['bpi'][currency]['rate_float'] date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S') currentData = Price(currency, price, date) return currentData
def GetEndOfDayData(self, startDate, endDate, currency): ''' Get end of day data. @param startDate: start date of data collection, format: yyyy-mm-dd @param endDate: end date of data collection, format: yyyy-mm-dd @param currency: currency code @returns: dictionary of date and data objects ''' url = self._apiEODPrice.format(startDate, endDate, currency) jsonData = self._getApiJsonResponse(url) eodData = jsonData['bpi'] dataCollection = [] for date in eodData: dataCollection.append(Price(currency, eodData[date], date)) return dataCollection
def __init__(self): super().__init__() self.price = Price(25)
def build_thickness(self): thickness = Thickness(self.millimetre, Price(5)) self.floor.set_thickness(thickness)
def search(self, pattern, context=''): return Price.search(pattern,context)