top of page

Search Results

58 results found with an empty search

  • Scrapping Oil related articles | Akweidata

    < Back Scrapping Oil related articles Run on python via GoogleCollab # Install and set up necessary packages and dependencies !pip install selenium !apt-get update !apt install chromium-chromedriver import sys sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') from selenium import webdriver from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup import pandas as pd # Set up Chrome options for Selenium chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') # Initialize the Chrome WebDriver with the specified options driver = webdriver.Chrome(options=chrome_options) # Fetch the Web Page url = 'https://news.google.com/search?q=oil%20prices' driver.get(url) # Get the page source and close the browser html = driver.page_source driver.quit() # Parse the Web Page using BeautifulSoup soup = BeautifulSoup(html, 'html.parser') articles = soup.find_all('article') # Extract the Necessary Information news_data = [] base_url = 'https://news.google.com' for article in articles: # Extracting the title and link title_link_element = article.find('a', class_='JtKRv', href=True) title = title_link_element.text.strip() if title_link_element else "No Title" link = base_url + title_link_element['href'][1:] if title_link_element else "No Link" # Extracting the date time_element = article.find('time') date = time_element['datetime'] if time_element and 'datetime' in time_element.attrs else time_element.text.strip() if time_element else "No Date" news_data.append([title, link, date]) # Store the Data in a DataFrame df = pd.DataFrame(news_data, columns=['Title', 'Link', 'Date']) csv_file = 'google_news_oil_prices.csv' df.to_csv(csv_file, index=False) # Download the file to your computer (only works in Google Colab) try: from google.colab import files files.download(csv_file) except ImportError: print("The files module is not available. This code is not running in Google Colab.") Future Projects: Relation of frequency of Oil related posts and sustainability risks Relation of frequency of Oil related posts and Stock Prices (General & Oil producing/intensive firms) Updated Code # Install and set up necessary packages and dependencies !pip install selenium !apt-get update !apt install chromium-chromedriver import sys sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup import pandas as pd import time from datetime import datetime, timedelta import re # Function to convert various date formats to a standardized format def convert_relative_date(text): current_datetime = datetime.now() current_year = current_datetime.year if 'hour' in text or 'hours' in text: return current_datetime.strftime('%Y-%m-%d') elif 'day' in text or 'days' in text: match = re.search(r'\d+', text) days_ago = int(match.group()) if match else 0 return (current_datetime - timedelta(days=days_ago)).strftime('%Y-%m-%d') elif 'minute' in text or 'minutes' in text: return current_datetime.strftime('%Y-%m-%d') elif 'yesterday' in text.lower(): return (current_datetime - timedelta(days=1)).strftime('%Y-%m-%d') else: try: parsed_date = datetime.strptime(text, '%b %d') return datetime(current_year, parsed_date.month, parsed_date.day).strftime('%Y-%m-%d') except ValueError: return text # Return the original text if parsing fails # Set up Chrome options for Selenium chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') # Initialize the Chrome WebDriver with the specified options driver = webdriver.Chrome(options=chrome_options) # Fetch the Web Page url = 'https://news.google.com/search?q=oil%20prices' driver.get(url) # Scroll the page to load more articles for _ in range(5): # Adjust the range for more or fewer scrolls driver.find_element(By.TAG_NAME, 'body').send_keys(Keys.END) time.sleep(2) # Wait for page to load # Get the page source and close the browser html = driver.page_source driver.quit() # Parse the Web Page using BeautifulSoup soup = BeautifulSoup(html, 'html.parser') articles = soup.find_all('article') # Extract the Necessary Information news_data = [] base_url = 'https://news.google.com' for article in articles: title_link_element = article.find('a', class_='JtKRv', href=True) title = title_link_element.text.strip() if title_link_element else "No Title" link = base_url + title_link_element['href'][1:] if title_link_element else "No Link" time_element = article.find('time') date = time_element.text.strip() if time_element else "No Date" news_data.append([title, link, date]) # Store the Data in a DataFrame df = pd.DataFrame(news_data, columns=['Title', 'Link', 'Date']) # Convert dates to a standardized format for i, row in df.iterrows(): df.at[i, 'Date'] = convert_relative_date(row['Date']) # Save the DataFrame to CSV csv_file = 'google_news_oil_prices.csv' df.to_csv(csv_file, index=False) # Download the file to your computer (only works in Google Colab) try: from google.colab import files files.download(csv_file) except ImportError: print("The files module is not available. This code is not running in Google Colab.") Previous Next

  • Financial Performance of Ghana's political regimes from 1960 - 2000 | Akweidata

    < Back Financial Performance of Ghana's political regimes from 1960 - 2000 Analysis of Economic Growth in Ghana, 1960 – 2000 – ARYEETEY & FOSU "Economic Growth in Ghana, 1960 - 2000" by Ernest Aryeetey and Augustin Kwasi Fosu examines the fluctuating economic growth in Ghana over four decades, marked by frequent policy changes and military coups. The study highlights the transition of Ghana's economy and its impact on the livelihoods of its citizens. Period Key Factors Impact on Growth Post-Independence (1960-1965) Kwame Nkrumah implemented his 7-year Plan, emphasizing high investments into public infrastructure and industry creation. The economy grew rapidly due to the investments, but the high government spending led to inflation and a decline in living standards. Busia and the Military (1966-1971) Busia and the military regime ushered pro-private capital policies, devaluing the Ghanaian Cedi and liberalizing the external sector. The economy initially grew due to the pro-business policies, but the devaluation of the cedi caused inflation and public anger, leading to another coup d'état. The Era of Five Regimes (1972-1983) This period was marked by economic decline due to high government intervention policies, low productivity, and external shocks such as drought and food shortages. The economy contracted significantly during this period, with GDP growth averaging only 2.2% per year. Inflation soared to 112% in 1983, and the government deficit reached 17% of GDP. After the Economic Reforms (1984-2000) The government launched the Economy Recovery Program (ERP) under the World Bank and the IMF, which liberalized the economy and led to increased growth. The ERP helped to stabilize the economy and promote growth, with GDP growth averaging 5.3% per year during this period. Inflation fell from 112% in 1983 to 10% in 1992, and the government deficit was reduced to 4% of GDP. Previous Next

  • SustainabilityV4 | Akweidata

    Profit is the only Green : Visualization of Swiss Stocks & SRI portfolios Sustainability BY SEAN AKWEI ANUM Abstract Socially Responsible Investing (SRI), which is increasingly popular, emphasizes social and environmental factors in investment decisions to promote sustainability. In theory, SRI outperforms, especially in the long run. While practitioners typically remain skeptical, this unique return-based sustainability assessment of Swiss Stocks demonstrates SRI’s over performance and ability to promote sustainability. Research Question Is SRI a significant means of promoting Sustainability? Sustainability, per the 1987 United Nations Brundtland Commission, means meeting present needs without compromising future generations, involving social, economic, and environmental aspects. In investments, it translates to SRI, blending social and environmental factors into investment decisions. This project seeks to quantitatively depict these sustainability dimensions for stocks and SRI portfolios on the SIX (Swiss Stock Exchange). Methodology Data Proxies The data required deals with the three sustainability parameters for each stock on the Swiss Exchange: Environmental, Social and Economic. Company Name Environmental Score Social Score Economic Score The Quantitative proxies are as follows: 1. Environmental: An ESG rating with a numeric individual score (pillar) for a firm’s environmental impact; 2. Social: An ESG rating with a numeric individual score for a firm’s Social impact; 3. Economic: a risk-adjusted measure of the firm’s expected return: Capital Asset Pricing Model (CAPM) Visualizing Three Parameters A 3D plot was chosen to visualize three quantitative parameters, effectively showing their relationship and intersections. Stocks with high environmental, social, and economic scores are classified as “Sustainable,” while those with low scores are deemed “At Risk.” Stocks with scores between these extremes are categorized as “Acceptable.” The final visualization seeks to visualize the relative distribution of individual stocks & SRI portfolios regarding the three parameters. Hence, a standardized score for each parameter was used. The logic was to ensure that all parameters could be drawn down to a somewhat “equal” scale, thus ensuring an informative visual effect. Constructing SRI Portfolios Using the collected individual stock data, four SRI funds were created: Negative Screening: This SRI fund excludes investments in companies or sectors that do not meet specific ethical, environmental, or social criteria. Best in class: This fund selects companies that outperform their peers in environmental, social, and governance (ESG) criteria within each sector. Thematic Approach: This fund focuses on specific sustainability themes or sectors, such as renewable energy or social justice. ESG integration: This fund incorporates ESG factors into traditional financial analysis to identify risks and opportunities not captured by conventional methods. Data Sources Data was collected for each of the three parameters. Data was attained via the Thompson Reuters financial market portal Refinitiv Eikon. Environmental Pillar Score (ESG rating) Measures a company’s impact on living and non-living natural systems, including the air, land and water, as well as complete ecosystems. Social Pillar Score (ESG Rating) Measures a company’s capacity to generate trust and loyalty with its workforce, customers and society through its use of best management practices. Economic Pillar Score ( Beta) A measure of how much the stock moves for a given move in the market. Note, the Economic score was further computed with the Capital Asset Pricing Model (CAPM), which is CAPM = Risk-free rate+Beta*(Risk Premium), where risk-free rate and risk premium in Switzerland is 1.135% Source: World Government Bonds and 5.5% Source: NYU respectively. Data was collected based on completeness. As such, despite the SIX listing 250 stocks, the project at hand uses 187. One stock, IGEA Pharma NV, was excluded as it was an extremely negative outlier that terribly affected the scale of the entire visualization. Constructing “Sustainable” and “At Risk Criteria” The Sustainability Criterion was defined as Environmental Score ≥ 70 (out of 100), Social ≥ 70 (out of 100); and Economic score ≥ 6.64% (Average Market Return). Consequently, the standardized scores were 1.05, 0.83 and 0, respectively. At Risk Criterion was defined as : Environmental Score ≤ 30 (out of 100); Social ≤ 30; and Economic score ≤ 3.34% (one standard deviation below Market Average Return). Consequently, the standardized scores were -0.30, -0.68 and -1 respectively. Conditions are based on core financial theories. Data for SRI Portfolios Regarding the Negative Screening and Best in Class Approach, using the ESG data collected, I easily constructed said portfolios. However, for the Thematic Approach and ESG integration, I replicated existing funds employing these strategies. They are the “Ethos Swiss Governance Index Large” and the “ETHOS II - Ethos Swiss Sustainable Equities -A” respectively. Final Visualization The graph is interactive. Average-sized points represent a stock on the Swiss Exchange. The bigger Orange points represent SRI portfolios, and the Big Black point represents the Market Average. Results and Conclusion Market’s Performance The sustainability cuboid includes 11% of stocks and three-quarters of SRI strategies, whereas the at-risk quadrant contains 6% of stocks. The general market performance is deemed acceptable, with many stocks nearing the Sustainability cuboid. Despite needing substantial progress, these findings indicate a promising trend towards sustainability in the Swiss Stock Market. SRI Performances To answer the Research Question, SRI funds appear to promote sustainability. This is supported by the visualization showing 3 out of 4 strategies as sustainable. Contrary to expectations, “ESG Integration” is the only strategy classified as non-sustainable. In theory, the best strategy should be “ESG integration”, whereas the other three are seen as simplistic and lacking a nuanced ESG assessment concerning market returns. My paradoxical result likely arises because, unlike simpler strategies, “ESG Integration” involves more subjective and active management, leading to significant performance variations among different managers. Testing this hypothesis with another fund using “ESG Integration” yielded a “Sustainable result”, highlighting the classic debate between active and passive management but now within SRI. Concluding Remarks Ironically, firms with controversial reputations like Nestle, UBS, and Credit Suisse have good non-economic scores, while Cantonal banks unexpectedly show low scores. This raises questions about how these public entities might be causing more social and environmental harm and calls for a deeper examination of the legitimacy of ESG scores.

  • Manipulating File Paths: Backward to Foward Slashes | Akweidata

    < Back Manipulating File Paths: Backward to Foward Slashes A program made to convert backward slashes in file path names to foward slashes. Targeted for Windows users when copying paths to R or Pthon. Previous Next

  • Scrapping Data using Python | Akweidata

    < Back Scrapping Data using Python A Python application designed to generate a histogram depicting the frequency of articles published on Google News in 2022 concerning '@celebjets'. Background Created by then teenager Jack Sweeny in 2020, @celebjets (now suspended) was a twitter account that tracked the location of celebrities' jets. The account gained worldwide notoriety through 2021 and 2022 mainly due to Jack Sweeny's altercation with Elon Musk regarding privacy and safety concerns with tracking Elon's Jet. But more importantly the posts from the account brought to light conversations on the 'vanity-filled' lifestyle of celebrities and the significant CO2 footprints they leave with their obnoxious use of private jets. Problem Formulation, Decomposition and Abstraction With the given prompt at hand, we need to exhaustively understand the problem space in order to efficiently and effectively move from the undesired to the desired state of affairs. The problem at hand is not monolithic, thus, we need to break it down before conceptualizing any solutions. Breaking down the problem requires the employment of the Computational Thinking concept known as Decomposition . By separating the problem at hand into sub-problems, the task becomes more approachable as one is quickly able to see how possible conceptual frameworks (in the form of existing python commands) can be employed and knitted to solve the problem. However, before diving into decomposition, we need to understand that the prompt does not encapsulate the entire problem space. Key components of the problem space deal with the nature of the file news-celebjets.txt. How is the data organized? Where are the dates stated? What is the format of the dates? How can we work with this format? Thus, I ran the html code and manually viewed a sample (the first ten) of the articles to attain a brief idea of the nature of the data. My findings were as follows: The data is not primary but secondary data: some analysis has already been made. Data is very well structured: Article Cover Picture; Logo and name of Publisher; Title of Article (Hyperlinked); The Date List of Articles appears to consistently follow the structure stated above. The dates appear to have the same format through out: Month and day; example: Dec 14 Intuitively, from my findings, I have already applied the Computational Thinking concept of Patterns and Generalizations. By identifying the repeated structure of the list of articles, I wondered, can loops or some other iterative command assist me with extracting the dates? With these insights at hand, I attained a greater understanding of the problem space. Consequently, I employed the General to Specific decomposition technique The General to Specific technique involves breaking down a problem from a general perspective and then adding specific and more detailed components . For the given problem, as it is not open-ended and specific requirements were given, I found this technique to be the most appropriate. The results of my decomposition are as follows: General Problem: Analyze news articles and create a histogram representing the number of articles published per week Listed below with the alphabets a, b, c,d and e are the "definitions of the desired characteristics of the solution" = Subproblems . To address these charactersitics/subproblems, we need to get specific. Hence, below each Subproblem , listed in Roman numerals, are the specifications written in pseudocode . Note, that with the exception of subproblem "a" and c" , I relied heavily on Chatgpt to write out the specifics for the other subproblems as I had zero experience with the commands required. a. Read the scrapped data from the text file (news-celebjets.txt). b. Find the publishing dates of the news articles. c. Sort the publishing dates. e. Plot a histogram to represent the number of article count per week Figure 1: Abstraction Algorithmic Solution and the Agile Process An algorithm is a well-defined sequence of instructions that takes one or more input values and produces output values. Per the abstraction above, we have an idea of the desired solution's input, output and sequence of instructions. In the main.py file attached, I have generated a solution - pictured below in Figure 2. Following the decomposition phase's specifics, I have extensively commented throughout the lines of code on my reasoning and methods, which I shall not repeat here. Instead, in this section, I would comment on the role of Chatgpt in my Agile solution creation process. Figure 2: My Final Histogram Previous Next

  • Do Sustainable Funds in Switzerland outperform the Market? | Akweidata

    < Back Do Sustainable Funds in Switzerland outperform the Market? What is the performance of "sustainable" funds in relation to the market? Let's explore the case of the SIX Swiss Exchange Previous Next

  • Ghana Stock Exchange: Real-Time Prices Web App V1 | Akweidata

    < Back Ghana Stock Exchange: Real-Time Prices Web App V1 A basic web-application to find real time summaries of stocks on Ghana's Stock Exchange (GSE) This Web-app is fully powered by GSE-API: Ghana Stock Exchange API found on http://dev.kwayisi.org/ . Github: https://github.com/akweix/GSE_price_finder Listed Companies and their Tickers on GSE Previous Next

  • Sustainability Dimensions of Stocks on the SIX:Render 1 | Akweidata

    < Back Sustainability Dimensions of Stocks on the SIX:Render 1 Quantitatively assessing Brundtland's Dimensions (1987). The case of the SIX Previous Next

  • Prisoner's Dilemma: Player 2 | Akweidata

    < Back Prisoner's Dilemma: Player 2 Allowing users to participate in Robert Axelrod's 1980 Computer Tournament. Previous Next

  • Projects (All) | Akweidata

    Projects Alternative Data Regressor Framework: Draft 1 A framework for linear regression of alternative data against financial asset prices View Alternative Data Regressor Framework: Flow Chart A framework for linear regression of alternative data against financial asset prices - the flow chart View Alternative Data Regressor: V1 A Python Program to attain a linear regression of some alternative data against financial asset prices . A CSV file is the input. The output is the regression results. View Beta of Fan Milk Ltd (FML): Ghana Stock Exchange (GSE) Finding the Beta of FML on the GSE using Python (Jupyter Notebook) View Cocoa Production: Ghana and Ivory Coast - 2022 Summary of Cocoa Production in Ghana and Ivory Coast in 2022. View Cocoa Production: Ghana and Ivory Coast - Historic Trend Work in progress View Cocoa Production: West Africa - 2022 Work in progress View Commentary: Brexit could lead to recession, says Bank of England An economic commentary on the article "Brexit could lead to recession, says Bank of England" View Commentary: Ghana fixes new cocoa price to control smuggling An economic commentary on the Article, "Ghana fixes new cocoa price to control smuggling" View Commentary: Washington’s Decision to “Normalize” Relations with Cuba..." An economic commentary on the article "Washington’s Decision to “Normalize” Relations with Cuba: Impede China’s Growing Influence in Latin America" View Convering Excel to CSV: Web Application A basic Web application written in HTML and Javascript to convert excel files to CSV. View Data Visualization of the Dynamic Efficiency of Oil and Gas Production in Ghana A comprehensive tool for understanding the Real-time Efficiency of Oil and Gas production in Ghana View Do Sustainable Funds in Switzerland outperform the Market? What is the performance of "sustainable" funds in relation to the market? Let's explore the case of the SIX Swiss Exchange View Dynamic Forestry and Agricultural Summary of ECOWAS states Work in progress View Dynamic View of Ghana's Unemployment Investigating the trend and segmentation of employment in Ghana View Dynamic View of Trading Hours: SIX Swiss Exchange V1 Dynamic View of the opening and closing hours of the SIX Swiss Stock exchange for 2024. Additionally, current summary of the market's activity is stated. View Dynamic view of Ghana's Forestry Work in progress View Dynamic view of Ghana's Insurance Industry Work in progress View ESG Strategies: Passive and Active Management Do the laws of passive and active strategies also affect sustainability investing? View Electricity Consumption as a proxy of production: Draft 1 Using publicly available data on Swiss Power Consumption, this exploration seeks to identify an association with power consumption and select firms output View Expected Loss Calculator A simple tool to calculate the Expected Loss for a credit portfolio. View Financial Performance of Ghana's political regimes from 1960 - 2000 Analysis of Economic Growth in Ghana, 1960 – 2000 – ARYEETEY & FOSU View Fixed Deposits Offers in Ghana A simple directory that shows Fixed Deposit offers in Ghana View Game Theory: Prisoner's Dilemma Strategies Tools Recreating and Simulating Robert Axelrod's 1980 Computer Tournament. View Ghana Stock Exchange: Real-Time Prices Web App V1 A basic web-application to find real time summaries of stocks on Ghana's Stock Exchange (GSE) View Google News Scrapper Scrape Google News articles for a particulair keyword and date range View Hedonic Valuation Model: Real Estate in Zurich With significant portions of banks portfolios consisting of mortgage loans, it is paramount to develop a strong model for valuating real estate. View Hollywood Boulevard to Wall Street: Futurism in Movies and Tech-Stock Prices This study investigates the relationship between the box office sales of futurism-themed movies and the performance of the tech stock index. View How Much Time Do I have left? Visualizing and Quantifying our most valuable asset: "Time" View How much time do I have left? - Version 2 Visualizing and Quantifying our most valuable asset: "Time"; Version 2 View Implementing design thinking for efficiency in Ghana's public sector This research paper introduces a remedy for Ghana's weak public sector by exploring the implementation of Design Thinking into the sector's practices. View Initial margin requirement for Derivative Trading A simplified VaR-based approach to calculate the initial margin requirement for Derivative Trading View Is ignorance truly bliss? Investigating the link between the lack of general information and the conception of the economy in Ghana. Project from 2018 View Manipulating File Paths: Backward to Foward Slashes A program made to convert backward slashes in file path names to foward slashes. Targeted for Windows users when copying paths to R or Pthon. View Paradox of Choice and Utility Maximization: Music Traditional Asset Pricing models are conceptually based on utility maximization. However, what about the role of the quantity of choices in utility maximization? View Photography Tool: Black & White Conversion A basic photo editor to convert PNG pictures from color to Black and White View Plain Vanilla Bond Price Calculator A web application that takes the arguments of FV, Coupon Rate, YTM and Periods to price a Plain Vanilla Bond View Prisoner's Dilemma: Player 2 Allowing users to participate in Robert Axelrod's 1980 Computer Tournament. View Proving the Butterfly Effect Within the context of metreology and physics, we can explore the butterfly effect View Scrapping Data using Python A Python application designed to generate a histogram depicting the frequency of articles published on Google News in 2022 concerning '@celebjets'. View Scrapping Oil related articles Run on python via GoogleCollab View Smartphone App for University Students An all-purpose app for Ashesi students. Project from 2017 View Snapshot Macroeconomic Summary of ECOWAS States: 2022 As at the end of 2022, this is was the macroeconomic status of each ECOWAS state View Sustainability Dimensions of Stocks on the SIX:Render 1 Quantitatively assessing Brundtland's Dimensions (1987). The case of the SIX View Sustainability Dimensions of Stocks on the SIX:Render 2 Quantitatively assessing Brundtland's Dimensions (1987). The case of the SIX View Sustainability Dimensions of Stocks on the SIX:Render 3 Quantitatively assessing Brundtland's Dimensions (1987). The case of the SIX View The Solow Model and Human Capital in Developing Economies How can human capital enrichment lead to long-run economic growth? View Value at Risk (VaR) for a portfolio Simple Tool using a historical simulation to find VaR View Web scrapping Box Office Sales A python code used to web scrape data from Box Office Mojo's Website. View Web-Scrapper V1: Web Application Web Application for web-scrapping news articles View frankenstein.io - Draft 1 Restructuring & Simplifying "Frankenstein codes" View

bottom of page