{"id":2051,"date":"2025-03-27T07:52:00","date_gmt":"2025-03-26T23:52:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=2051"},"modified":"2025-03-09T20:54:14","modified_gmt":"2025-03-09T12:54:14","slug":"%e5%a6%82%e4%bd%95%e7%bb%95%e8%bf%87%e4%ba%a4%e6%98%93%e6%89%80-api-%e9%99%90%e5%88%b6%ef%bc%8c%e9%ab%98%e6%95%88%e8%8e%b7%e5%8f%96%e6%95%b0%e6%8d%ae%ef%bc%9f%e8%bf%99%e4%ba%9b%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/www.laoyulaoyu.com\/index.php\/2025\/03\/27\/%e5%a6%82%e4%bd%95%e7%bb%95%e8%bf%87%e4%ba%a4%e6%98%93%e6%89%80-api-%e9%99%90%e5%88%b6%ef%bc%8c%e9%ab%98%e6%95%88%e8%8e%b7%e5%8f%96%e6%95%b0%e6%8d%ae%ef%bc%9f%e8%bf%99%e4%ba%9b%e6%8a%80%e5%b7%a7\/","title":{"rendered":"\u5982\u4f55\u7ed5\u8fc7\u4ea4\u6613\u6240 API \u9650\u5236\uff0c\u9ad8\u6548\u83b7\u53d6\u6570\u636e\uff1f\u8fd9\u4e9b\u6280\u5de7\u4f60\u5fc5\u987b\u77e5\u9053\uff01"},"content":{"rendered":"\n<p>\u4f5c\u8005\uff1a<a href=\"https:\/\/www.laoyulaoyu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u8001\u4f59\u635e\u9c7c<\/a><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/03\/dm1vCGqcuBVgbme7-generated_image.jpg\" alt=\"\" class=\"wp-image-4444\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-verse\"><strong>\u5199\u5728\u524d\u9762\u7684\u8bdd\uff1a<\/strong>\u5728\u6570\u5b57\u91d1\u878d\u9886\u57df\uff0c\u5168\u7403\u8f83\u5927\u89c4\u6a21\u7684\u4ea4\u6613\u6240\u90fd\u6709API\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u63a5\u53e3\u3002\u7136\u800c\uff0cAPI\u7684\u65f6\u95f4\u548c\u8bf7\u6c42\u9650\u5236\u5e38\u5e38\u8ba9\u5f00\u53d1\u8005\u548c\u6570\u636e\u5206\u6790\u5e08\u5934\u75bc\u4e0d\u5df2\u3002\u4eca\u5929\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u6211\u5c06\u5206\u4eab\u51e0\u79cd\u7ed5\u8fc7API\u9650\u5236\u7684\u9ad8\u6548\u65b9\u6cd5\uff08Binance.\u5e01\u5b89\u4e3a\u4f8b\uff09\uff0c\u52a9\u4f60\u8f7b\u677e\u83b7\u53d6\u6d77\u91cf\u6570\u636e<\/mark>\u3002<\/pre>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u4ec0\u4e48\u662f API \u9650\u5236<\/strong> <strong>\uff1f<\/strong><\/h2>\n\n\n\n<p>API \u9650\u5236\u662f\u6307\u5728\u4f7f\u7528\u5e94\u7528\u7a0b\u5e8f\u7f16\u7a0b\u63a5\u53e3\uff08API\uff09\u65f6\uff0c\u5bf9\u8bf7\u6c42\u6570\u91cf\u3001\u9891\u7387\u6216\u6570\u636e\u8bbf\u95ee\u7684\u9650\u5236\u3002API \u9650\u5236\u7684\u7c7b\u578b\u5927\u81f4\u4f1a\u5206\u6210\u4ee5\u4e0b\u51e0\u79cd\u7c7b\u578b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/03\/image-19.png\" alt=\"\" class=\"wp-image-4441\" style=\"width:583px;height:auto\"\/><\/figure>\n\n\n\n<p>Binance\u548c\u5927\u591a\u6570\u4ea4\u6613\u6240\u7684API\u90fd\u4f1a\u8bbe\u7f6e\u8fd9\u4e2a\u9650\u5236\uff0c\u4ee5\u786e\u4fdd\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u3001\u5b89\u5168\u6027\u548c\u516c\u5e73\u6027\u3002API \u9650\u5236\u53ef\u4ee5\u5e2e\u52a9\u9632\u6b62\u6ee5\u7528\u3001\u4fdd\u62a4\u670d\u52a1\u5668\u8d44\u6e90\uff0c\u5e76\u786e\u4fdd\u6240\u6709\u7528\u6237\u90fd\u80fd\u83b7\u5f97\u826f\u597d\u7684\u670d\u52a1\u4f53\u9a8c\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982Binance API\u5c31\u9650\u5236\u6bcf\u6b21\u8bf7\u6c42\u6700\u591a\u8fd4\u56de 1000 \u6761\u6570\u636e\uff0c\u5e76\u5bf9\u6bcf\u5206\u949f\u8bf7\u6c42\u6b21\u6570\u8bbe\u5b9a\u4e0a\u9650\u4e3a1200\u6b21\u3002\u4e3a\u4e86\u9ad8\u6548\u83b7\u53d6\u66f4\u591a\u6570\u636e\uff0c\u5e76\u4e3aAI\u91cf\u5316\u4ea4\u6613\u63d0\u4f9b\u66f4\u597d\u7684\u6570\u636e\u73af\u5883\uff0c\u6211\u4eec\u9700\u8981\u627e\u5230\u5408\u9002\u7684\u7a81\u7834\u53e3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u51e0\u79cd\u6709\u6548\u65b9\u5f0f<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><br><strong>2.1 \u4f7f\u7528\u4ee3\u7406IP\uff1a\u5206\u6563\u8bf7\u6c42\u6765\u6e90<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u4f60\u7684\u8bf7\u6c42\u8fc7\u4e8e\u96c6\u4e2d\uff0cBinance\u7b49\u4ea4\u6613\u6240\u53ef\u80fd\u4f1a\u8ba4\u4e3a\u4f60\u5728\u8fdb\u884c\u6076\u610f\u64cd\u4f5c\uff0c\u4ece\u800c\u9650\u5236\u4f60\u7684IP\u3002<br><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong>&nbsp;\u4f7f\u7528\u4ee3\u7406IP\u6c60\uff0c\u5c06\u8bf7\u6c42\u5206\u6563\u5230\u4e0d\u540c\u7684IP\u5730\u5740\u4e0a\u3002\u8fd9\u6837\u4e0d\u4ec5\u53ef\u4ee5\u7ed5\u8fc7IP\u9650\u5236\uff0c\u8fd8\u80fd\u63d0\u9ad8\u8bf7\u6c42\u7684\u6210\u529f\u7387\u3002<\/p>\n\n\n\n<p><strong>\u63a8\u8350\u5de5\u5177\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ScraperAPI<\/strong>\uff1a\u63d0\u4f9b\u9ad8\u8d28\u91cf\u7684\u4ee3\u7406IP\u670d\u52a1\u3002<\/li>\n\n\n\n<li><strong>ProxyMesh<\/strong>\uff1a\u652f\u6301\u52a8\u6001IP\u5207\u6362\uff0c\u9002\u5408\u5927\u89c4\u6a21\u6570\u636e\u6293\u53d6\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><br><strong>2.2 \u8c03\u6574\u8bf7\u6c42\u9891\u7387\uff1a\u907f\u514d\u89e6\u53d1\u98ce\u63a7<\/strong><\/h3>\n\n\n\n<p>\u5373\u4f7f\u4f60\u5206\u6279\u6b21\u8bf7\u6c42\uff0c\u5982\u679c\u9891\u7387\u8fc7\u9ad8\uff0c\u4ecd\u7136\u53ef\u80fd\u89e6\u53d1Binance\u7684\u98ce\u63a7\u673a\u5236\u3002<br><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong>&nbsp;\u5728\u4ee3\u7801\u4e2d\u52a0\u5165\u968f\u673a\u5ef6\u8fdf\uff0c\u6a21\u62df\u4eba\u7c7b\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728\u6bcf\u6b21\u8bf7\u6c42\u540e\u968f\u673a\u7b49\u5f851-3\u79d2\u3002<\/p>\n\n\n\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\n\ndef fetch_data_with_delay(symbol, limit=1000):\n    url = f\"https:\/\/api.binance.com\/api\/v3\/trades?symbol={symbol}&amp;limit={limit}\"\n    response = requests.get(url)\n    time.sleep(random.uniform(1, 3))  # \u968f\u673a\u5ef6\u8fdf1-3\u79d2\n    return response.json()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.3 \u5229\u7528WebSocket\uff1a\u5b9e\u65f6\u6570\u636e\u83b7\u53d6<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u4f60\u9700\u8981\u5b9e\u65f6\u6570\u636e\uff0cWebSocket \u662f\u66f4\u597d\u7684\u9009\u62e9\u3002WebSocket \u662f\u4e00\u79cd\u53cc\u5411\u901a\u4fe1\u534f\u8bae\uff0c\u53ef\u4ee5\u5b9e\u65f6\u63a5\u6536Binance\u7684\u66f4\u65b0\u6570\u636e\uff0c\u800c\u4e0d\u9700\u8981\u9891\u7e41\u53d1\u9001HTTP\u8bf7\u6c42\u3002<\/p>\n\n\n\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from websocket import create_connection\nimport json\n\ndef websocket_example():\n    ws = create_connection(\"wss:\/\/stream.binance.com:9443\/ws\/btcusdt@trade\")\n    while True:\n        data = ws.recv()\n        print(json.loads(data))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.4 \u591a\u8d26\u6237\u8f6e\u6362\uff1a\u5206\u6563\u8bf7\u6c42\u538b\u529b<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u4f60\u6709\u591a\u4e2aBinance\u8d26\u6237\uff0c\u53ef\u4ee5\u8f6e\u6362\u4f7f\u7528\u8fd9\u4e9b\u8d26\u6237\u7684API\u5bc6\u94a5\uff0c\u5206\u6563\u8bf7\u6c42\u538b\u529b\u3002<br><strong>\u6ce8\u610f\uff1a<\/strong>&nbsp;\u4f7f\u7528\u591a\u8d26\u6237\u65f6\uff0c\u52a1\u5fc5\u9075\u5b88Binance\u7684\u4f7f\u7528\u6761\u6b3e\uff0c\u907f\u514d\u8fdd\u89c4\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u6211\u63a8\u8350\u7684\u65b9\u6cd5<\/strong><\/h2>\n\n\n\n<p>\u6211\u6bd4\u8f83\u63a8\u8350\u7684\u662f\u4e00\u79cd\u80fd<strong>\u7ed3\u5408\u81ea\u5df1\u91cf\u5316\u8f6f\u4ef6\u7684\u81ea\u52a8\u5316\u5206\u9875\u6280\u672f<\/strong>\uff0c\u53ef\u4ee5\u83b7\u53d6\u8d85\u8fc71000\u4e2aK\u7ebf\u6570\u636e\uff0c\u901a\u8fc7\u5206\u9875\u6280\u672f\u5b9e\u73b0\u3002\u8fd9\u79cd\u65b9\u6cd5<strong>\u9002\u5408\u4e8e\u5b9e\u6218<\/strong>\uff0c\u9002\u7528\u4e8e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9ad8\u9891\u4ea4\u6613\u7b56\u7565<\/strong>\uff1a\u5feb\u901f\u63d0\u53d6\u5206\u949f\u7ea7\u6570\u636e\uff0c\u52a9\u529b\u77ed\u7ebf\u4ea4\u6613\u51b3\u7b56\u3002<\/li>\n\n\n\n<li><strong>\u5386\u53f2\u6570\u636e\u5206\u6790<\/strong>\uff1a\u5b8c\u6574\u5e02\u573a\u6570\u636e\u6709\u52a9\u4e8e\u6a21\u578b\u8bad\u7ec3\u548c\u56de\u6d4b\u3002<\/li>\n\n\n\n<li><strong>\u5e02\u573a\u76d1\u6d4b\u4e0e\u98ce\u63a7<\/strong>\uff1a\u53ca\u65f6\u6293\u53d6\u6570\u636e\uff0c\u786e\u4fdd\u5b9e\u65f6\u76d1\u63a7\u5e02\u573a\u6ce2\u52a8\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.1 \u5177\u4f53\u65b9\u6cd5<\/strong><\/h3>\n\n\n\n<p>\u5177\u4f53\u65b9\u6cd5\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u516b\u4e2a\u5b57\uff1a\u201c<strong>\u5316\u6574\u4e3a\u96f6\uff0c\u7a81\u7834\u9650\u5236<\/strong>\u201d\u3002\u6211\u4eec\u53ef\u4ee5\u5206\u6279\u8bf7\u6c42\u6bcf\u6b21\u83b7\u53d6\u6700\u591a1000\u4e2aK\u7ebf\uff0c\u7136\u540e\u6839\u636e\u4e0a\u4e00\u6b21\u8bf7\u6c42\u7684\u6700\u540eK\u7ebf\u7684\u5173\u95ed\u65f6\u95f4\uff08close_time\uff09\u8c03\u6574\u4e0b\u4e00\u6b21\u8bf7\u6c42\u7684\u8d77\u59cb\u65f6\u95f4\uff08startTime\uff09\u3002\u8fd9\u79cd\u65b9\u6cd5\u786e\u4fdd\u6570\u636e\u8fde\u7eed\u6027\uff0c\u5e76\u80fd\u9010\u6b65\u83b7\u53d6\u6240\u6709\u6240\u9700\u5386\u53f2\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u5b9e\u73b0\u7684\u5206\u6b65\u6307\u5357\uff0c\u4ee3\u7801\u793a\u4f8b\u57fa\u4e8erequests\u5e93\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b9a\u4e49\u53c2\u6570<\/strong>\uff1a\u8bbe\u7f6e\u4ea4\u6613\u5bf9\uff08\u5982ETHUSDT\uff09\u3001\u65f6\u95f4\u95f4\u9694\uff08\u5982\u6bcf\u65e5\u6570\u636e&#8217;1d&#8217;\uff09\u3001\u8d77\u59cb\u65e5\u671f\u548c\u7ed3\u675f\u65e5\u671f\u3002<\/li>\n\n\n\n<li><strong>\u8f6c\u6362\u65f6\u95f4<\/strong>\uff1a\u5c06\u65e5\u671f\u8f6c\u6362\u4e3aUTC\u65f6\u95f4\u7684\u6beb\u79d2\u6570\uff0c\u7b26\u5408API\u8981\u6c42\u3002<\/li>\n\n\n\n<li><strong>\u5faa\u73af\u8bf7\u6c42<\/strong>\uff1a\u901a\u8fc7\u5faa\u73af\uff0c\u6bcf\u6b21\u8bf7\u6c42\u83b7\u53d6\u6700\u591a1000\u4e2aK\u7ebf\uff0c\u8bb0\u5f55\u6700\u540e\u4e00\u6761K\u7ebf\u7684\u5173\u95ed\u65f6\u95f4\u3002<\/li>\n\n\n\n<li><strong>\u66f4\u65b0\u8d77\u59cb\u65f6\u95f4<\/strong>\uff1a\u5c06\u4e0b\u4e00\u6b21\u8bf7\u6c42\u7684\u8d77\u59cb\u65f6\u95f4\u8bbe\u7f6e\u4e3a\u4e0a\u4e00\u6b21\u6700\u540eK\u7ebf\u7684\u5173\u95ed\u65f6\u95f4\u52a01\u6beb\u79d2\uff0c\u786e\u4fdd\u8fde\u7eed\u6027\u3002<\/li>\n\n\n\n<li><strong>\u5408\u5e76\u6570\u636e<\/strong>\uff1a\u5c06\u6bcf\u6b21\u8bf7\u6c42\u7684\u7ed3\u679c\u5408\u5e76\uff0c\u76f4\u5230\u6240\u6709\u6570\u636e\u83b7\u53d6\u5b8c\u6210\u6216\u8fbe\u5230\u7ed3\u675f\u65e5\u671f\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u90e8\u5206\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import requests\nimport pandas as pd\n\n# Binance K\u7ebf\u6570\u636e\u8bf7\u6c42\u51fd\u6570\ndef fetch_binance_data(symbol, interval, start_time, end_time):\n    url = f\"https:\/\/api.binance.com\/api\/v3\/klines\"\n    all_data = &#91;]\n\n    while start_time &lt; end_time:\n        params = {\n            \"symbol\": symbol,\n            \"interval\": interval,\n            \"startTime\": start_time,\n            \"limit\": 1000\n        }\n        response = requests.get(url, params=params)\n        data = response.json()\n\n        if not data:\n            break  # \u6570\u636e\u83b7\u53d6\u5b8c\u6bd5\n        \n        all_data.extend(data)\n        start_time = data&#91;-1]&#91;0] + 1  # \u66f4\u65b0 `startTime`\n\n    df = pd.DataFrame(all_data, columns=&#91;'Time', 'Open', 'High', 'Low', 'Close', 'Volume', 'CloseTime', 'QuoteAssetVolume', 'NumberOfTrades', 'TakerBuyBaseVolume', 'TakerBuyQuoteVolume', 'Ignore'])\n    return df\n\n# \u793a\u4f8b\u8c03\u7528\ndf = fetch_binance_data('BTCUSDT', '1h', 1640995200000, 1648684800000)\nprint(df.head())<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.2 \u6ce8\u610f\u4e8b\u9879<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u65f6\u95f4\u5bf9\u9f50<\/strong>\uff1a\u786e\u4fdd\u8d77\u59cb\u65f6\u95f4\u548c\u7ed3\u675f\u65f6\u95f4\u4e0eK\u7ebf\u95f4\u9694\u5bf9\u9f50\uff0cAPI\u4f1a\u81ea\u52a8\u8c03\u6574\u975e\u5bf9\u9f50\u7684\u65f6\u95f4\uff0c\u4f46\u5efa\u8bae\u624b\u52a8\u5904\u7406\u4ee5\u63d0\u9ad8\u6548\u7387\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u540c\u95f4\u9694\u7684\u5904\u7406<\/strong>\uff1a\u4e0a\u8ff0\u65b9\u6cd5\u9002\u7528\u4e8e\u6240\u6709\u65f6\u95f4\u95f4\u9694\uff08\u59821\u5c0f\u65f6&#8217;1h&#8217;\u30011\u5206\u949f&#8217;1m&#8217;\uff09\uff0c\u53ea\u9700\u6839\u636e\u95f4\u9694\u8c03\u6574close_time\u52a0\u6cd5\u7684\u5355\u4f4d\uff08\u4f8b\u59821\u5c0f\u65f6\u52a03600000\u6beb\u79d2\uff09\u3002<\/li>\n\n\n\n<li><strong>\u6027\u80fd\u8003\u8651<\/strong>\uff1a\u591a\u6b21\u8bf7\u6c42\u53ef\u80fd\u5bfc\u81f4\u8f83\u957f\u6267\u884c\u65f6\u95f4\uff0c\u5efa\u8bae\u5728\u975e\u9ad8\u5cf0\u671f\u64cd\u4f5c\uff0c\u5e76\u8003\u8651\u4f7f\u7528\u5f02\u6b65\u8bf7\u6c42\u5e93\u5982aiohttp\u4ee5\u63d0\u9ad8\u6548\u7387\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u5b58\u50a8<\/strong>\uff1a\u83b7\u53d6\u5927\u91cf\u6570\u636e\u540e\uff0c\u5efa\u8bae\u4fdd\u5b58\u4e3aCSV\u6216\u6570\u636e\u5e93\uff0c\u65b9\u4fbf\u540e\u7eed\u5206\u6790\uff0c\u907f\u514d\u91cd\u590d\u8bf7\u6c42\u3002<\/li>\n\n\n\n<li><strong>API\u53d8\u66f4\u98ce\u9669<\/strong>\uff1a\u9650\u5236\u53ef\u80fd\u968fBinance\u653f\u7b56\u66f4\u65b0\u800c\u53d8\u5316\uff0c\u5efa\u8bae\u5b9a\u671f\u67e5\u9605<a href=\"https:\/\/github.com\/binance\/binance-spot-api-docs\/blob\/master\/rest-api.md\" target=\"_blank\" rel=\"noreferrer noopener\">Binance API Documentation<\/a>\u4ee5\u83b7\u53d6\u6700\u65b0\u4fe1\u606f\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u6700\u540e\uff0c\u5efa\u8bae\u4f60\u5b9e\u65f6\u76d1\u63a7API\u8bf7\u6c42\u7684\u72b6\u6001\uff0c\u8bb0\u5f55\u6210\u529f\u7387\u548c\u54cd\u5e94\u65f6\u95f4\u3002\u6839\u636e\u76d1\u63a7\u7ed3\u679c\uff0c\u52a8\u6001\u8c03\u6574\u8bf7\u6c42\u7b56\u7565\uff0c\u786e\u4fdd\u6570\u636e\u83b7\u53d6\u7684\u7a33\u5b9a\u6027\u548c\u6548\u7387\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.3  \u5b9e\u6218\u6e90\u4ee3\u7801\u4e0b\u8f7d<\/strong><\/h3>\n\n\n\n<p>\u4ee5\u4e0a\u6e90\u4ee3\u7801\u8bf7\u5728\u6211\u7684Google Colab\u4e2d\u7533\u8bf7\u4e0b\u8f7d\uff0c\u5185\u9644\u8be6\u7ec6\u7684\u4e2d\u6587\u4ee3\u7801\u6784\u5efa\u4e0e\u6267\u884c\u8bf4\u660e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/03\/1741521017567.png\" alt=\"\" class=\"wp-image-4442\"\/><\/figure>\n\n\n\n<p>\u5982\u5bf9\u60a8\u6240\u5e2e\u52a9\uff0c\u8bb0\u5f97\u8bf7\u6211\u559d\u676f\u5496\u5561\u5c31\u597d\u3002<a href=\"https:\/\/colab.research.google.com\/drive\/1Og2QRWp3t1wdVviIj4Ui0CAkWQOMG1aI?usp=sharing\">https:\/\/colab.research.google.com\/drive\/1Og2QRWp3t1wdVviIj4Ui0CAkWQOMG1aI?usp=sharing<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u56db\u3001\u89c2\u70b9\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u7ed5\u8fc7API\uff08\u4ee5Binance\u4e3a\u4f8b\uff09\u7684\u8bf7\u6c42\u9650\u5236\uff0c\u9ad8\u6548\u83b7\u53d6\u6570\u636e\u3002\u901a\u8fc7\u5206\u6279\u8bf7\u6c42\u548c\u5206\u9875\u6280\u672f\uff0c\u518d\u7ed3\u5408\u524d\u9762\u63d0\u5230\u7684\u591a\u8d26\u6237\u3001\u591aIP\u6280\u672f\uff0c\u6570\u5b57\u91d1\u878d\u4ece\u4e1a\u8005\u53ef\u4ee5\u6709\u6548\u7ed5\u8fc7\u5404\u4e2a\u4ea4\u6613\u6240 API\u7684K\u7ebf\u6570\u636e\u9650\u5236\uff0c\u83b7\u53d6\u6240\u9700\u7684\u5386\u53f2\u5e02\u573a\u6570\u636e\u3002\u7ed3\u5408\u4e0a\u8ff0\u4ee3\u7801\u548c\u6700\u4f73\u5b9e\u8df5\uff0c\u7528\u6237\u53ef\u8f7b\u677e\u5b9e\u73b0\u81ea\u52a8\u5316\u6570\u636e\u83b7\u53d6\uff0c\u52a9\u529b\u4ea4\u6613\u7b56\u7565\u56de\u6d4b\u548c\u5e02\u573a\u5206\u6790\u3002\u4ee5\u4e0b\u662f\u5173\u952e\u70b9\u603b\u7ed3\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u591a\u8d26\u6237\u8f6e\u6362<\/strong>\uff1a\u8f6e\u6362\u4f7f\u7528\u591a\u4e2aAPI\u5bc6\u94a5\uff0c\u5206\u6563\u8bf7\u6c42\u538b\u529b\uff0c\u63d0\u5347\u6548\u7387\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528\u4ee3\u7406IP<\/strong>\uff1a\u901a\u8fc7\u4ee3\u7406IP\u6c60\u5206\u6563\u8bf7\u6c42\u6765\u6e90\uff0c\u907f\u514dIP\u88ab\u5c01\u7981\u3002<\/li>\n\n\n\n<li><strong>\u8c03\u6574\u8bf7\u6c42\u9891\u7387<\/strong>\uff1a\u52a0\u5165\u968f\u673a\u5ef6\u8fdf\uff0c\u6a21\u62df\u4eba\u7c7b\u64cd\u4f5c\uff0c\u964d\u4f4e\u89e6\u53d1\u98ce\u63a7\u7684\u98ce\u9669\u3002<\/li>\n\n\n\n<li><strong>\u5229\u7528WebSocket<\/strong>\uff1a\u4f7f\u7528WebSocket\u534f\u8bae\u5b9e\u65f6\u83b7\u53d6\u6570\u636e\uff0c\u51cf\u5c11HTTP\u8bf7\u6c42\u9891\u7387\u3002<\/li>\n\n\n\n<li><strong>\u5206\u6279\u6b21\u8bf7\u6c42<\/strong>\uff1a\u5c06\u5927\u8bf7\u6c42\u62c6\u5206\u4e3a\u591a\u4e2a\u5c0f\u8bf7\u6c42\uff0c\u5206\u6563\u5728\u4e0d\u540c\u65f6\u95f4\u7a97\u53e3\u5185\u5b8c\u6210\u3002<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><em>\u611f\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\uff0c\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u4e3a\u60a8\u5e26\u6765\u4e86\u65b0\u7684\u542f\u53d1\u548c\u5b9e\u7528\u7684\u77e5\u8bc6\uff01\u5982\u679c\u89c9\u5f97\u6709\u5e2e\u52a9\uff0c\u8bf7\u4e0d\u541d\u70b9\u8d5e\u548c\u5206\u4eab\uff0c\u60a8\u7684\u652f\u6301\u662f\u6211\u6301\u7eed\u521b\u4f5c\u7684\u52a8\u529b\u3002\u795d\u60a8\u6295\u8d44\u987a\u5229\uff0c\u6536\u76ca\u957f\u8679\uff01\u5982\u679c\u5bf9\u6587\u4e2d\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\uff0c\u6211\u4f1a\u5c3d\u5feb\u56de\u590d\uff01<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\" id=\"a1c6\">\u672c\u6587\u5185\u5bb9\u4ec5\u9650\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u8001\u4f59\u635e\u9c7c \u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.laoyulaoyu.com\/index.php\/2025\/03\/27\/%e5%a6%82%e4%bd%95%e7%bb%95%e8%bf%87%e4%ba%a4%e6%98%93%e6%89%80-api-%e9%99%90%e5%88%b6%ef%bc%8c%e9%ab%98%e6%95%88%e8%8e%b7%e5%8f%96%e6%95%b0%e6%8d%ae%ef%bc%9f%e8%bf%99%e4%ba%9b%e6%8a%80%e5%b7%a7\/\">Continue reading<span class=\"screen-reader-text\">\u5982\u4f55\u7ed5\u8fc7\u4ea4\u6613\u6240 API \u9650\u5236\uff0c\u9ad8\u6548\u83b7\u53d6\u6570\u636e\uff1f\u8fd9\u4e9b\u6280\u5de7\u4f60\u5fc5\u987b\u77e5\u9053\uff01<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,5,15],"class_list":{"0":"post-2051","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aiinvest","7":"tag-ai","9":"tag-15","10":"entry"},"_links":{"self":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/2051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/comments?post=2051"}],"version-history":[{"count":1,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/2051\/revisions"}],"predecessor-version":[{"id":2052,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/2051\/revisions\/2052"}],"wp:attachment":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=2051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=2051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=2051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}