sql1 = "CREATE TABLE IF NOT EXISTS `1min` ( `datetime` date,`open` float,`high` float,`low` float,`close` float)"
cursor.execute(sql1)
sql = 'insert into 1min(datetime,open,high,low,close) values(%(datetime)s,%(open)s,%(high)s,%(low)s,%(close)s);'
{ "ch": "market.btcusdt.kline.1min", "status": "ok", "ts": 1624553002810, "data": [ { "id": 1624552980, "open": 34280.05, "close": 34277.8, "low": 34259.01, "high": 34299.98, "amount": 17.59438, "vol": 603071.96902987, "count": 385 } ] } 获取的内容 +---------------------+---------+---------+---------+---------+ | datetime | open | high | low | close | +---------------------+---------+---------+---------+---------+ | 2021-06-24 00:45:00 | 33527.5 | 33580.8 | 33521.4 | 33573.6 | | 2021-06-25 00:40:00 | 34277.7 | 34277.7 | 34277.7 | 34277.7 | | 2021-06-25 00:41:00 | 34336.9 | 34338.5 | 34308 | 34311.5 | | 2021-06-25 00:42:00 | 34297.6 | 34310.9 | 34289.1 | 34310.9 | | 2021-06-25 00:43:00 | 34280.1 | 34300 | 34259 | 34259.7 | | 2021-06-25 00:44:00 | 34237.1 | 34237.1 | 34237.1 | 34237.1 | | 2021-06-25 00:45:00 | 34240.4 | 34243.1 | 34240.4 | 34243.1 | | 2021-06-25 00:46:00 | 34339.7 | 34339.7 | 34315.4 | 34315.4 | mysql 显示内容
1
rekulas 2021-08-09 22:40:45 +08:00
众所周知,高精度值计算存储全球统一看法字符串最稳,所以用 decimal
|