|
import json
|
|
import requests
|
|
symbol = 'btcusdt'
|
|
symbol_other = symbol.replace("_", "").replace("-", "").lower()
|
|
host_list = ["http://43.133.213.20:8001", "http://43.163.230.7:9008"]
|
|
host = "http://43.163.230.7:9008"
|
|
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
|
url = "/platform/symbol/from_id/start_time/end_time"
|
|
count = 0
|
|
from_id = 5423056100
|
|
start_time = None
|
|
end_time = None
|
|
platform = 'binance_swap_u'
|
|
query_param = f"platform={platform}&symbol={symbol_other}&from_id={from_id}&start_time={start_time}&end_time={end_time}"
|
|
|
|
response = requests.request(
|
|
"GET", host_list[count % 2] + url + "?" + query_param, headers=headers, timeout=10
|
|
)
|
|
response.json()
|
|
|
|
# [
|
|
# {
|
|
# "a": 26129, // 归集成交ID
|
|
# "p": "0.01633102", // 成交价
|
|
# "q": "4.70443515", // 成交量
|
|
# "f": 27781, // 被归集的首个成交ID
|
|
# "l": 27781, // 被归集的末个成交ID
|
|
# "T": 1498793709153, // 成交时间
|
|
# "m": true, // 是否为主动卖出单
|
|
# }
|
|
# ]
|