{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "2d85dda4", "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import talib\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "id": "65b4b7aa", "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('D:/of_data/主力连续/tick生成的OF数据(5M)/data_rs_merged/上期所/ag888/ag888_rs_2021_5T_back_ofdata_dj.csv')" ] }, { "cell_type": "code", "execution_count": null, "id": "edd4f1e5", "metadata": {}, "outputs": [], "source": [ "df['HT_TRENDLINE'] = talib.HT_TRENDLINE(df['delta'])" ] }, { "cell_type": "code", "execution_count": null, "id": "25c70609", "metadata": {}, "outputs": [], "source": [ "df[['delta','HT_TRENDLINE']].plot(title = '希尔伯特瞬时变换')\n", "plt.grid()\n", "plt.legend(['delta','HT_TRENDLINE'])\n", "plt.show()" ] } ], "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.7.1" } }, "nbformat": 4, "nbformat_minor": 5 }