{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "7075dca8-7af9-4d23-af98-673deed9a15d", "metadata": {}, "outputs": [], "source": [ "#!pip install yfinance" ] }, { "cell_type": "code", "execution_count": 1, "id": "0cd03d32-0109-444e-8acf-71b9d274c664", "metadata": {}, "outputs": [], "source": [ "import yfinance as yf" ] }, { "cell_type": "code", "execution_count": 6, "id": "b93e219d-d30a-409b-abb8-557506ee897d", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[*********************100%***********************] 1 of 1 completed" ] }, { "name": "stdout", "output_type": "stream", "text": [ " Open High Low Close Adj Close Volume\n", "Date \n", "2020-01-02 1555.0 1555.0 1490.0 1495.0 835.632202 76612000\n", "2020-01-03 1460.0 1470.0 1425.0 1465.0 856.372375 117795600\n", "2020-01-06 1455.0 1515.0 1450.0 1465.0 856.372375 61423200\n", "2020-01-07 1480.0 1540.0 1460.0 1540.0 900.213867 74336500\n", "2020-01-08 1530.0 1535.0 1505.0 1505.0 879.754395 55121100\n", "... ... ... ... ... ... ...\n", "2024-09-23 3720.0 3740.0 3690.0 3700.0 3700.000000 70067100\n", "2024-09-24 3730.0 3760.0 3690.0 3740.0 3740.000000 111192200\n", "2024-09-25 3760.0 3760.0 3680.0 3690.0 3690.000000 75405400\n", "2024-09-26 3720.0 3780.0 3700.0 3780.0 3780.000000 76548100\n", "2024-09-27 3780.0 3940.0 3740.0 3910.0 3910.000000 121060900\n", "\n", "[1148 rows x 6 columns]\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "# Mendownload data saham\n", "data = yf.download(\"ADRO.JK\", start=\"2020-01-01\", end=\"2024-09-30\")\n", "print(data)" ] }, { "cell_type": "code", "execution_count": 7, "id": "5166ea97-1a80-430c-9d63-aae43503f363", "metadata": {}, "outputs": [], "source": [ "data.to_csv('PT Adaro Energy Indonesia Tbk_2020-2024.csv')" ] }, { "cell_type": "code", "execution_count": 9, "id": "d48de37b-0ff9-459c-a214-c7efffeed321", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[*********************100%***********************] 1 of 1 completed" ] }, { "name": "stdout", "output_type": "stream", "text": [ " Open High Low Close Adj Close Volume\n", "Date \n", "2020-01-02 1360.0 1435.0 1360.0 1435.0 1435.0 5000\n", "2020-01-03 1435.0 1435.0 1435.0 1435.0 1435.0 0\n", "2020-01-06 1437.5 1437.5 1435.0 1435.0 1435.0 3000\n", "2020-01-07 1435.0 1435.0 1435.0 1435.0 1435.0 0\n", "2020-01-08 1435.0 1435.0 1435.0 1435.0 1435.0 0\n", "... ... ... ... ... ... ...\n", "2024-09-23 41300.0 41575.0 41000.0 41500.0 41500.0 2201800\n", "2024-09-24 41550.0 42150.0 41025.0 41075.0 41075.0 2311300\n", "2024-09-25 41075.0 41250.0 40250.0 41050.0 41050.0 2263200\n", "2024-09-26 41000.0 42000.0 40925.0 41550.0 41550.0 2214700\n", "2024-09-27 41675.0 42000.0 41050.0 41525.0 41525.0 2261300\n", "\n", "[1148 rows x 6 columns]\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "data2 = yf.download(\"DSSA.JK\", start=\"2020-01-01\", end=\"2024-09-30\")\n", "print(data2)" ] }, { "cell_type": "code", "execution_count": 10, "id": "44b196c7-a29d-4ee5-aaea-405f1e0d8dfc", "metadata": {}, "outputs": [], "source": [ "data2.to_csv('PT Dian Swastatika Sentosa Tbk_2020-2024.csv')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.3" } }, "nbformat": 4, "nbformat_minor": 5 }