Files
Funding_Rate/mexc.ipynb
2026-04-06 20:26:16 +00:00

241 lines
5.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "7a3f41bd",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3b48e1ce",
"metadata": {},
"outputs": [],
"source": [
"url_all_tickers = 'https://api.mexc.com/api/v1/contract/ticker'"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "ab38d984",
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(url_all_tickers)\n",
"data = r.json()['data']"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "1139b1a3",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame(data)\n",
"df['fundingRate_pct'] = df['fundingRate']*100"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "b00512dc",
"metadata": {},
"outputs": [],
"source": [
"df_trim = df[['symbol','fundingRate_pct','volume24']].copy()\n",
"df_trim = df_trim.loc[df_trim['volume24'] > 10_000]\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "43b053d0",
"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>symbol</th>\n",
" <th>fundingRate_pct</th>\n",
" <th>volume24</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>BTC_USDT</td>\n",
" <td>-0.0007</td>\n",
" <td>208341522</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ETH_USDT</td>\n",
" <td>0.0012</td>\n",
" <td>27134917</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>XAUT_USDT</td>\n",
" <td>0.0050</td>\n",
" <td>429520428</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>SOL_USDT</td>\n",
" <td>-0.0016</td>\n",
" <td>188591783</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>SILVER_USDT</td>\n",
" <td>0.0000</td>\n",
" <td>634682239</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>837</th>\n",
" <td>ENS_USDC</td>\n",
" <td>0.0100</td>\n",
" <td>196467</td>\n",
" </tr>\n",
" <tr>\n",
" <th>838</th>\n",
" <td>KAITO_USDC</td>\n",
" <td>-0.0106</td>\n",
" <td>245467</td>\n",
" </tr>\n",
" <tr>\n",
" <th>839</th>\n",
" <td>BIO_USDC</td>\n",
" <td>0.0050</td>\n",
" <td>586982</td>\n",
" </tr>\n",
" <tr>\n",
" <th>840</th>\n",
" <td>ETC_USDC</td>\n",
" <td>0.0100</td>\n",
" <td>117338</td>\n",
" </tr>\n",
" <tr>\n",
" <th>841</th>\n",
" <td>MNT_USDC</td>\n",
" <td>0.0100</td>\n",
" <td>150912</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>837 rows × 3 columns</p>\n",
"</div>"
],
"text/plain": [
" symbol fundingRate_pct volume24\n",
"0 BTC_USDT -0.0007 208341522\n",
"1 ETH_USDT 0.0012 27134917\n",
"2 XAUT_USDT 0.0050 429520428\n",
"3 SOL_USDT -0.0016 188591783\n",
"4 SILVER_USDT 0.0000 634682239\n",
".. ... ... ...\n",
"837 ENS_USDC 0.0100 196467\n",
"838 KAITO_USDC -0.0106 245467\n",
"839 BIO_USDC 0.0050 586982\n",
"840 ETC_USDC 0.0100 117338\n",
"841 MNT_USDC 0.0100 150912\n",
"\n",
"[837 rows x 3 columns]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_trim"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f7b44068",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "f91b1c04",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "71e551f4",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}