273 lines
7.6 KiB
Plaintext
273 lines
7.6 KiB
Plaintext
|
|
{
|
|||
|
|
"cells": [
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": 32,
|
|||
|
|
"id": "68966247",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": [
|
|||
|
|
"import requests\n",
|
|||
|
|
"import pandas as pd\n",
|
|||
|
|
"import numpy as np\n",
|
|||
|
|
"import json\n",
|
|||
|
|
"import pandas as pd"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": null,
|
|||
|
|
"id": "02cd5305",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": [
|
|||
|
|
"### Extended Trades History ###\n",
|
|||
|
|
"candleType = 'trades'\n",
|
|||
|
|
"market = 'ETH-USD'\n",
|
|||
|
|
"params = {\n",
|
|||
|
|
" 'interval': \"1m\",\n",
|
|||
|
|
" 'limit': 100,\n",
|
|||
|
|
"}\n",
|
|||
|
|
"r = requests.get(f'https://api.starknet.extended.exchange/api/v1/info/candles/{market}/{candleType}', params=params)"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": 33,
|
|||
|
|
"id": "5603b04d",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": [
|
|||
|
|
"### Aster Trades History ###\n",
|
|||
|
|
"params = {\n",
|
|||
|
|
" 'symbol': \"ETHUSDT\",\n",
|
|||
|
|
" 'limit': 1000,\n",
|
|||
|
|
"}\n",
|
|||
|
|
"r = requests.get('https://fapi.asterdex.com/fapi/v3/trades', params=params)"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": 34,
|
|||
|
|
"id": "a3ad1819",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [
|
|||
|
|
{
|
|||
|
|
"data": {
|
|||
|
|
"text/html": [
|
|||
|
|
"<div>\n",
|
|||
|
|
"<style scoped>\n",
|
|||
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
|
" vertical-align: middle;\n",
|
|||
|
|
" }\n",
|
|||
|
|
"\n",
|
|||
|
|
" .dataframe tbody tr th {\n",
|
|||
|
|
" vertical-align: top;\n",
|
|||
|
|
" }\n",
|
|||
|
|
"\n",
|
|||
|
|
" .dataframe thead th {\n",
|
|||
|
|
" text-align: right;\n",
|
|||
|
|
" }\n",
|
|||
|
|
"</style>\n",
|
|||
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
|
" <thead>\n",
|
|||
|
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
|
" <th></th>\n",
|
|||
|
|
" <th>id</th>\n",
|
|||
|
|
" <th>price</th>\n",
|
|||
|
|
" <th>qty</th>\n",
|
|||
|
|
" <th>quoteQty</th>\n",
|
|||
|
|
" <th>time</th>\n",
|
|||
|
|
" <th>isBuyerMaker</th>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" </thead>\n",
|
|||
|
|
" <tbody>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>0</th>\n",
|
|||
|
|
" <td>74506547</td>\n",
|
|||
|
|
" <td>2311.02</td>\n",
|
|||
|
|
" <td>0.044</td>\n",
|
|||
|
|
" <td>101.68</td>\n",
|
|||
|
|
" <td>2026-04-27 14:22:45.650</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>1</th>\n",
|
|||
|
|
" <td>74506548</td>\n",
|
|||
|
|
" <td>2311.00</td>\n",
|
|||
|
|
" <td>0.004</td>\n",
|
|||
|
|
" <td>9.24</td>\n",
|
|||
|
|
" <td>2026-04-27 14:22:45.650</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>2</th>\n",
|
|||
|
|
" <td>74506549</td>\n",
|
|||
|
|
" <td>2310.91</td>\n",
|
|||
|
|
" <td>0.003</td>\n",
|
|||
|
|
" <td>6.93</td>\n",
|
|||
|
|
" <td>2026-04-27 14:22:45.650</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>3</th>\n",
|
|||
|
|
" <td>74506550</td>\n",
|
|||
|
|
" <td>2310.90</td>\n",
|
|||
|
|
" <td>0.004</td>\n",
|
|||
|
|
" <td>9.24</td>\n",
|
|||
|
|
" <td>2026-04-27 14:22:45.650</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>4</th>\n",
|
|||
|
|
" <td>74506551</td>\n",
|
|||
|
|
" <td>2310.80</td>\n",
|
|||
|
|
" <td>0.004</td>\n",
|
|||
|
|
" <td>9.24</td>\n",
|
|||
|
|
" <td>2026-04-27 14:22:45.700</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>...</th>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" <td>...</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>995</th>\n",
|
|||
|
|
" <td>74507542</td>\n",
|
|||
|
|
" <td>2312.10</td>\n",
|
|||
|
|
" <td>0.004</td>\n",
|
|||
|
|
" <td>9.24</td>\n",
|
|||
|
|
" <td>2026-04-27 14:34:12.500</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>996</th>\n",
|
|||
|
|
" <td>74507543</td>\n",
|
|||
|
|
" <td>2312.18</td>\n",
|
|||
|
|
" <td>2.442</td>\n",
|
|||
|
|
" <td>5646.34</td>\n",
|
|||
|
|
" <td>2026-04-27 14:34:13.443</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>997</th>\n",
|
|||
|
|
" <td>74507544</td>\n",
|
|||
|
|
" <td>2312.24</td>\n",
|
|||
|
|
" <td>10.099</td>\n",
|
|||
|
|
" <td>23351.31</td>\n",
|
|||
|
|
" <td>2026-04-27 14:34:13.600</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>998</th>\n",
|
|||
|
|
" <td>74507545</td>\n",
|
|||
|
|
" <td>2312.13</td>\n",
|
|||
|
|
" <td>3.120</td>\n",
|
|||
|
|
" <td>7213.84</td>\n",
|
|||
|
|
" <td>2026-04-27 14:34:14.568</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" <tr>\n",
|
|||
|
|
" <th>999</th>\n",
|
|||
|
|
" <td>74507546</td>\n",
|
|||
|
|
" <td>2312.19</td>\n",
|
|||
|
|
" <td>6.228</td>\n",
|
|||
|
|
" <td>14400.31</td>\n",
|
|||
|
|
" <td>2026-04-27 14:34:15.988</td>\n",
|
|||
|
|
" <td>True</td>\n",
|
|||
|
|
" </tr>\n",
|
|||
|
|
" </tbody>\n",
|
|||
|
|
"</table>\n",
|
|||
|
|
"<p>1000 rows × 6 columns</p>\n",
|
|||
|
|
"</div>"
|
|||
|
|
],
|
|||
|
|
"text/plain": [
|
|||
|
|
" id price qty quoteQty time isBuyerMaker\n",
|
|||
|
|
"0 74506547 2311.02 0.044 101.68 2026-04-27 14:22:45.650 True\n",
|
|||
|
|
"1 74506548 2311.00 0.004 9.24 2026-04-27 14:22:45.650 True\n",
|
|||
|
|
"2 74506549 2310.91 0.003 6.93 2026-04-27 14:22:45.650 True\n",
|
|||
|
|
"3 74506550 2310.90 0.004 9.24 2026-04-27 14:22:45.650 True\n",
|
|||
|
|
"4 74506551 2310.80 0.004 9.24 2026-04-27 14:22:45.700 True\n",
|
|||
|
|
".. ... ... ... ... ... ...\n",
|
|||
|
|
"995 74507542 2312.10 0.004 9.24 2026-04-27 14:34:12.500 True\n",
|
|||
|
|
"996 74507543 2312.18 2.442 5646.34 2026-04-27 14:34:13.443 True\n",
|
|||
|
|
"997 74507544 2312.24 10.099 23351.31 2026-04-27 14:34:13.600 True\n",
|
|||
|
|
"998 74507545 2312.13 3.120 7213.84 2026-04-27 14:34:14.568 True\n",
|
|||
|
|
"999 74507546 2312.19 6.228 14400.31 2026-04-27 14:34:15.988 True\n",
|
|||
|
|
"\n",
|
|||
|
|
"[1000 rows x 6 columns]"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
"execution_count": 34,
|
|||
|
|
"metadata": {},
|
|||
|
|
"output_type": "execute_result"
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"source": [
|
|||
|
|
"l = json.loads(r.text)\n",
|
|||
|
|
"df = pd.DataFrame(l)\n",
|
|||
|
|
"df['time'] = pd.to_datetime(df['time'], unit='ms')\n",
|
|||
|
|
"df"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": null,
|
|||
|
|
"id": "3c908942",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": []
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": null,
|
|||
|
|
"id": "60f4608a",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": []
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": null,
|
|||
|
|
"id": "76624896",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": []
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"cell_type": "code",
|
|||
|
|
"execution_count": null,
|
|||
|
|
"id": "5ade3c15",
|
|||
|
|
"metadata": {},
|
|||
|
|
"outputs": [],
|
|||
|
|
"source": []
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"metadata": {
|
|||
|
|
"kernelspec": {
|
|||
|
|
"display_name": "py_313",
|
|||
|
|
"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.13.13"
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"nbformat": 4,
|
|||
|
|
"nbformat_minor": 5
|
|||
|
|
}
|