{ "metadata": { "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.9.0-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python3", "display_name": "Python 3.9.0 64-bit", "metadata": { "interpreter": { "hash": "36cf16204b8548560b1c020c4e8fb5b57f0e4c58016f52f2d4be01e192833930" } } } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: tqdm in /home/anson/.local/lib/python3.8/site-packages (4.59.0)\n" ] } ], "source": [ "!pip install tqdm" ] }, { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [], "source": [ "import requests as r\n", "import pandas as pd\n", "from fuzzywuzzy import fuzz\n", "from functools import cache\n", "from tqdm import tqdm" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [], "source": [ " def stocks():\n", "\n", " raw_symbols = r.get(\n", " f\"https://cloud.iexapis.com/stable/ref-data/symbols?token=WOOOPS\"\n", " ).json()\n", " symbols = pd.DataFrame(data=raw_symbols)\n", "\n", " symbols[\"description\"] = \"$\" + symbols[\"symbol\"] + \": \" + symbols[\"name\"]\n", " symbols[\"id\"] = symbols[\"symbol\"]\n", "\n", " symbols = symbols[[\"id\", \"symbol\", \"name\", \"description\"]]\n", "\n", " return symbols\n", "\n", "\n", "\n", " def coins():\n", "\n", " raw_symbols = r.get(\"https://api.coingecko.com/api/v3/coins/list\").json()\n", " symbols = pd.DataFrame(data=raw_symbols)\n", "\n", " symbols[\"description\"] = \"$$\" + symbols[\"symbol\"] + \": \" + symbols[\"name\"]\n", " symbols = symbols[[\"id\", \"symbol\", \"name\", \"description\"]]\n", "\n", " return symbols" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " id symbol \\\n", "0 A A \n", "1 AA AA \n", "2 AAA AAA \n", "3 AAAU AAAU \n", "4 AAC AAC \n", "... ... ... \n", "6565 zyro zyro \n", "6566 zytara-dollar zusd \n", "6567 zyx zyx \n", "6568 zzz-finance zzz \n", "6569 zzz-finance-v2 zzzv2 \n", "\n", " name \\\n", "0 Agilent Technologies Inc. \n", "1 Alcoa Corp \n", "2 Listed Funds Trust - AAF First Priority CLO Bo... \n", "3 Goldman Sachs Physical Gold ETF Shares - Goldm... \n", "4 Ares Acquisition Corporation - Class A \n", "... ... \n", "6565 Zyro \n", "6566 Zytara Dollar \n", "6567 ZYX \n", "6568 zzz.finance \n", "6569 zzz.finance v2 \n", "\n", " description \n", "0 $A: Agilent Technologies Inc. \n", "1 $AA: Alcoa Corp \n", "2 $AAA: Listed Funds Trust - AAF First Priority ... \n", "3 $AAAU: Goldman Sachs Physical Gold ETF Shares ... \n", "4 $AAC: Ares Acquisition Corporation - Class A \n", "... ... \n", "6565 $$zyro: Zyro \n", "6566 $$zusd: Zytara Dollar \n", "6567 $$zyx: ZYX \n", "6568 $$zzz: zzz.finance \n", "6569 $$zzzv2: zzz.finance v2 \n", "\n", "[16946 rows x 4 columns]" ], "text/html": "
\n | id | \nsymbol | \nname | \ndescription | \n
---|---|---|---|---|
0 | \nA | \nA | \nAgilent Technologies Inc. | \n$A: Agilent Technologies Inc. | \n
1 | \nAA | \nAA | \nAlcoa Corp | \n$AA: Alcoa Corp | \n
2 | \nAAA | \nAAA | \nListed Funds Trust - AAF First Priority CLO Bo... | \n$AAA: Listed Funds Trust - AAF First Priority ... | \n
3 | \nAAAU | \nAAAU | \nGoldman Sachs Physical Gold ETF Shares - Goldm... | \n$AAAU: Goldman Sachs Physical Gold ETF Shares ... | \n
4 | \nAAC | \nAAC | \nAres Acquisition Corporation - Class A | \n$AAC: Ares Acquisition Corporation - Class A | \n
... | \n... | \n... | \n... | \n... | \n
6565 | \nzyro | \nzyro | \nZyro | \n$$zyro: Zyro | \n
6566 | \nzytara-dollar | \nzusd | \nZytara Dollar | \n$$zusd: Zytara Dollar | \n
6567 | \nzyx | \nzyx | \nZYX | \n$$zyx: ZYX | \n
6568 | \nzzz-finance | \nzzz | \nzzz.finance | \n$$zzz: zzz.finance | \n
6569 | \nzzz-finance-v2 | \nzzzv2 | \nzzz.finance v2 | \n$$zzzv2: zzz.finance v2 | \n
16946 rows × 4 columns
\n