本文介绍如何将OKEx交易所成交记录数据中的日期时间转毫秒级时间戳。

作者:比特量化

1. OKEx交易记录格式

[
    {
        "time":"2019-09-14T10:29:20.142Z",
        "timestamp":"2019-09-14T10:29:20.142Z",
        ",
        "price":"68.43",
        "size":"0.00166",
        "side":"sell"
    }
]

time和timstamp为同样的值,有点不规范

2. 转为毫秒级时间戳

dt = '2019-09-14T10:29:20.142Z' #来源 比特量化
utc8 = datetime.datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S.%fZ") + datetime.timedelta(hours=8)
utc8_ms = int(time.mktime(utc8.timetuple()) * 1000 + utc8.microsecond / 1000)
print(utc8_ms) 

返回

1568456960142

OKEx交易所交易记录日期时间转毫秒级时间戳的更多相关文章

  1. Python获取秒级时间戳与毫秒级时间戳

    获取秒级时间戳与毫秒级时间戳 import time import datetime t = time.time() print (t) #原始时间数据 print (int(t)) #秒级时间戳 p ...

  2. Python 获取秒级时间戳与毫秒级时间戳

    原文:Python获取秒级时间戳与毫秒级时间戳 1.获取秒级时间戳与毫秒级时间戳 import time import datetime t = time.time() print (t) #原始时间 ...

  3. 获取秒级时间戳和毫秒级时间戳---基于python

    获取秒级时间戳和毫秒级时间戳 import timeimport datetime t = time.time() print (t) #原始时间数据print (int(t)) #秒级时间戳prin ...

  4. python 获得毫秒级时间戳

    import time import datetime t = time.time() print (t) #原始时间数据 print (int(t)) #秒级时间戳 print (int(round ...

  5. C++获取毫秒级时间戳

    #include<chrono>   auto timeNow = chrono::duration_cast<chrono::milliseconds>(chrono::sy ...

  6. 【PHP】 毫秒级时间戳和日期格式转换

    在并发量搞得情况下.需要开启毫秒级运算 mysql  支持: `create_time` datetime() DEFAULT NULL COMMENT '创建时间', 效果 PHP 代码实现: &l ...

  7. 【C++】秒级时间戳,毫秒级时间戳

    时间戳,秒级 测试代码: #include <iostream> #include <time.h> #include <windows.h> using name ...

  8. Delphi获取毫秒级时间戳

    function GetJavaTime( d: TDateTime ): Int64; var dJavaStart: TDateTime; begin //java里的时间是从1970年1月1日0 ...

  9. OpenTSDB查询和写入毫秒级数据

    由于OpenTSDB没有支持Java的SDK进行调用,所以基于Java开发OpenTSDB的调用将要依靠HTTP请求的方式进行. 1.毫秒级数据写入 /api/put:通过POST方式插入JSON格式 ...

随机推荐

  1. Beta冲刺(3/7)——2019.5.24

    所属课程 软件工程1916|W(福州大学) 作业要求 Beta冲刺(3/7)--2019.5.24 团队名称 待就业六人组 1.团队信息 团队名称:待就业六人组 团队描述:同舟共济扬帆起,乘风破浪万里 ...

  2. 使用tensorflow时,关于GPU的设置

    查看显卡使用情况: nvidia-smi 设置tensorflow按需分配资源: import os os.environ["CUDA_DEVICE_ORDER"] = " ...

  3. what-is-the-difference-between-type-and-class

    Inspired by Wikipedia... In type theory terms; A type is an abstract interface. Types generally repr ...

  4. [nodemon] app crashed - waiting for file changes before starting...

    慕课网前端工程师晋升课程 Vue全家桶+SSR+Koa2全栈开发美团网 视频里用 npx create-nuxt-app mt-app创建项目后,不能使用import ...from....跟着老师修 ...

  5. Tasking

    Put your plan on the tick list, and set the completion time limit, daily repetition, etc. according ...

  6. Ice Igloos Gym - 101480I (暴力技巧)

    Problem I: Ice Igloos \[ Time Limit: 10 s \quad Memory Limit: 512 MiB \] 题意 给出\(n\)个圆,给出每个圆的坐标\(x\). ...

  7. 7.学习springmvc的异常处理

    一.页面的异常处理流程 二.建立项目springmvc04_exception 1.编写index.jsp页面: <%@ page contentType="text/html;cha ...

  8. [PHP] Laravel 5.5 的 BCrypt对密码进行加密及密码验证

    Laravel 5.5 的 BCrypt对密码进行加密及密码验证 一.加密 方法1) $password= Hash::make('密码'); 方法2) /也可直接使用 bcrypt 的 functi ...

  9. A_G_C_007

    AGC007 A Shik and Stone 我是沙比这都能蛙一发 https://agc007.contest.atcoder.jp/submissions/7946110 B Construct ...

  10. A~G)C004

    AGC004 A Divide a Cuboi 我不会,谁能教教我/kk https://agc004.contest.atcoder.jp/submissions/7919351 B Colorfu ...