diff --git a/CHANGES.txt b/CHANGES.txt index 35a34f3..c13b2da 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,3 +2,23 @@ --- - Initial version + + + +>>> quote.info +{'language': 'en-US', 'region': 'US', 'quoteType': 'ETF', 'quoteSourceName': 'Delayed Quote', 'currency': 'USD', 'regularMarketChange': -0.5200043, +'regularMarketOpen': 93.81, 'regularMarketDayHigh': 93.91, 'regularMarketDayLow': 92.44, 'regularMarketVolume': 4040066, 'askSize': 14, +'messageBoardId': 'finmb_22939711', 'fullExchangeName': 'NYSEArca', 'longName': 'Vanguard Real Estate Index Fund ETF Shares', +'financialCurrency': 'USD', 'averageDailyVolume3Month': 4826021, 'averageDailyVolume10Day': 4604087, 'fiftyTwoWeekLowChange': 22.009995, +'fiftyTwoWeekLowChangePercent': 0.30965102, 'fiftyTwoWeekRange': '71.08 - 94.07', 'fiftyTwoWeekHighChange': -0.98000336, +'fiftyTwoWeekHighChangePercent': -0.01041781, 'fiftyTwoWeekLow': 71.08, 'fiftyTwoWeekHigh': 94.07, 'esgPopulated': False, 'tradeable': True, +'trailingAnnualDividendRate': 3.533, 'trailingPE': 8.381201, 'trailingAnnualDividendYield': 0.037741695, 'ytdReturn': 25.76, +'trailingThreeMonthReturns': 7.14, 'trailingThreeMonthNavReturns': 7.21, 'epsTrailingTwelveMonths': 11.107, 'marketState': 'CLOSED', +'postMarketChangePercent': 0.042970154, 'postMarketTime': 1569618175, 'postMarketPrice': 93.13, 'postMarketChange': 0.040000916, +'regularMarketChangePercent': -0.55550075, 'regularMarketDayRange': '92.44 - 93.91', 'regularMarketPreviousClose': 93.61, 'bid': 93.03, +'ask': 93.13, 'bidSize': 11, 'exchange': 'PCX', 'shortName': 'Vanguard Real Estate ETF', 'exchangeDataDelayedBy': 0, 'priceHint': 2, +'sharesOutstanding': 370180992, 'bookValue': 63.751, 'fiftyDayAverage': 92.157425, 'fiftyDayAverageChange': 0.9325714, +'fiftyDayAverageChangePercent': 0.01011933, 'twoHundredDayAverage': 88.83857, 'twoHundredDayAverageChange': 4.2514267, +'twoHundredDayAverageChangePercent': 0.04785564, 'marketCap': 34460147712, 'priceToBook': 1.4602123, 'sourceInterval': 15, +'exchangeTimezoneName': 'America/New_York', 'exchangeTimezoneShortName': 'EDT', 'gmtOffSetMilliseconds': -14400000, 'triggerable': False, +'market': 'us_market', 'regularMarketPrice': 93.09, 'regularMarketTime': 1569614400, 'symbol': 'VNQ'} \ No newline at end of file diff --git a/caotek_mesavoirs/layout.py b/caotek_mesavoirs/layout.py index b120662..d0db947 100644 --- a/caotek_mesavoirs/layout.py +++ b/caotek_mesavoirs/layout.py @@ -3,6 +3,7 @@ from pyramid_layout.layout import layout_config from .security import groupfinder from .views.default import ( to_euro, + to_usd, to_percent, to_decimal, ) @@ -22,6 +23,9 @@ class GlobalLayout(object): def to_euro(self, x): return to_euro(x) + def to_usd(self, x): + return to_usd(x) + def to_percent(self, x, d): return to_percent(x, d) diff --git a/caotek_mesavoirs/models/actifs.py b/caotek_mesavoirs/models/actifs.py index ee079c4..e6763c2 100644 --- a/caotek_mesavoirs/models/actifs.py +++ b/caotek_mesavoirs/models/actifs.py @@ -10,7 +10,6 @@ from zope.sqlalchemy import ZopeTransactionExtension, mark_changed from datetime import * import transaction -from bs4 import BeautifulSoup from urllib.request import urlopen from .default import ( @@ -141,33 +140,5 @@ def delete_histo(request, no_id): query = "DELETE FROM histo WHERE no_id = :no_id ;" execute_query(request, query, {'no_id': no_id}) -def getCurrencyRate(currency): - # specify the url - quote_page = 'https://markets.ft.com/data/currencies/tearsheet/summary?s=%seur' % currency - # query & parse the html using beautiful soap and store in variable `soup` - soup = BeautifulSoup(urlopen(quote_page), 'html.parser') - data_list = soup.find_all("span", class_="mod-ui-data-list__value") - if data_list: - # get the rate price in EUR - rate_price = float(data_list[0].text.replace(',','')) - else: - rate_price = 0.0 - - return rate_price - -def getFTQuote(ticker): - # specify the url of The Financial Times - quote_page = 'https://markets.ft.com/data/funds/tearsheet/historical?s=%s' % ticker - - # query & parse the html using beautiful soap and store in variable `soup` - soup = BeautifulSoup(urlopen(quote_page), 'html.parser') - data_list = soup.find_all("span", class_="mod-ui-data-list__value") - if data_list: - # get the quote price - quote_price = float(data_list[0].text.replace(',','')) - else: - quote_price = 0.0 - - return quote_price diff --git a/caotek_mesavoirs/templates/actifs/actif_edit.pt b/caotek_mesavoirs/templates/actifs/actif_edit.pt index 70ae4ed..1e20a40 100644 --- a/caotek_mesavoirs/templates/actifs/actif_edit.pt +++ b/caotek_mesavoirs/templates/actifs/actif_edit.pt @@ -31,39 +31,21 @@ data-fv-stringlength-max="15" data-fv-stringlength-message="15 caractères maximum" /> - -
${actif.libelle}
${actif.devise}
+