From f7f042c25384e9aa66e10084afbfdb426a3701e5 Mon Sep 17 00:00:00 2001 From: Snail Mail <> Date: Wed, 12 Apr 2017 13:51:40 +0300 Subject: [PATCH 1/2] Add all funds in a separate html select. Funds are added automatically by running list-funds.py (e.g. daily). Old menus do not work due to different fund names. update.sh, update_one.sh are obsoleted. --- funds.csv | 106 ++++++++++++++++++++++++ list-funds.py | 53 ++++++++++++ src/main/java/com/idzona/baud/Main.java | 60 +++++++++++--- website/funds.json | 1 + website/index.html | 37 ++++++++- 5 files changed, 243 insertions(+), 14 deletions(-) create mode 100644 funds.csv create mode 100644 list-funds.py create mode 100644 website/funds.json diff --git a/funds.csv b/funds.csv new file mode 100644 index 0000000..46fdf97 --- /dev/null +++ b/funds.csv @@ -0,0 +1,106 @@ +11,Алфа Индекс Имоти,Alfa-Indeks-Imoti +12,Алфа SOFIX Индекс,Alfa-SOFIX-Indeks +41,Алфа Избрани Акции,Alfa-Izbrani-Akcii +89,Алфа Ликвидни Средства,Alfa-Likvidni-Sredstva +106,ДФ Аркус Балансиран,DF-Arkus-Balansiran +111,ДФ Аркус Динамичен,DF-Arkus-Dinamichen +54,ДФ Астра Кеш,DF-Astra-Kesh +79,ДФ Астра Комодити,DF-Astra-Komoditi +80,ДФ Астра Плюс,DF-Astra-Plyus +122,ДФ Астра Енерджи,DF-Astra-Enerdzhi +121,ДФ Астра Ценни Метали,DF-Astra-Cenni-Metali +34,ДФ Ди Ви Евробонд,DF-Di-Vi-Evrobond +36,ДФ Ди Ви Хармония,DF-Di-Vi-Harmoniya +37,ДФ Ди Ви Динамик,DF-Di-Vi-Dinamik +40,ДФ Ди Ви Съкровище,DF-Di-Vi-Sykrovishte +8,ДФ ДСК Стандарт,DF-DSK-Standart +9,ДФ ДСК Баланс,DF-DSK-Balans +10,ДФ ДСК Растеж,DF-DSK-Rastezh +67,ДФ ДСК Имоти,DF-DSK-Imoti +85,ДФ „ДСК Евро Актив”,DF-DSK-Evro-Aktiv +100,ДФ “ДСК СТАБИЛНОСТ - ЕВРОПЕЙСКИ АКЦИИ”,DF-DSK-STABILNOST-EVROPEYSKI-AKCII +107,ДФ “ДСК СТАБИЛНОСТ - НЕМСКИ АКЦИИ”,DF-DSK-STABILNOST-NEMSKI-AKCII +105,ДФ “ДСК ФОНД НА ПАРИЧНИЯ ПАЗАР ”,DF-DSK-FOND-NA-PARICHNIYA-PAZAR +108,ДФ “ДСК ФОНД НА ПАРИЧНИЯ ПАЗАР В ЕВРО ”,DF-DSK-FOND-NA-PARICHNIYA-PAZAR-V-EVRO +109,ДФ “ДСК АЛТЕРНАТИВА”,DF-DSK-ALTERNATIVA +135,ДФ „ДСК Глобални компании”,DF-DSK-Globalni-kompanii +82,ДФ Експат Имърджинг Маркетс Стокс,DF-Ekspat-Imyrdzhing-Markets-Stoks +83,ДФ Експат Глоубъл Екуитис,DF-Ekspat-Gloubyl-Ekuitis +90,ДФ Експат Бондс,DF-Ekspat-Bonds +17,ИД Елана Високодоходен Фонд,ID-Elana-Visokodohoden-Fond +15,ДФ Елана Балансиран Евро Фонд,DF-Elana-Balansiran-Evro-Fond +16,ДФ Елана Балансиран Долар Фонд,DF-Elana-Balansiran-Dolar-Fond +42,ДФ Елана Фонд Свободни пари,DF-Elana-Fond-Svobodni-pari +87,ДФ Елана Еврофонд,DF-Elana-Evrofond +95,ДФ Елана Глобален Фонд Акции,DF-Elana-Globalen-Fond-Akcii +131,ДФ Елана България,DF-Elana-Bylgariya +63,ДФ ЕФ Принсипал,DF-EF-Prinsipal +74,ДФ ЕФ Рапид,DF-EF-Rapid +18,ДФ Златен лев,DF-Zlaten-lev +65,ДФ Златен лев Индекс 30,DF-Zlaten-lev-Indeks-30 +125,ДФ Глобал Опортюнитис,DF-Global-Oportyunitis +110,ДФ Инвест Фонд Паричен Пазар,DF-Invest-Fond-Parichen-Pazar +126,ДФ Инвест Фонд Паричен Пазар - Долари,DF-Invest-Fond-Parichen-Pazar-Dolari +72,ДФ Инвест Актив,DF-Invest-Aktiv +56,ДФ Инвест Класик,DF-Invest-Klasik +96,ДФ Капман Фикс,DF-Kapman-Fiks +19,ДФ Капман Капитал,DF-Kapman-Kapital +20,ДФ Капман Макс,DF-Kapman-Maks +132,ДФ С-МИКС,DF-S-MIKS +133,ДФ С-БОНДС,DF-S-BONDS +21,ДФ Адванс Инвест,DF-Advans-Invest +22,ДФ Адванс Източна Европа,DF-Advans-Iztochna-Evropa +46,ДФ Адванс Възможности в Нова Европа,DF-Advans-Vyzmozhnosti-v-Nova-Evropa +101,ДФ Адванс Глобал Трендс,DF-Advans-Global-Trends +104,ДФ Адванс Консервативен Фонд,DF-Advans-Konservativen-Fond +119,ДФ КОМПАС ГЛОБЪЛ ТРЕНДС,DF-KOMPAS-GLOBYL-TRENDS +61,ДФ КОМПАС ЕВРОСТАБИЛНОСТ,DF-KOMPAS-EVROSTABILNOST +60,ДФ КОМПАС СТРАТЕГИЯ,DF-KOMPAS-STRATEGIYA +62,ДФ КОМПАС ПРОГРЕС,DF-KOMPAS-PROGRES +1,ДФ Конкорд Фонд-1 Акции и Облигации,DF-Konkord-Fond-1-Akcii-i-Obligacii +2,ДФ Конкорд Фонд-2 Акции,DF-Konkord-Fond-2-Akcii +4,ДФ Конкорд Фонд-3 Сектор Недвижими Имоти,DF-Konkord-Fond-3-Sektor-Nedvizhimi-Imoti +51,ДФ Конкорд Фонд-4 Енергетика,DF-Konkord-Fond-4-Energetika +66,ДФ Конкорд Фонд-5 ЦИЕ,DF-Konkord-Fond-5-CIE +57,ДФ Конкорд Фонд-6 Паричен,DF-Konkord-Fond-6-Parichen +30,ДФ Стандарт Инв. Високодоходен Фонд,DF-Standart-Inv-Visokodohoden-Fond +29,ДФ Стандарт Инв. Балансиран Фонд,DF-Standart-Inv-Balansiran-Fond +31,ДФ Стандарт Инв. Международен Фонд,DF-Standart-Inv-Mezhdunaroden-Fond +26,ДФ ОББ Платинум Облигации,DF-OBB-Platinum-Obligacii +27,ДФ ОББ Балансиран Фонд,DF-OBB-Balansiran-Fond +28,ДФ ОББ Премиум Акции,DF-OBB-Premium-Akcii +84,ДФ ОББ Патримониум Земя,DF-OBB-Patrimonium-Zemya +98,ДФ ОББ Глобал Фарм Инвест,DF-OBB-Global-Farm-Invest +99,ДФ ОББ Евро Пари,DF-OBB-Evro-Pari +127,ОББ Глобал Детски Фонд,OBB-Global-Detski-Fond +129,ОББ Глобал Растеж,OBB-Global-Rastezh +130,ОББ Глобал Дивидент,OBB-Global-Divident +43,ДФ "ПИБ- Авангард",DF-PIB-Avangard +45,ДФ "ПИБ- Класик",DF-PIB-Klasik +44,ДФ "ПИБ- Гарант",DF-PIB-Garant +94,ДФ ПФБК ВОСТОК,DF-PFBK-VOSTOK +47,Райфайзен Консервативен Фонд (България),Rayfayzen-Konservativen-Fond-Bylgariya +3,Райфайзен "България" фонд Глобален Растеж,Rayfayzen-Bylgariya-fond-Globalen-Rastezh +91,Райфайзен (България) Активна Защита,Rayfayzen-Bylgariya-Aktivna-Zashtita +128,ДФ "Райфайзен (България) Глобален Микс",DF-Rayfayzen-Bylgariya-Globalen-Miks +23,ДФ „Селект Облигации“,DF-Selekt-Obligacii +24,ДФ „Селект Баланс“,DF-Selekt-Balans +25,ДФ „Селект Регионал“,DF-Selekt-Regional +102,ДФ „Селект Дивидент“,DF-Selekt-Divident +32,СКАЙ Нови Акции,SKAY-Novi-Akcii +33,СКАЙ Финанси,SKAY-Finansi +97,СКАЙ Глобал ETFs,SKAY-Global-ETFs +48,ДФ Профит,DF-Profit +49,ДФ Престиж,DF-Prestizh +5,ДФ Тексим Парични Пазари,DF-Teksim-Parichni-Pazari +6,ДФ Тексим България,DF-Teksim-Bylgariya +39,ДФ Тексим Балкани,DF-Teksim-Balkani +59,ДФ Тексим Комодити Стратеджи,DF-Teksim-Komoditi-Stratedzhi +78,Тренд Балансиран Фонд,Trend-Balansiran-Fond +81,Тренд Фонд Акции,Trend-Fond-Akcii +103,Тренд Фонд Паричен Пазар,Trend-Fond-Parichen-Pazar +55,ЦКБ Лидер,CKB-Lider +75,ЦКБ Актив,CKB-Aktiv +76,ЦКБ Гарант,CKB-Garant +116,ДФ Юг Маркет Максимум,DF-YUg-Market-Maksimum +117,ДФ "Юг Маркет Оптимум",DF-YUg-Market-Optimum diff --git a/list-funds.py b/list-funds.py new file mode 100644 index 0000000..e511267 --- /dev/null +++ b/list-funds.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# generates funds.csv, website/funds.json from baud.bg + +from lxml import html +import requests +page = requests.get('http://baud.bg/quotes/') +tree = html.fromstring(page.content) + +def translate(bg): + unchanged = u'- ' + cyr = u"абвгдезийклмнопрстуфхъц" + cyr += cyr.upper() + lat = u"abvgdeziyklmnoprstufhyc" + lat += lat.upper() + complex_map = {u'ю': 'yu', u'я': 'ya', u'ж': 'zh', u'ш': u'sh', u'щ': 'sht', u'ц': 'ts', u'ч': 'ch'} + for k in list(complex_map.keys()): + complex_map[k.upper()] = complex_map[k].upper() + res = '' +# print cyr + for l in bg: + if l in unchanged or re.search('[-a-z0-9]', l ,re.IGNORECASE): + res += l + else: +# print l, cyr.find(l) + try: + res += lat[cyr.index(l)] + except: + if l in complex_map: + res += complex_map[l] +# print res + return res + +import re + +to_json = [] +comma_sep = u'' +for t in tree.xpath('..//div[@class="fond_div"]/a'): + fund_id = (re.search('fond=([0-9]+)', t.attrib['href']).group(1)).strip() + bg_name = t.text_content().strip() + if not bg_name: continue + lat_name = translate(bg_name).strip().replace(' ', '-') + lat_name = re.sub('--+', '-', lat_name) + + print fund_id, bg_name, lat_name + comma_sep += fund_id + ',' + bg_name + ',' + lat_name + '\n' + to_json.append((fund_id, bg_name, lat_name)) +with open('funds.csv', 'wb') as f: + f.write(comma_sep.encode("UTF-8")) + +import json +with open('website/funds.json', 'w') as f: + json.dump(to_json, f) +print 'wrote funds.csv, website/funds.json' diff --git a/src/main/java/com/idzona/baud/Main.java b/src/main/java/com/idzona/baud/Main.java index 1139769..be2f5ec 100644 --- a/src/main/java/com/idzona/baud/Main.java +++ b/src/main/java/com/idzona/baud/Main.java @@ -5,10 +5,13 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; import java.net.URL; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; @@ -28,11 +31,18 @@ public class Main { private Main() {} public static void main(String... args) { - int fundId; - String arg; - + System.out.println("start"); Main main = new Main(); + if (args.length == 0) { + main.loadFunds(); + } else { + //TODO: funds.csv should be updated in cron by "python list-funds.py" + System.out.println("Funds are loaded from ./funds.csv now, no id supported"); + } + System.exit(0); + String arg; + if(args.length <= 0) { System.out.print("Enter mutual fund ID: "); Scanner sc = new Scanner(System.in); @@ -47,9 +57,14 @@ public static void main(String... args) { System.exit(0); } - // Parse the fund ID. Use '10' as default value. + main.loadFund(arg, arg); + } + + private void loadFund(String id, String fundPrefix) { + int fundId; + // Parse the fund ID. Use '10' as default value. try { - fundId = Integer.parseInt(arg); + fundId = Integer.parseInt(id); if(fundId < 0) { throw new NumberFormatException(); } @@ -59,10 +74,30 @@ public static void main(String... args) { } // Main processing. - main.process(fundId); - } - - private void process(int fundId) { + process(fundId, fundPrefix); + } + + private void loadFunds() { + try { + InputStreamReader r = new InputStreamReader(new FileInputStream("funds.csv")); + BufferedReader br = new BufferedReader(r); + String line = null; + int i = 0; + while (null != (line = br.readLine())) { + String[] parts = line.split(","); + System.out.println(String.join(" --- ", parts)); + loadFund(parts[0], parts[2]); + //if (++i == 3) + // break; + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void process(int fundId, String fundPrefix) { File xlsFile = downloadFund(fundId); if(xlsFile == null) { @@ -90,12 +125,13 @@ private void process(int fundId) { } // Export daily. - exportDailyCsv("daily.csv", baudEntries); + String prefix = "website/data/" + fundPrefix; + exportDailyCsv(prefix + "-daily.csv", baudEntries); // Export weekly. Set periodBauds = generateWeekPeriods(baudEntries); - exportBaudPeriodsCsv("weekly.csv", periodBauds); - exportBaudPeriodsJs("weekly.js", periodBauds, baudData.getFundId()); + exportBaudPeriodsCsv(prefix + "-weekly.csv", periodBauds); + exportBaudPeriodsJs(prefix + ".js", periodBauds, baudData.getFundId()); } private void test() { diff --git a/website/funds.json b/website/funds.json new file mode 100644 index 0000000..b980a21 --- /dev/null +++ b/website/funds.json @@ -0,0 +1 @@ +[["11", "\u0410\u043b\u0444\u0430 \u0418\u043d\u0434\u0435\u043a\u0441 \u0418\u043c\u043e\u0442\u0438", "Alfa-Indeks-Imoti"], ["12", "\u0410\u043b\u0444\u0430 SOFIX \u0418\u043d\u0434\u0435\u043a\u0441", "Alfa-SOFIX-Indeks"], ["41", "\u0410\u043b\u0444\u0430 \u0418\u0437\u0431\u0440\u0430\u043d\u0438 \u0410\u043a\u0446\u0438\u0438", "Alfa-Izbrani-Akcii"], ["89", "\u0410\u043b\u0444\u0430 \u041b\u0438\u043a\u0432\u0438\u0434\u043d\u0438 \u0421\u0440\u0435\u0434\u0441\u0442\u0432\u0430", "Alfa-Likvidni-Sredstva"], ["106", "\u0414\u0424 \u0410\u0440\u043a\u0443\u0441 \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d", "DF-Arkus-Balansiran"], ["111", "\u0414\u0424 \u0410\u0440\u043a\u0443\u0441 \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u043d", "DF-Arkus-Dinamichen"], ["54", "\u0414\u0424 \u0410\u0441\u0442\u0440\u0430 \u041a\u0435\u0448", "DF-Astra-Kesh"], ["79", "\u0414\u0424 \u0410\u0441\u0442\u0440\u0430 \u041a\u043e\u043c\u043e\u0434\u0438\u0442\u0438", "DF-Astra-Komoditi"], ["80", "\u0414\u0424 \u0410\u0441\u0442\u0440\u0430 \u041f\u043b\u044e\u0441", "DF-Astra-Plyus"], ["122", "\u0414\u0424 \u0410\u0441\u0442\u0440\u0430 \u0415\u043d\u0435\u0440\u0434\u0436\u0438", "DF-Astra-Enerdzhi"], ["121", "\u0414\u0424 \u0410\u0441\u0442\u0440\u0430 \u0426\u0435\u043d\u043d\u0438 \u041c\u0435\u0442\u0430\u043b\u0438", "DF-Astra-Cenni-Metali"], ["34", "\u0414\u0424 \u0414\u0438 \u0412\u0438 \u0415\u0432\u0440\u043e\u0431\u043e\u043d\u0434", "DF-Di-Vi-Evrobond"], ["36", "\u0414\u0424 \u0414\u0438 \u0412\u0438 \u0425\u0430\u0440\u043c\u043e\u043d\u0438\u044f", "DF-Di-Vi-Harmoniya"], ["37", "\u0414\u0424 \u0414\u0438 \u0412\u0438 \u0414\u0438\u043d\u0430\u043c\u0438\u043a", "DF-Di-Vi-Dinamik"], ["40", "\u0414\u0424 \u0414\u0438 \u0412\u0438 \u0421\u044a\u043a\u0440\u043e\u0432\u0438\u0449\u0435", "DF-Di-Vi-Sykrovishte"], ["8", "\u0414\u0424 \u0414\u0421\u041a \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442", "DF-DSK-Standart"], ["9", "\u0414\u0424 \u0414\u0421\u041a \u0411\u0430\u043b\u0430\u043d\u0441", "DF-DSK-Balans"], ["10", "\u0414\u0424 \u0414\u0421\u041a \u0420\u0430\u0441\u0442\u0435\u0436", "DF-DSK-Rastezh"], ["67", "\u0414\u0424 \u0414\u0421\u041a \u0418\u043c\u043e\u0442\u0438", "DF-DSK-Imoti"], ["85", "\u0414\u0424 \u201e\u0414\u0421\u041a \u0415\u0432\u0440\u043e \u0410\u043a\u0442\u0438\u0432\u201d", "DF-DSK-Evro-Aktiv"], ["100", "\u0414\u0424 \u201c\u0414\u0421\u041a \u0421\u0422\u0410\u0411\u0418\u041b\u041d\u041e\u0421\u0422 - \u0415\u0412\u0420\u041e\u041f\u0415\u0419\u0421\u041a\u0418 \u0410\u041a\u0426\u0418\u0418\u201d", "DF-DSK-STABILNOST-EVROPEYSKI-AKCII"], ["107", "\u0414\u0424 \u201c\u0414\u0421\u041a \u0421\u0422\u0410\u0411\u0418\u041b\u041d\u041e\u0421\u0422 - \u041d\u0415\u041c\u0421\u041a\u0418 \u0410\u041a\u0426\u0418\u0418\u201d", "DF-DSK-STABILNOST-NEMSKI-AKCII"], ["105", "\u0414\u0424 \u201c\u0414\u0421\u041a \u0424\u041e\u041d\u0414 \u041d\u0410 \u041f\u0410\u0420\u0418\u0427\u041d\u0418\u042f \u041f\u0410\u0417\u0410\u0420 \u201d", "DF-DSK-FOND-NA-PARICHNIYA-PAZAR"], ["108", "\u0414\u0424 \u201c\u0414\u0421\u041a \u0424\u041e\u041d\u0414 \u041d\u0410 \u041f\u0410\u0420\u0418\u0427\u041d\u0418\u042f \u041f\u0410\u0417\u0410\u0420 \u0412 \u0415\u0412\u0420\u041e \u201d", "DF-DSK-FOND-NA-PARICHNIYA-PAZAR-V-EVRO"], ["109", "\u0414\u0424 \u201c\u0414\u0421\u041a \u0410\u041b\u0422\u0415\u0420\u041d\u0410\u0422\u0418\u0412\u0410\u201d", "DF-DSK-ALTERNATIVA"], ["135", "\u0414\u0424 \u201e\u0414\u0421\u041a \u0413\u043b\u043e\u0431\u0430\u043b\u043d\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438\u201d", "DF-DSK-Globalni-kompanii"], ["82", "\u0414\u0424 \u0415\u043a\u0441\u043f\u0430\u0442 \u0418\u043c\u044a\u0440\u0434\u0436\u0438\u043d\u0433 \u041c\u0430\u0440\u043a\u0435\u0442\u0441 \u0421\u0442\u043e\u043a\u0441", "DF-Ekspat-Imyrdzhing-Markets-Stoks"], ["83", "\u0414\u0424 \u0415\u043a\u0441\u043f\u0430\u0442 \u0413\u043b\u043e\u0443\u0431\u044a\u043b \u0415\u043a\u0443\u0438\u0442\u0438\u0441", "DF-Ekspat-Gloubyl-Ekuitis"], ["90", "\u0414\u0424 \u0415\u043a\u0441\u043f\u0430\u0442 \u0411\u043e\u043d\u0434\u0441", "DF-Ekspat-Bonds"], ["17", "\u0418\u0414 \u0415\u043b\u0430\u043d\u0430 \u0412\u0438\u0441\u043e\u043a\u043e\u0434\u043e\u0445\u043e\u0434\u0435\u043d \u0424\u043e\u043d\u0434", "ID-Elana-Visokodohoden-Fond"], ["15", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d \u0415\u0432\u0440\u043e \u0424\u043e\u043d\u0434", "DF-Elana-Balansiran-Evro-Fond"], ["16", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d \u0414\u043e\u043b\u0430\u0440 \u0424\u043e\u043d\u0434", "DF-Elana-Balansiran-Dolar-Fond"], ["42", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0424\u043e\u043d\u0434 \u0421\u0432\u043e\u0431\u043e\u0434\u043d\u0438 \u043f\u0430\u0440\u0438", "DF-Elana-Fond-Svobodni-pari"], ["87", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0415\u0432\u0440\u043e\u0444\u043e\u043d\u0434", "DF-Elana-Evrofond"], ["95", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0413\u043b\u043e\u0431\u0430\u043b\u0435\u043d \u0424\u043e\u043d\u0434 \u0410\u043a\u0446\u0438\u0438", "DF-Elana-Globalen-Fond-Akcii"], ["131", "\u0414\u0424 \u0415\u043b\u0430\u043d\u0430 \u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f", "DF-Elana-Bylgariya"], ["63", "\u0414\u0424 \u0415\u0424 \u041f\u0440\u0438\u043d\u0441\u0438\u043f\u0430\u043b", "DF-EF-Prinsipal"], ["74", "\u0414\u0424 \u0415\u0424 \u0420\u0430\u043f\u0438\u0434", "DF-EF-Rapid"], ["18", "\u0414\u0424 \u0417\u043b\u0430\u0442\u0435\u043d \u043b\u0435\u0432", "DF-Zlaten-lev"], ["65", "\u0414\u0424 \u0417\u043b\u0430\u0442\u0435\u043d \u043b\u0435\u0432 \u0418\u043d\u0434\u0435\u043a\u0441 30", "DF-Zlaten-lev-Indeks-30"], ["125", "\u0414\u0424 \u0413\u043b\u043e\u0431\u0430\u043b \u041e\u043f\u043e\u0440\u0442\u044e\u043d\u0438\u0442\u0438\u0441", "DF-Global-Oportyunitis"], ["110", "\u0414\u0424 \u0418\u043d\u0432\u0435\u0441\u0442 \u0424\u043e\u043d\u0434 \u041f\u0430\u0440\u0438\u0447\u0435\u043d \u041f\u0430\u0437\u0430\u0440", "DF-Invest-Fond-Parichen-Pazar"], ["126", "\u0414\u0424 \u0418\u043d\u0432\u0435\u0441\u0442 \u0424\u043e\u043d\u0434 \u041f\u0430\u0440\u0438\u0447\u0435\u043d \u041f\u0430\u0437\u0430\u0440 - \u0414\u043e\u043b\u0430\u0440\u0438", "DF-Invest-Fond-Parichen-Pazar-Dolari"], ["72", "\u0414\u0424 \u0418\u043d\u0432\u0435\u0441\u0442 \u0410\u043a\u0442\u0438\u0432", "DF-Invest-Aktiv"], ["56", "\u0414\u0424 \u0418\u043d\u0432\u0435\u0441\u0442 \u041a\u043b\u0430\u0441\u0438\u043a", "DF-Invest-Klasik"], ["96", "\u0414\u0424 \u041a\u0430\u043f\u043c\u0430\u043d \u0424\u0438\u043a\u0441", "DF-Kapman-Fiks"], ["19", "\u0414\u0424 \u041a\u0430\u043f\u043c\u0430\u043d \u041a\u0430\u043f\u0438\u0442\u0430\u043b", "DF-Kapman-Kapital"], ["20", "\u0414\u0424 \u041a\u0430\u043f\u043c\u0430\u043d \u041c\u0430\u043a\u0441", "DF-Kapman-Maks"], ["132", "\u0414\u0424 \u0421-\u041c\u0418\u041a\u0421", "DF-S-MIKS"], ["133", "\u0414\u0424 \u0421-\u0411\u041e\u041d\u0414\u0421", "DF-S-BONDS"], ["21", "\u0414\u0424 \u0410\u0434\u0432\u0430\u043d\u0441 \u0418\u043d\u0432\u0435\u0441\u0442", "DF-Advans-Invest"], ["22", "\u0414\u0424 \u0410\u0434\u0432\u0430\u043d\u0441 \u0418\u0437\u0442\u043e\u0447\u043d\u0430 \u0415\u0432\u0440\u043e\u043f\u0430", "DF-Advans-Iztochna-Evropa"], ["46", "\u0414\u0424 \u0410\u0434\u0432\u0430\u043d\u0441 \u0412\u044a\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 \u041d\u043e\u0432\u0430 \u0415\u0432\u0440\u043e\u043f\u0430", "DF-Advans-Vyzmozhnosti-v-Nova-Evropa"], ["101", "\u0414\u0424 \u0410\u0434\u0432\u0430\u043d\u0441 \u0413\u043b\u043e\u0431\u0430\u043b \u0422\u0440\u0435\u043d\u0434\u0441", "DF-Advans-Global-Trends"], ["104", "\u0414\u0424 \u0410\u0434\u0432\u0430\u043d\u0441 \u041a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u0435\u043d \u0424\u043e\u043d\u0434", "DF-Advans-Konservativen-Fond"], ["119", "\u0414\u0424 \u041a\u041e\u041c\u041f\u0410\u0421 \u0413\u041b\u041e\u0411\u042a\u041b \u0422\u0420\u0415\u041d\u0414\u0421", "DF-KOMPAS-GLOBYL-TRENDS"], ["61", "\u0414\u0424 \u041a\u041e\u041c\u041f\u0410\u0421 \u0415\u0412\u0420\u041e\u0421\u0422\u0410\u0411\u0418\u041b\u041d\u041e\u0421\u0422", "DF-KOMPAS-EVROSTABILNOST"], ["60", "\u0414\u0424 \u041a\u041e\u041c\u041f\u0410\u0421 \u0421\u0422\u0420\u0410\u0422\u0415\u0413\u0418\u042f", "DF-KOMPAS-STRATEGIYA"], ["62", "\u0414\u0424 \u041a\u041e\u041c\u041f\u0410\u0421 \u041f\u0420\u041e\u0413\u0420\u0415\u0421", "DF-KOMPAS-PROGRES"], ["1", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-1 \u0410\u043a\u0446\u0438\u0438 \u0438 \u041e\u0431\u043b\u0438\u0433\u0430\u0446\u0438\u0438", "DF-Konkord-Fond-1-Akcii-i-Obligacii"], ["2", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-2 \u0410\u043a\u0446\u0438\u0438", "DF-Konkord-Fond-2-Akcii"], ["4", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-3 \u0421\u0435\u043a\u0442\u043e\u0440 \u041d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u0438 \u0418\u043c\u043e\u0442\u0438", "DF-Konkord-Fond-3-Sektor-Nedvizhimi-Imoti"], ["51", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-4 \u0415\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u043a\u0430", "DF-Konkord-Fond-4-Energetika"], ["66", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-5 \u0426\u0418\u0415", "DF-Konkord-Fond-5-CIE"], ["57", "\u0414\u0424 \u041a\u043e\u043d\u043a\u043e\u0440\u0434 \u0424\u043e\u043d\u0434-6 \u041f\u0430\u0440\u0438\u0447\u0435\u043d", "DF-Konkord-Fond-6-Parichen"], ["30", "\u0414\u0424 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0418\u043d\u0432. \u0412\u0438\u0441\u043e\u043a\u043e\u0434\u043e\u0445\u043e\u0434\u0435\u043d \u0424\u043e\u043d\u0434", "DF-Standart-Inv-Visokodohoden-Fond"], ["29", "\u0414\u0424 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0418\u043d\u0432. \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d \u0424\u043e\u043d\u0434", "DF-Standart-Inv-Balansiran-Fond"], ["31", "\u0414\u0424 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0418\u043d\u0432. \u041c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u0435\u043d \u0424\u043e\u043d\u0434", "DF-Standart-Inv-Mezhdunaroden-Fond"], ["26", "\u0414\u0424 \u041e\u0411\u0411 \u041f\u043b\u0430\u0442\u0438\u043d\u0443\u043c \u041e\u0431\u043b\u0438\u0433\u0430\u0446\u0438\u0438", "DF-OBB-Platinum-Obligacii"], ["27", "\u0414\u0424 \u041e\u0411\u0411 \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d \u0424\u043e\u043d\u0434", "DF-OBB-Balansiran-Fond"], ["28", "\u0414\u0424 \u041e\u0411\u0411 \u041f\u0440\u0435\u043c\u0438\u0443\u043c \u0410\u043a\u0446\u0438\u0438", "DF-OBB-Premium-Akcii"], ["84", "\u0414\u0424 \u041e\u0411\u0411 \u041f\u0430\u0442\u0440\u0438\u043c\u043e\u043d\u0438\u0443\u043c \u0417\u0435\u043c\u044f", "DF-OBB-Patrimonium-Zemya"], ["98", "\u0414\u0424 \u041e\u0411\u0411 \u0413\u043b\u043e\u0431\u0430\u043b \u0424\u0430\u0440\u043c \u0418\u043d\u0432\u0435\u0441\u0442", "DF-OBB-Global-Farm-Invest"], ["99", "\u0414\u0424 \u041e\u0411\u0411 \u0415\u0432\u0440\u043e \u041f\u0430\u0440\u0438", "DF-OBB-Evro-Pari"], ["127", "\u041e\u0411\u0411 \u0413\u043b\u043e\u0431\u0430\u043b \u0414\u0435\u0442\u0441\u043a\u0438 \u0424\u043e\u043d\u0434", "OBB-Global-Detski-Fond"], ["129", "\u041e\u0411\u0411 \u0413\u043b\u043e\u0431\u0430\u043b \u0420\u0430\u0441\u0442\u0435\u0436", "OBB-Global-Rastezh"], ["130", "\u041e\u0411\u0411 \u0413\u043b\u043e\u0431\u0430\u043b \u0414\u0438\u0432\u0438\u0434\u0435\u043d\u0442", "OBB-Global-Divident"], ["43", "\u0414\u0424 \"\u041f\u0418\u0411- \u0410\u0432\u0430\u043d\u0433\u0430\u0440\u0434\"", "DF-PIB-Avangard"], ["45", "\u0414\u0424 \"\u041f\u0418\u0411- \u041a\u043b\u0430\u0441\u0438\u043a\"", "DF-PIB-Klasik"], ["44", "\u0414\u0424 \"\u041f\u0418\u0411- \u0413\u0430\u0440\u0430\u043d\u0442\"", "DF-PIB-Garant"], ["94", "\u0414\u0424 \u041f\u0424\u0411\u041a \u0412\u041e\u0421\u0422\u041e\u041a", "DF-PFBK-VOSTOK"], ["47", "\u0420\u0430\u0439\u0444\u0430\u0439\u0437\u0435\u043d \u041a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u0435\u043d \u0424\u043e\u043d\u0434 (\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f)", "Rayfayzen-Konservativen-Fond-Bylgariya"], ["3", "\u0420\u0430\u0439\u0444\u0430\u0439\u0437\u0435\u043d \"\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f\" \u0444\u043e\u043d\u0434 \u0413\u043b\u043e\u0431\u0430\u043b\u0435\u043d \u0420\u0430\u0441\u0442\u0435\u0436", "Rayfayzen-Bylgariya-fond-Globalen-Rastezh"], ["91", "\u0420\u0430\u0439\u0444\u0430\u0439\u0437\u0435\u043d (\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f) \u0410\u043a\u0442\u0438\u0432\u043d\u0430 \u0417\u0430\u0449\u0438\u0442\u0430", "Rayfayzen-Bylgariya-Aktivna-Zashtita"], ["128", "\u0414\u0424 \"\u0420\u0430\u0439\u0444\u0430\u0439\u0437\u0435\u043d (\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f) \u0413\u043b\u043e\u0431\u0430\u043b\u0435\u043d \u041c\u0438\u043a\u0441\"", "DF-Rayfayzen-Bylgariya-Globalen-Miks"], ["23", "\u0414\u0424 \u201e\u0421\u0435\u043b\u0435\u043a\u0442 \u041e\u0431\u043b\u0438\u0433\u0430\u0446\u0438\u0438\u201c", "DF-Selekt-Obligacii"], ["24", "\u0414\u0424 \u201e\u0421\u0435\u043b\u0435\u043a\u0442 \u0411\u0430\u043b\u0430\u043d\u0441\u201c", "DF-Selekt-Balans"], ["25", "\u0414\u0424 \u201e\u0421\u0435\u043b\u0435\u043a\u0442 \u0420\u0435\u0433\u0438\u043e\u043d\u0430\u043b\u201c", "DF-Selekt-Regional"], ["102", "\u0414\u0424 \u201e\u0421\u0435\u043b\u0435\u043a\u0442 \u0414\u0438\u0432\u0438\u0434\u0435\u043d\u0442\u201c", "DF-Selekt-Divident"], ["32", "\u0421\u041a\u0410\u0419 \u041d\u043e\u0432\u0438 \u0410\u043a\u0446\u0438\u0438", "SKAY-Novi-Akcii"], ["33", "\u0421\u041a\u0410\u0419 \u0424\u0438\u043d\u0430\u043d\u0441\u0438", "SKAY-Finansi"], ["97", "\u0421\u041a\u0410\u0419 \u0413\u043b\u043e\u0431\u0430\u043b ETFs", "SKAY-Global-ETFs"], ["48", "\u0414\u0424 \u041f\u0440\u043e\u0444\u0438\u0442", "DF-Profit"], ["49", "\u0414\u0424 \u041f\u0440\u0435\u0441\u0442\u0438\u0436", "DF-Prestizh"], ["5", "\u0414\u0424 \u0422\u0435\u043a\u0441\u0438\u043c \u041f\u0430\u0440\u0438\u0447\u043d\u0438 \u041f\u0430\u0437\u0430\u0440\u0438", "DF-Teksim-Parichni-Pazari"], ["6", "\u0414\u0424 \u0422\u0435\u043a\u0441\u0438\u043c \u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f", "DF-Teksim-Bylgariya"], ["39", "\u0414\u0424 \u0422\u0435\u043a\u0441\u0438\u043c \u0411\u0430\u043b\u043a\u0430\u043d\u0438", "DF-Teksim-Balkani"], ["59", "\u0414\u0424 \u0422\u0435\u043a\u0441\u0438\u043c \u041a\u043e\u043c\u043e\u0434\u0438\u0442\u0438 \u0421\u0442\u0440\u0430\u0442\u0435\u0434\u0436\u0438", "DF-Teksim-Komoditi-Stratedzhi"], ["78", "\u0422\u0440\u0435\u043d\u0434 \u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0430\u043d \u0424\u043e\u043d\u0434", "Trend-Balansiran-Fond"], ["81", "\u0422\u0440\u0435\u043d\u0434 \u0424\u043e\u043d\u0434 \u0410\u043a\u0446\u0438\u0438", "Trend-Fond-Akcii"], ["103", "\u0422\u0440\u0435\u043d\u0434 \u0424\u043e\u043d\u0434 \u041f\u0430\u0440\u0438\u0447\u0435\u043d \u041f\u0430\u0437\u0430\u0440", "Trend-Fond-Parichen-Pazar"], ["55", "\u0426\u041a\u0411 \u041b\u0438\u0434\u0435\u0440", "CKB-Lider"], ["75", "\u0426\u041a\u0411 \u0410\u043a\u0442\u0438\u0432", "CKB-Aktiv"], ["76", "\u0426\u041a\u0411 \u0413\u0430\u0440\u0430\u043d\u0442", "CKB-Garant"], ["116", "\u0414\u0424 \u042e\u0433 \u041c\u0430\u0440\u043a\u0435\u0442 \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c", "DF-YUg-Market-Maksimum"], ["117", "\u0414\u0424 \"\u042e\u0433 \u041c\u0430\u0440\u043a\u0435\u0442 \u041e\u043f\u0442\u0438\u043c\u0443\u043c\"", "DF-YUg-Market-Optimum"]] \ No newline at end of file diff --git a/website/index.html b/website/index.html index 3c8086a..b161328 100644 --- a/website/index.html +++ b/website/index.html @@ -2,9 +2,39 @@ Договорни фондове - графики + +
@@ -55,12 +85,15 @@ +
За контакти: Иван Давидов
- + - \ No newline at end of file + From 473274404b10824a4c57e8393c88349cac3e774e Mon Sep 17 00:00:00 2001 From: Snail Mail <> Date: Fri, 14 Apr 2017 21:08:07 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D1=81=D1=80=D0=B0=D0=B2=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D0=B4=D0=BE=D1=85=D0=BE=D0=B4=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=82=D0=B0=20=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B8=D0=B7=D0=B2=D0=BE=D0=BB=D0=BD=D0=BE=20=D0=B8=D0=B7=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=20=D1=84=D0=BE=D0=BD=D0=B4=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/compare.html | 106 +++++++++++++++++++++++++++++++++++++++++++ website/index.html | 2 +- website/js/main.js | 42 ++++++++++++++++- 3 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 website/compare.html diff --git a/website/compare.html b/website/compare.html new file mode 100644 index 0000000..c4deac9 --- /dev/null +++ b/website/compare.html @@ -0,0 +1,106 @@ + + + + Сравняване на фондове + + + + + + + + +
+
+ Фонд: + + Дялове +
+ За контакти: Иван Давидов +
+
+
+
+ + + diff --git a/website/index.html b/website/index.html index b161328..ea05709 100644 --- a/website/index.html +++ b/website/index.html @@ -85,7 +85,7 @@ - + Сравняване
За контакти: Иван Давидов
diff --git a/website/js/main.js b/website/js/main.js index abf6656..0cf33b9 100644 --- a/website/js/main.js +++ b/website/js/main.js @@ -58,4 +58,44 @@ function generateMenu(fundId, fundName) { aw.href = 'data/' + fundId + '-sedmichni-danni.csv'; aw.download = fundId + '-sedmichni-danni.csv'; li3.appendChild(aw); -} \ No newline at end of file +} + +function parse_csv(content, row_handler) { + //console.log('parse_csv', content.indexOf("\n")) + var i = 0; + do { + var nl_pos = content.indexOf("\n", i); + var line = nl_pos == -1 ? content.substr(i) : content.substr(i, nl_pos-i); + if (i > 0 && line.length) {//skip header + var row = line.split(',') + //console.log('line ' + row); + row_handler(row) + } + i = nl_pos + 1; + } while(nl_pos != -1) +} + +function load_csv(url, done) { + jQuery.ajax({url:url, mimeType: 'text/csv', success: done}) +} + +function override_json(xhr){ + //prevents xml parse error in firefox when loaded locally (file://..) + if (xhr.overrideMimeType) + xhr.overrideMimeType("application/json"); +} + +function add_trace(csv_url, name) { + var chart = $('#chart2')[0] + load_csv(csv_url, function(csv){ + var dates = [], prices = []; + parse_csv(csv, function(row){dates.push(row[4]); prices.push(+row[6])}); + //console.log(dates) + console.log(prices); + //lines.push({x:dates,y:prices}) + //Plotly.newPlot(document.getElementById('chart'), lines) + // Plotly.newPlot(document.getElementById('chart'), [{x:dates,y:prices}]) + Plotly.addTraces(chart, {x:dates,y:prices,name:name}); + align_chart(); + }) +}