31 lines
793 B
Python
31 lines
793 B
Python
import requests
|
|
import urllib.parse
|
|
import json
|
|
|
|
token = '6c7ba077eee07f6f270e219d4848700e-c-app'
|
|
base_stock_url = 'https://quote.tradeswitcher.com/quote-stock-b-api/batch-kline'
|
|
base_others_url = 'https://quote.tradeswitcher.com/quote-b-api/batch-kline'
|
|
test_headers = {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
def get_klines(type, symbols, interval):
|
|
query = {
|
|
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
|
|
"data": {
|
|
"code": "AAPL.US",
|
|
"kline_type": 8,
|
|
"kline_timestamp_end": 0,
|
|
"query_kline_num": 500,
|
|
"adjust_type": 0
|
|
}
|
|
}
|
|
|
|
|
|
url = base_stock_url + f"/kline?token={token}"
|
|
print(url)
|
|
data = requests.get(url, headers=test_headers).json()
|
|
print(data)
|
|
|
|
|
|
get_klines() |