{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Лабораторная работа 1\n",
    "Мониторинг акций Ямана Голд Инк"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: xlabel='Date', ylabel='Volume'>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 29480 characters]",
      "text/plain": [
       "<Figure size 3000x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from datetime import date\n",
    "\n",
    "df = pd.read_csv(\".//static//csv//Yamana_Gold_Inc._AUY.csv\")\n",
    "\n",
    "viborka = df.groupby(df.index // 500).head(1)\n",
    "viborka.plot.scatter(x=\"Date\", y=\"Volume\", figsize=(30, 4))\n",
    "# Диаграмма объема каждые 2 года:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 84064 characters]",
      "text/plain": [
       "<Figure size 1500x1500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_subset = df.groupby(df.index // 1000).head(1)\n",
    "\n",
    "value_counts = df_subset['Volume'].value_counts()\n",
    "year = df_subset[\"Date\"]\n",
    "\n",
    "plt.figure(figsize=(15, 15))\n",
    "plt.pie(\n",
    "    df_subset[\"Volume\"],\n",
    "    labels= df_subset[\"Date\"], # type: ignore\n",
    "    autopct=\"%1.1f%%\", rotatelabels=True\n",
    ")\n",
    "plt.show()\n",
    "#Сравнение объема продаж каждые 4 года:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: xlabel='Date'>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 47012 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sqlite3 import Date\n",
    "\n",
    "#Цены открытия и закрытия за последние 5 дней\n",
    "df.tail(5).plot(x=\"Date\", y=[\"Open\", \"Close\"])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "aisenv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
