def start(self):
     response_dicet = self.get_response()
     num = 0
     for i in response_dicet['data']:
         data = dict(
             time=str(i[0])[0:-2],
             value=str(i[1])
         )
         num += 1
         SunMongodb.insert_mongo(self.collection, data)
         print('正在处理{}, 现在已经是第{}条'.format(str(data),num))
Example #2
0
    def run(self):
        global switch
        switch = 0

        while True:

            times = datetime.datetime.now().strftime('%M')

            if int(times) % self.RunTime == 0 and switch == 0:
                while True:
                    data = Get_Trade_info.Weighted_Mean()
                    if data['code'] == 200:
                        data_s = (float(data['price']))
                        time_s = int(time.time())
                        print(
                            SunMongodb.insert_mongo(
                                self.collection, dict(time=time_s,
                                                      value=data_s)))
                        switch = 1
                        break

            if not int(times) % self.RunTime == 0:
                switch = 0

            time.sleep(2)
Example #3
0
import requests
import json
import time

from SunMongo import SunMongodb
from pymongo import MongoClient

response = requests.get('https://graphs2.coinmarketcap.com/currencies/tether/')
data = response.content.decode()
data = json.loads(data)
data = data['price_usd'][1030:1316]
num = 0
collection = MongoClient('0.0.0.0', 0)["BOOMHASH"]["USDT_USD_OLDS"]

for i in data:

    times = int(i[0] / 1000)

    times = time.strftime("%Y--%m--%d 08:00:00", time.localtime(int(times)))

    timeArray = time.strptime(times, "%Y--%m--%d %H:%M:%S")
    tt = int(time.mktime(timeArray))
    value = i[1]
    print(SunMongodb.insert_mongo(collection, dict(time=tt, value=value)))
Example #4
0
import json
import jsonpath
from pymongo import MongoClient
from SunMongo import SunMongodb

data = '''{"m":"timescale_update","p":["cs_GDkoSE9G9YHF",{"s1":{"node":"sfo-charts-4-study-engine-3@sfo-compute-4","s":[{"i":0,"v":[1503007200,6.6729,6.6814,6.6674,6.6699,0]},{"i":1,"v":[1503266400,6.6699,6.6735,6.6629,6.6629,0]},{"i":2,"v":[1503352800,6.6629,6.6629,6.6531,6.6599,0]},{"i":3,"v":[1503439200,6.6599,6.6673,6.657,6.657,0]},{"i":4,"v":[1503525600,6.6568,6.664,6.653,6.6619,0]},{"i":5,"v":[1503612000,6.6599,6.6674,6.6439,6.6464,0]},{"i":6,"v":[1503871200,6.6464,6.6497,6.6083,6.6083,0]},{"i":7,"v":[1503957600,6.6083,6.6227,6.5925,6.594,0]},{"i":8,"v":[1504044000,6.5944,6.5971,6.5806,6.5919,0]},{"i":9,"v":[1504130400,6.5917,6.6013,6.5874,6.5888,0]},{"i":10,"v":[1504216800,6.5887,6.5887,6.5486,6.5551,0]},{"i":11,"v":[1504476000,6.5551,6.5566,6.5185,6.5268,0]},{"i":12,"v":[1504562400,6.5268,6.5535,6.516,6.5344,0]},{"i":13,"v":[1504648800,6.5344,6.5465,6.5184,6.522,0]},{"i":14,"v":[1504735200,6.522,6.5285,6.4829,6.4829,0]},{"i":15,"v":[1504821600,6.4829,6.4925,6.4355,6.4772,0]},{"i":16,"v":[1505080800,6.4772,6.5279,6.4772,6.5253,0]},{"i":17,"v":[1505167200,6.5253,6.5477,6.5253,6.5353,0]},{"i":18,"v":[1505253600,6.5333,6.5405,6.5215,6.5405,0]},{"i":19,"v":[1505340000,6.5399,6.556,6.5399,6.5535,0]},{"i":20,"v":[1505426400,6.5519,6.5526,6.5371,6.5499,0]},{"i":21,"v":[1505685600,6.5499,6.5755,6.5466,6.5724,0]},{"i":22,"v":[1505858400,6.5799,6.5799,6.5635,6.57,0]},{"i":23,"v":[1505944800,6.5699,6.6002,6.5699,6.586,0]},{"i":24,"v":[1506031200,6.586,6.5984,6.5729,6.5898,0]},{"i":25,"v":[1506290400,6.5898,6.6211,6.5898,6.6211,0]},{"i":26,"v":[1506376800,6.6188,6.6388,6.6124,6.637,0]},{"i":27,"v":[1506463200,6.637,6.6424,6.6305,6.6424,0]},{"i":28,"v":[1506549600,6.6399,6.673,6.6397,6.659,0]},{"i":29,"v":[1506636000,6.659,6.6819,6.6376,6.6532,0]},{"i":30,"v":[1506895200,6.6533,6.6533,6.6532,6.6532,0]},{"i":31,"v":[1506981600,6.6532,6.6533,6.6532,6.6532,0]},{"i":32,"v":[1507068000,6.6532,6.6533,6.6532,6.6532,0]},{"i":33,"v":[1507154400,6.6532,6.6532,6.6532,6.6532,0]},{"i":34,"v":[1507240800,6.6532,6.6532,6.6532,6.6532,0]},{"i":35,"v":[1507500000,6.6532,6.655,6.621,6.6234,0]},{"i":36,"v":[1507586400,6.6234,6.6234,6.5717,6.5717,0]},{"i":37,"v":[1507672800,6.5711,6.5957,6.57,6.5869,0]},{"i":38,"v":[1507759200,6.587,6.597,6.5822,6.5856,0]},{"i":39,"v":[1507845600,6.5854,6.5872,6.5735,6.5784,0]},{"i":40,"v":[1508104800,6.5784,6.5929,6.5738,6.5898,0]},{"i":41,"v":[1508191200,6.5884,6.6234,6.5884,6.6219,0]},{"i":42,"v":[1508277600,6.6219,6.6274,6.6064,6.6274,0]},{"i":43,"v":[1508364000,6.6249,6.6365,6.611,6.6125,0]},{"i":44,"v":[1508450400,6.6125,6.625,6.6039,6.6184,0]},{"i":45,"v":[1508709600,6.6184,6.6399,6.6184,6.6379,0]},{"i":46,"v":[1508796000,6.6379,6.6387,6.6255,6.6334,0]},{"i":47,"v":[1508882400,6.6334,6.645,6.632,6.6349,0]},{"i":48,"v":[1508968800,6.6349,6.6401,6.6294,6.6391,0]},{"i":49,"v":[1509055200,6.6391,6.6615,6.6391,6.6497,0]},{"i":50,"v":[1509314400,6.6497,6.6513,6.6429,6.6439,0]},{"i":51,"v":[1509400800,6.6439,6.6464,6.6238,6.6327,0]},{"i":52,"v":[1509487200,6.6348,6.6373,6.6009,6.6017,0]},{"i":53,"v":[1509573600,6.6028,6.611,6.5839,6.6067,0]},{"i":54,"v":[1509660000,6.6088,6.6369,6.6049,6.6359,0]},{"i":55,"v":[1509919200,6.6359,6.6405,6.6285,6.631,0]},{"i":56,"v":[1510005600,6.6313,6.64,6.6213,6.638,0]},{"i":57,"v":[1510092000,6.6399,6.6434,6.6234,6.6248,0]},{"i":58,"v":[1510178400,6.6249,6.6415,6.6249,6.6377,0]},{"i":59,"v":[1510264800,6.6377,6.6449,6.6354,6.6398,0]},{"i":60,"v":[1510524000,6.6398,6.651,6.6375,6.6384,0]},{"i":61,"v":[1510610400,6.6404,6.6437,6.6344,6.6349,0]},{"i":62,"v":[1510696800,6.6362,6.6362,6.6132,6.6199,0]},{"i":63,"v":[1510783200,6.6199,6.6371,6.6199,6.6272,0]},{"i":64,"v":[1510869600,6.6272,6.635,6.6229,6.6244,0]},{"i":65,"v":[1511128800,6.6244,6.6371,6.6244,6.6299,0]},{"i":66,"v":[1511215200,6.6325,6.6418,6.6255,6.6265,0]},{"i":67,"v":[1511301600,6.6272,6.6326,6.6085,6.6085,0]},{"i":68,"v":[1511388000,6.6101,6.6101,6.5725,6.5789,0]},{"i":69,"v":[1511474400,6.581,6.606,6.5747,6.5997,0]},{"i":70,"v":[1511733600,6.5997,6.6068,6.5966,6.5966,0]},{"i":71,"v":[1511820000,6.5989,6.6087,6.5914,6.6043,0]},{"i":72,"v":[1511906400,6.6051,6.612,6.5953,6.609,0]},{"i":73,"v":[1511992800,6.609,6.6174,6.6032,6.6089,0]},{"i":74,"v":[1512079200,6.607,6.6156,6.6055,6.6136,0]},{"i":75,"v":[1512338400,6.6136,6.6199,6.6109,6.6184,0]},{"i":76,"v":[1512424800,6.6184,6.6197,6.6114,6.6169,0]},{"i":77,"v":[1512511200,6.619,6.6194,6.6114,6.6135,0]},{"i":78,"v":[1512597600,6.6135,6.6191,6.6134,6.6172,0]},{"i":79,"v":[1512684000,6.6172,6.6205,6.6148,6.6198,0]},{"i":80,"v":[1512943200,6.6198,6.6211,6.6147,6.6174,0]},{"i":81,"v":[1513029600,6.6186,6.6229,6.6155,6.6209,0]},{"i":82,"v":[1513116000,6.6209,6.6226,6.6127,6.6127,0]},{"i":83,"v":[1513202400,6.6194,6.6194,6.6046,6.609,0]},{"i":84,"v":[1513288800,6.6095,6.611,6.6065,6.6087,0]},{"i":85,"v":[1513548000,6.6087,6.6175,6.6087,6.6149,0]},{"i":86,"v":[1513634400,6.6163,6.6172,6.602,6.6034,0]},{"i":87,"v":[1513720800,6.6034,6.605,6.5752,6.577,0]},{"i":88,"v":[1513807200,6.5785,6.587,6.5545,6.5832,0]},{"i":89,"v":[1513893600,6.5832,6.5847,6.568,6.5749,0]},{"i":90,"v":[1514152800,6.5749,6.5749,6.5379,6.5379,0]},{"i":91,"v":[1514239200,6.5374,6.556,6.5339,6.5428,0]},{"i":92,"v":[1514325600,6.5429,6.559,6.5419,6.5559,0]},{"i":93,"v":[1514412000,6.5567,6.5585,6.5301,6.5321,0]},{"i":94,"v":[1514498400,6.5333,6.5333,6.5033,6.5062,0]},{"i":95,"v":[1514757600,6.5062,6.5062,6.5062,6.5062,0]},{"i":96,"v":[1514844000,6.5066,6.5066,6.4905,6.4909,0]},{"i":97,"v":[1514930400,6.4909,6.5105,6.4909,6.5009,0]},{"i":98,"v":[1515016800,6.5009,6.5092,6.4914,6.4914,0]},{"i":99,"v":[1515103200,6.4914,6.4933,6.479,6.487,0]},{"i":100,"v":[1515362400,6.4874,6.4986,6.4749,6.4969,0]},{"i":101,"v":[1515448800,6.4973,6.5295,6.4973,6.5262,0]},{"i":102,"v":[1515535200,6.5272,6.5345,6.5014,6.5054,0]},{"i":103,"v":[1515621600,6.5054,6.5175,6.4923,6.4955,0]},{"i":104,"v":[1515708000,6.5045,6.5045,6.4543,6.46,0]},{"i":105,"v":[1515967200,6.4606,6.4667,6.4177,6.4349,0]},{"i":106,"v":[1516053600,6.437,6.4431,6.423,6.4394,0]},{"i":107,"v":[1516140000,6.4394,6.4415,6.4195,6.4329,0]},{"i":108,"v":[1516226400,6.4329,6.4409,6.4159,6.4174,0]},{"i":109,"v":[1516312800,6.4178,6.4178,6.3885,6.3989,0]},{"i":110,"v":[1516572000,6.3989,6.4138,6.3989,6.4034,0]},{"i":111,"v":[1516658400,6.4034,6.409,6.391,6.3999,0]},{"i":112,"v":[1516744800,6.3999,6.4017,6.3649,6.3649,0]},{"i":113,"v":[1516831200,6.3649,6.3649,6.3145,6.3188,0]},{"i":114,"v":[1516917600,6.3188,6.334,6.3125,6.3198,0]},{"i":115,"v":[1517176800,6.318,6.335,6.318,6.3327,0]},{"i":116,"v":[1517263200,6.338,6.3436,6.3165,6.3198,0]},{"i":117,"v":[1517349600,6.3214,6.3305,6.284,6.284,0]},{"i":118,"v":[1517436000,6.2863,6.307,6.285,6.2968,0]},{"i":119,"v":[1517522400,6.297,6.3011,6.2686,6.298,0]},{"i":120,"v":[1517781600,6.2983,6.3095,6.2826,6.2849,0]},{"i":121,"v":[1517868000,6.2901,6.3007,6.2695,6.2829,0]},{"i":122,"v":[1517954400,6.2829,6.2882,6.2529,6.2648,0]},{"i":123,"v":[1518040800,6.2752,6.34,6.2658,6.3221,0]},{"i":124,"v":[1518127200,6.3273,6.3315,6.2827,6.295,0]},{"i":125,"v":[1518386400,6.2965,6.3303,6.2859,6.3249,0]},{"i":126,"v":[1518472800,6.3249,6.3475,6.3219,6.3379,0]},{"i":127,"v":[1518559200,6.3379,6.353,6.3305,6.3437,0]},{"i":128,"v":[1518645600,6.3437,6.344,6.3433,6.3437,0]},{"i":129,"v":[1518732000,6.3437,6.3438,6.3433,6.3435,0]},{"i":130,"v":[1518991200,6.3437,6.3481,6.3397,6.3437,0]},{"i":131,"v":[1519077600,6.3437,6.3438,6.3433,6.3437,0]},{"i":132,"v":[1519164000,6.344,6.344,6.3397,6.3437,0]},{"i":133,"v":[1519250400,6.3383,6.3625,6.3383,6.347,0]},{"i":134,"v":[1519336800,6.3501,6.3501,6.3319,6.3328,0]},{"i":135,"v":[1519596000,6.3328,6.3372,6.3041,6.3114,0]},{"i":136,"v":[1519682400,6.3114,6.3171,6.2942,6.3168,0]},{"i":137,"v":[1519768800,6.3168,6.3338,6.3168,6.3279,0]},{"i":138,"v":[1519855200,6.3286,6.3584,6.3286,6.3564,0]},{"i":139,"v":[1519941600,6.3564,6.36,6.3389,6.3427,0]},{"i":140,"v":[1520200800,6.3427,6.3491,6.3285,6.349,0]},{"i":141,"v":[1520287200,6.3495,6.3495,6.3092,6.3092,0]},{"i":142,"v":[1520373600,6.3121,6.3302,6.3102,6.3224,0]},{"i":143,"v":[1520460000,6.3229,6.339,6.3229,6.3388,0]},{"i":144,"v":[1520546400,6.3388,6.3515,6.3284,6.3284,0]},{"i":145,"v":[1520805600,6.327,6.3327,6.322,6.326,0]},{"i":146,"v":[1520892000,6.3269,6.3325,6.3179,6.3179,0]},{"i":147,"v":[1520978400,6.3191,6.322,6.3069,6.314,0]},{"i":148,"v":[1521064800,6.3139,6.3224,6.3061,6.3201,0]},{"i":149,"v":[1521151200,6.322,6.3326,6.3211,6.3299,0]},{"i":150,"v":[1521410400,6.3299,6.3365,6.328,6.328,0]},{"i":151,"v":[1521496800,6.327,6.333,6.3243,6.332,0]},{"i":152,"v":[1521583200,6.334,6.334,6.3199,6.3199,0]},{"i":153,"v":[1521669600,6.3207,6.332,6.3124,6.3309,0]},{"i":154,"v":[1521756000,6.3325,6.3331,6.3109,6.3109,0]},{"i":155,"v":[1522015200,6.3109,6.3159,6.2694,6.2705,0]},{"i":156,"v":[1522101600,6.2684,6.2815,6.2419,6.2805,0]},{"i":157,"v":[1522188000,6.278,6.2976,6.2681,6.2954,0]},{"i":158,"v":[1522274400,6.2945,6.304,6.2819,6.2875,0]},{"i":159,"v":[1522360800,6.2875,6.2875,6.2642,6.2728,0]},{"i":160,"v":[1522620000,6.2725,6.2815,6.2682,6.2804,0]},{"i":161,"v":[1522706400,6.2784,6.2898,6.2784,6.2898,0]},{"i":162,"v":[1522792800,6.288,6.3091,6.2852,6.3051,0]},{"i":163,"v":[1522879200,6.3044,6.3051,6.3044,6.3051,0]},{"i":164,"v":[1522965600,6.3044,6.3045,6.3044,6.3044,0]},{"i":165,"v":[1523224800,6.3044,6.3167,6.2949,6.3034,0]},{"i":166,"v":[1523311200,6.3034,6.3067,6.2802,6.2807,0]},{"i":167,"v":[1523397600,6.2797,6.2875,6.2654,6.2654,0]},{"i":168,"v":[1523484000,6.2654,6.2903,6.2654,6.289,0]},{"i":169,"v":[1523570400,6.2875,6.2927,6.2724,6.2724,0]},{"i":170,"v":[1523829600,6.2725,6.2861,6.2725,6.2751,0]},{"i":171,"v":[1523916000,6.2751,6.2848,6.2722,6.2825,0]},{"i":172,"v":[1524002400,6.2803,6.2896,6.2708,6.2743,0]},{"i":173,"v":[1524088800,6.2721,6.2804,6.2616,6.2766,0]},{"i":174,"v":[1524175200,6.2764,6.2965,6.2764,6.2944,0]},{"i":175,"v":[1524434400,6.2945,6.317,6.2892,6.315,0]},{"i":176,"v":[1524520800,6.3157,6.3196,6.3034,6.3034,0]},{"i":177,"v":[1524607200,6.3034,6.3268,6.3013,6.3241,0]},{"i":178,"v":[1524693600,6.3235,6.3343,6.3197,6.3339,0]},{"i":179,"v":[1524780000,6.3339,6.3464,6.3283,6.3324,0]},{"i":180,"v":[1525039200,6.3324,6.3332,6.309,6.3324,0]},{"i":181,"v":[1525125600,6.3324,6.3332,6.3324,6.3325,0]},{"i":182,"v":[1525212000,6.3525,6.3643,6.3525,6.3609,0]},{"i":183,"v":[1525298400,6.3609,6.3694,6.3464,6.3536,0]},{"i":184,"v":[1525384800,6.3519,6.3631,6.342,6.3588,0]},{"i":185,"v":[1525644000,6.3588,6.3665,6.3469,6.3642,0]},{"i":186,"v":[1525730400,6.3639,6.3706,6.3598,6.3706,0]},{"i":187,"v":[1525816800,6.3689,6.3821,6.3577,6.3584,0]},{"i":188,"v":[1525903200,6.3584,6.3689,6.3405,6.3467,0]},{"i":189,"v":[1525989600,6.3439,6.3482,6.3256,6.3313,0]},{"i":190,"v":[1526248800,6.3332,6.3405,6.3314,6.3359,0]},{"i":191,"v":[1526335200,6.3359,6.3786,6.3359,6.3777,0]},{"i":192,"v":[1526421600,6.3759,6.3794,6.3647,6.3705,0]},{"i":193,"v":[1526508000,6.3705,6.3705,6.3556,6.3644,0]},{"i":194,"v":[1526594400,6.3644,6.3785,6.3644,6.3767,0]},{"i":195,"v":[1526853600,6.3775,6.3926,6.3764,6.3834,0]},{"i":196,"v":[1526940000,6.371,6.3777,6.3651,6.366,0]},{"i":197,"v":[1527026400,6.3659,6.3903,6.3659,6.3884,0]},{"i":198,"v":[1527112800,6.387,6.3946,6.3758,6.3758,0]},{"i":199,"v":[1527199200,6.375,6.3914,6.375,6.3902,0]},{"i":200,"v":[1527458400,6.3902,6.3993,6.3884,6.3979,0]},{"i":201,"v":[1527544800,6.3979,6.4215,6.3979,6.4161,0]},{"i":202,"v":[1527631200,6.4161,6.4329,6.4155,6.4189,0]},{"i":203,"v":[1527717600,6.4174,6.4174,6.3997,6.4095,0]},{"i":204,"v":[1527804000,6.4095,6.4193,6.4076,6.4179,0]},{"i":205,"v":[1528063200,6.4179,6.4228,6.4021,6.4049,0]},{"i":206,"v":[1528149600,6.4049,6.4125,6.4002,6.406,0]},{"i":207,"v":[1528236000,6.4041,6.4041,6.3837,6.3859,0]},{"i":208,"v":[1528322400,6.3849,6.3955,6.3849,6.3896,0]},{"i":209,"v":[1528408800,6.3889,6.4112,6.3889,6.403,0]},{"i":210,"v":[1528668000,6.403,6.4082,6.4004,6.4017,0]},{"i":211,"v":[1528754400,6.3999,6.4086,6.3991,6.3991,0]},{"i":212,"v":[1528840800,6.3991,6.41,6.3938,6.3959,0]},{"i":213,"v":[1528927200,6.3928,6.401,6.39,6.3979,0]},{"i":214,"v":[1529013600,6.418,6.438,6.4125,6.438,0]},{"i":215,"v":[1529272800,6.4379,6.4393,6.4378,6.4378,0]},{"i":216,"v":[1529359200,6.4378,6.4829,6.4378,6.4801,0]},{"i":217,"v":[1529445600,6.4801,6.4801,6.4639,6.4712,0]},{"i":218,"v":[1529532000,6.4712,6.506,6.4712,6.4899,0]},{"i":219,"v":[1529618400,6.4899,6.5065,6.4899,6.5026,0]},{"i":220,"v":[1529877600,6.5026,6.5434,6.5008,6.5385,0]},{"i":221,"v":[1529964000,6.534,6.5796,6.534,6.5768,0]},{"i":222,"v":[1530050400,6.5758,6.6145,6.5758,6.6058,0]},{"i":223,"v":[1530136800,6.5991,6.63,6.5991,6.6246,0]},{"i":224,"v":[1530223200,6.6234,6.639,6.6055,6.617,0]},{"i":225,"v":[1530482400,6.617,6.666,6.617,6.6631,0]},{"i":226,"v":[1530568800,6.6631,6.7167,6.6362,6.64,0]},{"i":227,"v":[1530655200,6.6335,6.6359,6.6014,6.6289,0]},{"i":228,"v":[1530741600,6.6289,6.6447,6.6278,6.634,0]},{"i":229,"v":[1530828000,6.634,6.6645,6.634,6.6395,0]},{"i":230,"v":[1531087200,6.6411,6.6411,6.6117,6.6122,0]},{"i":231,"v":[1531173600,6.6002,6.635,6.5989,6.6315,0]},{"i":232,"v":[1531260000,6.6295,6.6801,6.6295,6.6801,0]},{"i":233,"v":[1531346400,6.6763,6.702,6.6632,6.6653,0]},{"i":234,"v":[1531432800,6.6629,6.7037,6.6518,6.6899,0]},{"i":235,"v":[1531692000,6.6899,6.7041,6.6715,6.6865,0]},{"i":236,"v":[1531778400,6.6865,6.704,6.6722,6.7017,0]},{"i":237,"v":[1531864800,6.7017,6.7196,6.6959,6.7164,0]},{"i":238,"v":[1531951200,6.716,6.787,6.716,6.77,0]},{"i":239,"v":[1532037600,6.77,6.8105,6.7658,6.7658,0]},{"i":240,"v":[1532296800,6.7684,6.7961,6.7412,6.7926,0]},{"i":241,"v":[1532383200,6.8142,6.8245,6.792,6.7966,0]},{"i":242,"v":[1532469600,6.7911,6.8048,6.7543,6.7657,0]},{"i":243,"v":[1532556000,6.7657,6.7903,6.7369,6.7903,0]},{"i":244,"v":[1532642400,6.7864,6.8368,6.7864,6.8096,0]},{"i":245,"v":[1532901600,6.8112,6.8388,6.8101,6.8101,0]},{"i":246,"v":[1532988000,6.8101,6.836,6.8037,6.8037,0]},{"i":247,"v":[1533074400,6.8037,6.8296,6.7894,6.8205,0]},{"i":248,"v":[1533160800,6.8153,6.8465,6.8054,6.8379,0]},{"i":249,"v":[1533247200,6.8379,6.8925,6.8308,6.8308,0]},{"i":250,"v":[1533506400,6.8331,6.851,6.7984,6.851,0]},{"i":251,"v":[1533592800,6.8499,6.8619,6.8194,6.8289,0]},{"i":252,"v":[1533679200,6.8279,6.8399,6.7997,6.8343,0]},{"i":253,"v":[1533765600,6.8343,6.8369,6.8128,6.8209,0]},{"i":254,"v":[1533852000,6.8198,6.8595,6.8198,6.8457,0]},{"i":255,"v":[1534111200,6.8457,6.8887,6.8457,6.8887,0]},{"i":256,"v":[1534197600,6.8837,6.8938,6.8774,6.8818,0]},{"i":257,"v":[1534284000,6.8904,6.9347,6.8869,6.9347,0]},{"i":258,"v":[1534370400,6.9329,6.9329,6.8792,6.8828,0]},{"i":259,"v":[1534456800,6.8791,6.8931,6.8661,6.8739,0]},{"i":260,"v":[1534716000,6.875,6.8774,6.8444,6.8545,0]},{"i":261,"v":[1534802400,6.8545,6.8546,6.8319,6.8447,0]},{"i":262,"v":[1534888800,6.8443,6.8471,6.838,6.8417,0]},{"i":263,"v":[1534975200,6.8399,6.8768,6.8399,6.8747,0]},{"i":264,"v":[1535061600,6.8747,6.8906,6.802,6.802,0]},{"i":265,"v":[1535320800,6.8029,6.8253,6.8029,6.8145,0]},{"i":266,"v":[1535407200,6.8144,6.8201,6.7981,6.8018,0]},{"i":267,"v":[1535493600,6.799,6.8275,6.799,6.8212,0]},{"i":268,"v":[1535580000,6.8189,6.842,6.8189,6.842,0]},{"i":269,"v":[1535666400,6.8414,6.847,6.8224,6.8299,0]},{"i":270,"v":[1535925600,6.83,6.8441,6.8155,6.8203,0]},{"i":271,"v":[1536012000,6.8199,6.8442,6.8095,6.8426,0]},{"i":272,"v":[1536098400,6.8426,6.8433,6.8266,6.828,0]},{"i":273,"v":[1536184800,6.8269,6.839,6.8215,6.833,0]},{"i":274,"v":[1536271200,6.8321,6.8479,6.8255,6.8418,0]},{"i":275,"v":[1536530400,6.8418,6.8656,6.8418,6.8555,0]},{"i":276,"v":[1536616800,6.863,6.8764,6.8565,6.8705,0]},{"i":277,"v":[1536703200,6.8703,6.8792,6.8492,6.8492,0]},{"i":278,"v":[1536789600,6.8341,6.85,6.8251,6.8422,0]},{"i":279,"v":[1536876000,6.8406,6.8673,6.8406,6.8672,0]},{"i":280,"v":[1537135200,6.8672,6.875,6.8537,6.8545,0]},{"i":281,"v":[1537221600,6.8539,6.8781,6.8536,6.859,0]},{"i":282,"v":[1537308000,6.8635,6.8658,6.8465,6.8465,0]},{"i":283,"v":[1537394400,6.8465,6.857,6.84,6.8467,0]},{"i":284,"v":[1537480800,6.845,6.8592,6.8334,6.8558,0]},{"i":285,"v":[1537740000,6.8559,6.857,6.8559,6.8559,0]},{"i":286,"v":[1537826400,6.8558,6.8808,6.8558,6.8675,0]},{"i":287,"v":[1537912800,6.8711,6.8785,6.8694,6.8785,0]},{"i":288,"v":[1537999200,6.8762,6.891,6.8687,6.8879,0]},{"i":289,"v":[1538085600,6.8879,6.8895,6.8679,6.8679,0]},{"i":290,"v":[1538344800,6.868,6.8688,6.868,6.8688,0]},{"i":291,"v":[1538431200,6.8679,6.8688,6.8679,6.8688,0]},{"i":292,"v":[1538517600,6.8679,6.8688,6.8679,6.8688,0]},{"i":293,"v":[1538604000,6.8679,6.8688,6.8679,6.8688,0]},{"i":294,"v":[1538690400,6.8679,6.868,6.8679,6.8679,0]},{"i":295,"v":[1538949600,6.8679,6.9319,6.8679,6.9289,0]},{"i":296,"v":[1539036000,6.9288,6.9289,6.9081,6.9217,0]},{"i":297,"v":[1539122400,6.9216,6.9242,6.9159,6.9242,0]},{"i":298,"v":[1539208800,6.9223,6.933,6.8889,6.8898,0]},{"i":299,"v":[1539295200,6.8872,6.9168,6.8872,6.9167,0]}],"ns":{"d":"","indexes":[]},"t":"s1"}},{"index":0,"zoffset":0,"changes":[1503007200,1503266400,1503352800,1503439200,1503525600,1503612000,1503871200,1503957600,1504044000,1504130400,1504216800,1504476000,1504562400,1504648800,1504735200,1504821600,1505080800,1505167200,1505253600,1505340000,1505426400,1505685600,1505858400,1505944800,1506031200,1506290400,1506376800,1506463200,1506549600,1506636000,1506895200,1506981600,1507068000,1507154400,1507240800,1507500000,1507586400,1507672800,1507759200,1507845600,1508104800,1508191200,1508277600,1508364000,1508450400,1508709600,1508796000,1508882400,1508968800,1509055200,1509314400,1509400800,1509487200,1509573600,1509660000,1509919200,1510005600,1510092000,1510178400,1510264800,1510524000,1510610400,1510696800,1510783200,1510869600,1511128800,1511215200,1511301600,1511388000,1511474400,1511733600,1511820000,1511906400,1511992800,1512079200,1512338400,1512424800,1512511200,1512597600,1512684000,1512943200,1513029600,1513116000,1513202400,1513288800,1513548000,1513634400,1513720800,1513807200,1513893600,1514152800,1514239200,1514325600,1514412000,1514498400,1514757600,1514844000,1514930400,1515016800,1515103200,1515362400,1515448800,1515535200,1515621600,1515708000,1515967200,1516053600,1516140000,1516226400,1516312800,1516572000,1516658400,1516744800,1516831200,1516917600,1517176800,1517263200,1517349600,1517436000,1517522400,1517781600,1517868000,1517954400,1518040800,1518127200,1518386400,1518472800,1518559200,1518645600,1518732000,1518991200,1519077600,1519164000,1519250400,1519336800,1519596000,1519682400,1519768800,1519855200,1519941600,1520200800,1520287200,1520373600,1520460000,1520546400,1520805600,1520892000,1520978400,1521064800,1521151200,1521410400,1521496800,1521583200,1521669600,1521756000,1522015200,1522101600,1522188000,1522274400,1522360800,1522620000,1522706400,1522792800,1522879200,1522965600,1523224800,1523311200,1523397600,1523484000,1523570400,1523829600,1523916000,1524002400,1524088800,1524175200,1524434400,1524520800,1524607200,1524693600,1524780000,1525039200,1525125600,1525212000,1525298400,1525384800,1525644000,1525730400,1525816800,1525903200,1525989600,1526248800,1526335200,1526421600,1526508000,1526594400,1526853600,1526940000,1527026400,1527112800,1527199200,1527458400,1527544800,1527631200,1527717600,1527804000,1528063200,1528149600,1528236000,1528322400,1528408800,1528668000,1528754400,1528840800,1528927200,1529013600,1529272800,1529359200,1529445600,1529532000,1529618400,1529877600,1529964000,1530050400,1530136800,1530223200,1530482400,1530568800,1530655200,1530741600,1530828000,1531087200,1531173600,1531260000,1531346400,1531432800,1531692000,1531778400,1531864800,1531951200,1532037600,1532296800,1532383200,1532469600,1532556000,1532642400,1532901600,1532988000,1533074400,1533160800,1533247200,1533506400,1533592800,1533679200,1533765600,1533852000,1534111200,1534197600,1534284000,1534370400,1534456800,1534716000,1534802400,1534888800,1534975200,1535061600,1535320800,1535407200,1535493600,1535580000,1535666400,1535925600,1536012000,1536098400,1536184800,1536271200,1536530400,1536616800,1536703200,1536789600,1536876000,1537135200,1537221600,1537308000,1537394400,1537480800,1537740000,1537826400,1537912800,1537999200,1538085600,1538344800,1538431200,1538517600,1538604000,1538690400,1538949600,1539036000,1539122400,1539208800,1539295200],"marks":[[20,1503014400,0],[50,1503273600,1],[40,1503360000,2],[40,1503446400,3],[40,1503532800,4],[40,1503619200,5],[50,1503878400,6],[40,1503964800,7],[40,1504051200,8],[40,1504137600,9],[60,1504224000,10],[50,1504483200,11],[40,1504569600,12],[40,1504656000,13],[40,1504742400,14],[40,1504828800,15],[50,1505088000,16],[40,1505174400,17],[40,1505260800,18],[40,1505347200,19],[40,1505433600,20],[50,1505692800,21],[40,1505865600,22],[40,1505952000,23],[40,1506038400,24],[50,1506297600,25],[40,1506384000,26],[40,1506470400,27],[40,1506556800,28],[40,1506643200,29],[60,1506902400,30],[40,1506988800,31],[40,1507075200,32],[40,1507161600,33],[40,1507248000,34],[50,1507507200,35],[40,1507593600,36],[40,1507680000,37],[40,1507766400,38],[40,1507852800,39],[50,1508112000,40],[40,1508198400,41],[40,1508284800,42],[40,1508371200,43],[40,1508457600,44],[50,1508716800,45],[40,1508803200,46],[40,1508889600,47],[40,1508976000,48],[40,1509062400,49],[50,1509321600,50],[40,1509408000,51],[60,1509494400,52],[40,1509580800,53],[40,1509667200,54],[50,1509926400,55],[40,1510012800,56],[40,1510099200,57],[40,1510185600,58],[40,1510272000,59],[50,1510531200,60],[40,1510617600,61],[40,1510704000,62],[40,1510790400,63],[40,1510876800,64],[50,1511136000,65],[40,1511222400,66],[40,1511308800,67],[40,1511395200,68],[40,1511481600,69],[50,1511740800,70],[40,1511827200,71],[40,1511913600,72],[40,1512000000,73],[60,1512086400,74],[50,1512345600,75],[40,1512432000,76],[40,1512518400,77],[40,1512604800,78],[40,1512691200,79],[50,1512950400,80],[40,1513036800,81],[40,1513123200,82],[40,1513209600,83],[40,1513296000,84],[50,1513555200,85],[40,1513641600,86],[40,1513728000,87],[40,1513814400,88],[40,1513900800,89],[50,1514160000,90],[40,1514246400,91],[40,1514332800,92],[40,1514419200,93],[40,1514505600,94],[70,1514764800,95],[40,1514851200,96],[40,1514937600,97],[40,1515024000,98],[40,1515110400,99],[50,1515369600,100],[40,1515456000,101],[40,1515542400,102],[40,1515628800,103],[40,1515715200,104],[50,1515974400,105],[40,1516060800,106],[40,1516147200,107],[40,1516233600,108],[40,1516320000,109],[50,1516579200,110],[40,1516665600,111],[40,1516752000,112],[40,1516838400,113],[40,1516924800,114],[50,1517184000,115],[40,1517270400,116],[40,1517356800,117],[60,1517443200,118],[40,1517529600,119],[50,1517788800,120],[40,1517875200,121],[40,1517961600,122],[40,1518048000,123],[40,1518134400,124],[50,1518393600,125],[40,1518480000,126],[40,1518566400,127],[40,1518652800,128],[40,1518739200,129],[50,1518998400,130],[40,1519084800,131],[40,1519171200,132],[40,1519257600,133],[40,1519344000,134],[50,1519603200,135],[40,1519689600,136],[40,1519776000,137],[60,1519862400,138],[40,1519948800,139],[50,1520208000,140],[40,1520294400,141],[40,1520380800,142],[40,1520467200,143],[40,1520553600,144],[50,1520812800,145],[40,1520899200,146],[40,1520985600,147],[40,1521072000,148],[40,1521158400,149],[50,1521417600,150],[40,1521504000,151],[40,1521590400,152],[40,1521676800,153],[40,1521763200,154],[50,1522022400,155],[40,1522108800,156],[40,1522195200,157],[40,1522281600,158],[40,1522368000,159],[60,1522627200,160],[40,1522713600,161],[40,1522800000,162],[40,1522886400,163],[40,1522972800,164],[50,1523232000,165],[40,1523318400,166],[40,1523404800,167],[40,1523491200,168],[40,1523577600,169],[50,1523836800,170],[40,1523923200,171],[40,1524009600,172],[40,1524096000,173],[40,1524182400,174],[50,1524441600,175],[40,1524528000,176],[40,1524614400,177],[40,1524700800,178],[40,1524787200,179],[50,1525046400,180],[60,1525132800,181],[40,1525219200,182],[40,1525305600,183],[40,1525392000,184],[50,1525651200,185],[40,1525737600,186],[40,1525824000,187],[40,1525910400,188],[40,1525996800,189],[50,1526256000,190],[40,1526342400,191],[40,1526428800,192],[40,1526515200,193],[40,1526601600,194],[50,1526860800,195],[40,1526947200,196],[40,1527033600,197],[40,1527120000,198],[40,1527206400,199],[50,1527465600,200],[40,1527552000,201],[40,1527638400,202],[40,1527724800,203],[60,1527811200,204],[50,1528070400,205],[40,1528156800,206],[40,1528243200,207],[40,1528329600,208],[40,1528416000,209],[50,1528675200,210],[40,1528761600,211],[40,1528848000,212],[40,1528934400,213],[40,1529020800,214],[50,1529280000,215],[40,1529366400,216],[40,1529452800,217],[40,1529539200,218],[40,1529625600,219],[50,1529884800,220],[40,1529971200,221],[40,1530057600,222],[40,1530144000,223],[40,1530230400,224],[60,1530489600,225],[40,1530576000,226],[40,1530662400,227],[40,1530748800,228],[40,1530835200,229],[50,1531094400,230],[40,1531180800,231],[40,1531267200,232],[40,1531353600,233],[40,1531440000,234],[50,1531699200,235],[40,1531785600,236],[40,1531872000,237],[40,1531958400,238],[40,1532044800,239],[50,1532304000,240],[40,1532390400,241],[40,1532476800,242],[40,1532563200,243],[40,1532649600,244],[50,1532908800,245],[40,1532995200,246],[60,1533081600,247],[40,1533168000,248],[40,1533254400,249],[50,1533513600,250],[40,1533600000,251],[40,1533686400,252],[40,1533772800,253],[40,1533859200,254],[50,1534118400,255],[40,1534204800,256],[40,1534291200,257],[40,1534377600,258],[40,1534464000,259],[50,1534723200,260],[40,1534809600,261],[40,1534896000,262],[40,1534982400,263],[40,1535068800,264],[50,1535328000,265],[40,1535414400,266],[40,1535500800,267],[40,1535587200,268],[40,1535673600,269],[60,1535932800,270],[40,1536019200,271],[40,1536105600,272],[40,1536192000,273],[40,1536278400,274],[50,1536537600,275],[40,1536624000,276],[40,1536710400,277],[40,1536796800,278],[40,1536883200,279],[50,1537142400,280],[40,1537228800,281],[40,1537315200,282],[40,1537401600,283],[40,1537488000,284],[50,1537747200,285],[40,1537833600,286],[40,1537920000,287],[40,1538006400,288],[40,1538092800,289],[60,1538352000,290],[40,1538438400,291],[40,1538524800,292],[40,1538611200,293],[40,1538697600,294],[50,1538956800,295],[40,1539043200,296],[40,1539129600,297],[40,1539216000,298],[40,1539302400,299]],"index_diff":[]},1539326662]}'''
data = json.loads(data)
data = jsonpath.jsonpath(data, '$..v')
data = data

client = MongoClient('0.0.0.0', 0)
collection = client["BOOMHASH"]["USD_CNY_OLD"]
for i in data:
    print(i[0])
    SunMongodb.insert_mongo(collection, dict(time=i[0], value=i[4]))
Example #5
0
import json
import time

import jsonpath
from pymongo import MongoClient
from SunMongo import SunMongodb

data = '''{"des":"","isSuc":true,"datas":{"marketName":"**","symbol":"usdtqc","contractUnit":"**","data":[[1517414400000,6.2,6.8,6.2,6.509,1794550.8725],[1517500800000,6.509,6.5497,6.2003,6.4243,2289558.6419],[1517587200000,6.4243,6.475,6.3921,6.4,2938557.5115],[1517673600000,6.4,6.6,6.4,6.5399,2545751.4833],[1517760000000,6.5399,6.6295,6.4513,6.5884,3439555.7422],[1517846400000,6.5885,6.7792,6.5,6.5379,3980208.3351],[1517932800000,6.538,6.5758,6.4,6.4221,4182390.2111],[1518019200000,6.4218,6.565,6.4016,6.4704,2105699.0085],[1518105600000,6.474,6.548,6.4304,6.4611,2257106.7426],[1518192000000,6.4611,6.6092,6.457,6.6092,4098773.982],[1518278400000,6.6091,6.68,6.5065,6.589,3202906.5602],[1518364800000,6.5887,6.64,6.405,6.4728,3073627.0957],[1518451200000,6.4657,6.58,6.41,6.5411,3036337.3249],[1518537600000,6.5419,6.5858,6.4,6.5487,5689444.6377],[1518624000000,6.5489,6.63,6.455,6.465,5556173.8283],[1518710400000,6.465,6.55,6.4268,6.5029,5091822.7144],[1518796800000,6.5029,6.666,6.501,6.5439,5392062.7641],[1518883200000,6.5437,6.615,6.455,6.6007,10562169.0284],[1518969600000,6.6007,6.7499,6.5216,6.5317,5331488.2932],[1519056000000,6.5317,6.595,6.5,6.5569,6156140.3852],[1519142400000,6.5579,6.74,6.5262,6.6404,6678688.2497],[1519228800000,6.6401,6.7497,6.533,6.533,6777224.7126],[1519315200000,6.537,6.595,6.5112,6.535,4400313.0062],[1519401600000,6.5362,6.595,6.4015,6.4085,7110046.2744],[1519488000000,6.4086,6.433,6.3902,6.402,4215068.6245],[1519574400000,6.4019,6.492,6.3917,6.4745,3538937.1026],[1519660800000,6.4781,6.525,6.4331,6.482,4682924.9663],[1519747200000,6.4822,6.555,6.444,6.5434,3956930.7791],[1519833600000,6.5421,6.58,6.4955,6.5025,2914881.1557],[1519920000000,6.5032,6.5285,6.461,6.519,2231708.5654],[1520006400000,6.5168,6.519,6.4553,6.4558,2421639.4915],[1520092800000,6.4554,6.492,6.44,6.4601,1878871.3871],[1520179200000,6.4601,6.4761,6.4103,6.4349,3592699.122],[1520265600000,6.4347,6.5,6.4102,6.448,18369656.3404],[1520352000000,6.4489,6.4999,6.436,6.4798,14350564.8953],[1520438400000,6.4797,6.63,6.4735,6.5561,27788428.6521],[1520524800000,6.5568,6.68,6.5542,6.623,18392153.8028],[1520611200000,6.6218,6.68,6.57,6.5781,11972270.0624],[1520697600000,6.5834,6.745,6.55,6.62,13356092.5776],[1520784000000,6.6197,6.625,6.5167,6.58,10486447.5411],[1520870400000,6.5814,6.6399,6.533,6.59,14073657.4636],[1520956800000,6.5913,6.6337,6.531,6.57,11462935.7003],[1521043200000,6.5705,6.745,6.5652,6.627,22716957.3248],[1521129600000,6.6269,6.6815,6.536,6.5422,14416532.815],[1521216000000,6.5457,6.605,6.5356,6.585,9465195.994],[1521302400000,6.5858,6.69,6.57,6.6338,14173369.8219],[1521388800000,6.6328,6.6703,6.52,6.5213,21988605.9585],[1521475200000,6.5213,6.5744,6.4711,6.5252,17309751.6655],[1521561600000,6.5223,6.5488,6.476,6.4906,18363746.0023],[1521648000000,6.4905,6.55,6.4455,6.5392,21767515.4142],[1521734400000,6.5387,6.59,6.535,6.5628,18294010.9437],[1521820800000,6.5623,6.58,6.511,6.525,13401178.3573],[1521907200000,6.525,6.5722,6.505,6.5361,16683724.182],[1521993600000,6.5353,6.56,6.5062,6.5315,25389438.7653],[1522080000000,6.5321,6.5678,6.485,6.5109,38294821.8655],[1522166400000,6.5107,6.5399,6.47,6.4795,27600200.2738],[1522252800000,6.4795,6.5302,6.4669,6.5136,25369232.8287],[1522339200000,6.5137,6.615,6.5,6.58,39101145.0004],[1522425600000,6.5801,6.6362,6.535,6.5433,18513872.2164],[1522512000000,6.5439,6.6099,6.5252,6.6045,14868839.5365],[1522598400000,6.6038,6.61,6.5104,6.528,13900328.188],[1522684800000,6.5284,6.5442,6.445,6.4605,20775569.5177],[1522771200000,6.4607,6.523,6.4323,6.5199,16117093.2833],[1522857600000,6.516,6.559,6.4662,6.4866,21013879.2828],[1522944000000,6.4871,6.535,6.455,6.5062,16232029.4113],[1523030400000,6.5062,6.52,6.4555,6.4556,10935202.3148],[1523116800000,6.4559,6.4678,6.4123,6.4178,10911099.2943],[1523203200000,6.4178,6.4759,6.3917,6.473,15716926.2306],[1523289600000,6.4728,6.505,6.4381,6.441,10939748.7999],[1523376000000,6.441,6.4475,6.3917,6.3917,24173691.9077],[1523462400000,6.3929,6.4418,6.3006,6.3417,50321684.9197],[1523548800000,6.3415,6.45,6.311,6.4303,36062204.7885],[1523635200000,6.4307,6.475,6.35,6.4034,36724360.0299],[1523721600000,6.4034,6.4298,6.32,6.3584,30575657.3906],[1523808000000,6.3583,6.4,6.367,6.3986,7771940.275],[1523894400000,6.3986,6.3998,6.352,6.3712,49977443.9101],[1523980800000,6.3711,6.44,6.3559,6.3789,28352869.1272],[1524067200000,6.3788,6.385,6.3,6.3653,25263815.5556],[1524153600000,6.3652,6.4418,6.355,6.4049,34969187.4664],[1524240000000,6.4045,6.505,6.395,6.4669,43998226.7974],[1524326400000,6.4669,7.1421,6.361,6.3999,39999229.682],[1524412800000,6.3992,6.46,6.376,6.4116,25632144.7162],[1524499200000,6.4116,6.44,6.3403,6.4072,35900706.5446],[1524585600000,6.4071,6.4488,6.3,6.4118,60241698.7047],[1524672000000,6.4119,6.54,6.352,6.511,45015646.188],[1524758400000,6.5111,6.5221,6.2761,6.4124,113747562.7349],[1524844800000,6.3988,6.4643,6.377,6.419,48128142.5037],[1524931200000,6.41,6.4597,6.391,6.4108,12019132.5617],[1525017600000,6.4104,6.5321,6.4031,6.4251,12415915.1491],[1525104000000,6.425,6.533,6.39,6.4743,10827111.6755],[1525190400000,6.4731,6.58,6.4446,6.506,10243698.1024],[1525276800000,6.5061,6.57,6.44,6.5449,54261245.0135],[1525363200000,6.5443,6.5616,6.471,6.4867,49629055.8345],[1525449600000,6.4863,6.545,6.48,6.541,55083228.627],[1525536000000,6.5408,6.62,6.4961,6.5511,61726217.6655],[1525622400000,6.5513,6.677,6.543,6.6243,49638620.5058],[1525708800000,6.6243,6.64,6.57,6.6097,42594719.1736],[1525795200000,6.6092,6.6599,6.5905,6.591,39847980.7817],[1525881600000,6.5912,6.6131,6.5205,6.5391,30584063.3927],[1525968000000,6.539,6.7812,6.5379,6.6704,104171019.1354],[1526054400000,6.6701,6.7,6.4843,6.613,89452987.0319],[1526140800000,6.6133,6.6797,6.5801,6.6599,39757905.054],[1526227200000,6.6601,6.7,6.6244,6.6258,60700344.9326],[1526313600000,6.6258,6.6276,6.5302,6.5768,54257225.4678],[1526400000000,6.5768,6.6697,6.5677,6.5746,64851440.1254],[1526486400000,6.5741,6.5858,6.472,6.481,72652574.5024],[1526572800000,6.4818,6.624,6.4787,6.5905,62356280.3379],[1526659200000,6.5909,6.605,6.5406,6.578,21272510.1527],[1526745600000,6.5769,6.6,6.5476,6.572,22840203.0058],[1526832000000,6.5719,6.5726,6.5203,6.5321,22445419.095],[1526918400000,6.5322,6.5752,6.5268,6.566,17432558.4234],[1527004800000,6.566,6.6809,6.5579,6.6473,36996887.2614],[1527091200000,6.6467,6.75,6.6202,6.6388,37594215.7936],[1527177600000,6.6389,6.6416,6.5751,6.5769,28108423.8298],[1527264000000,6.577,6.6216,6.5658,6.568,20996618.3525],[1527350400000,6.5683,6.63,6.566,6.6,26708121.0461],[1527436800000,6.6,6.6366,6.595,6.6094,37613616.8488],[1527523200000,6.6098,6.6852,6.5903,6.596,38046664.993],[1527609600000,6.5956,6.5995,6.5563,6.5855,19438023.0031],[1527696000000,6.5855,6.6078,6.5301,6.5431,27798216.2179],[1527782400000,6.5439,6.576,6.524,6.5466,32802985.9876],[1527868800000,6.5466,6.5575,6.4782,6.5009,31377022.568],[1527955200000,6.501,6.5464,6.4663,6.4993,31897776.6651],[1528041600000,6.4992,6.53,6.4869,6.5265,26071529.796],[1528128000000,6.5267,6.5446,6.5051,6.5101,28568977.4764],[1528214400000,6.51,6.515,6.457,6.4586,22748131.76],[1528300800000,6.4579,6.4929,6.45,6.4685,22829095.4604],[1528387200000,6.4685,6.4979,6.4603,6.4784,20990428.5834],[1528473600000,6.478,6.4813,6.432,6.4499,28985173.7621],[1528560000000,6.45,6.5895,6.4468,6.5553,38212674.3542],[1528646400000,6.5559,6.6731,6.5401,6.56,67275926.8556],[1528732800000,6.5601,6.61,6.5301,6.591,26886542.2195],[1528819200000,6.5909,6.69,6.59,6.6329,37575609.9713],[1528905600000,6.6329,6.675,6.5876,6.625,31650305.7503],[1528992000000,6.6242,6.6249,6.555,6.5957,26573606.5913],[1529078400000,6.5957,6.6449,6.59,6.6353,21873245.9503],[1529164800000,6.634,6.6399,6.5958,6.6069,18468988.4928],[1529251200000,6.6068,6.6499,6.6051,6.6178,24267528.3614],[1529337600000,6.6178,6.6188,6.5707,6.5801,34794540.4754],[1529424000000,6.5802,6.61,6.5753,6.5753,31600620.366],[1529510400000,6.5753,6.5901,6.5691,6.5778,26438113.0764],[1529596800000,6.5779,6.68,6.5776,6.6732,46860369.6219],[1529683200000,6.6726,6.8494,6.6501,6.7063,36442850.1995],[1529769600000,6.7064,6.7699,6.671,6.7274,31023689.1792],[1529856000000,6.7275,6.8949,6.6716,6.6816,39298426.0513],[1529942400000,6.6838,6.7199,6.67,6.7168,28611624.0521],[1530028800000,6.7168,6.769,6.701,6.7349,31470712.5581],[1530115200000,6.735,6.7587,6.705,6.723,26327157.1837],[1530201600000,6.7232,6.78,6.7015,6.7546,34401486.1176],[1530288000000,6.7547,6.7559,6.6753,6.695,46079643.7305],[1530374400000,6.6974,6.715,6.6501,6.6607,30257410.0304],[1530460800000,6.6615,6.6959,6.6307,6.6374,32386546.9989],[1530547200000,6.6374,6.7346,6.622,6.7169,35463357.954],[1530633600000,6.7167,6.735,6.686,6.7099,30248855.2834],[1530720000000,6.7097,6.735,6.7001,6.7069,21015509.5681],[1530806400000,6.7068,6.735,6.7036,6.7159,30128296.6976],[1530892800000,6.7161,6.7197,6.6821,6.6958,17603960.9705],[1530979200000,6.6959,6.71,6.6265,6.6304,27903188.948],[1531065600000,6.6302,6.6699,6.6201,6.6297,15390991.7401],[1531152000000,6.63,6.6795,6.6291,6.6708,38004317.1155],[1531238400000,6.6696,6.709,6.646,6.6875,24727773.9652],[1531324800000,6.6871,6.7298,6.682,6.6924,18169063.3428],[1531411200000,6.6925,6.7147,6.671,6.7048,23765569.5385],[1531497600000,6.7049,6.7349,6.698,6.7274,14326285.8278],[1531584000000,6.7275,6.7349,6.701,6.7117,12847252.549],[1531670400000,6.7118,6.713,6.631,6.6417,23506022.978],[1531756800000,6.6415,6.6649,6.6123,6.6233,23887759.3066],[1531843200000,6.6248,6.6346,6.3457,6.5968,45943924.6954],[1531929600000,6.5967,6.665,6.5823,6.6597,26466124.4529],[1532016000000,6.6592,6.7239,6.6449,6.6754,35640400.0023],[1532102400000,6.6753,6.735,6.65,6.6945,29606906.5854],[1532188800000,6.6922,6.7248,6.6713,6.6739,11595302.6029],[1532275200000,6.674,6.71,6.6661,6.6954,26401057.7292],[1532361600000,6.6959,6.7795,6.6914,6.7264,38917525.8727],[1532448000000,6.7263,6.7635,6.7256,6.7456,26873539.2115],[1532534400000,6.7455,6.7527,6.7002,6.7317,22347809.732],[1532620800000,6.7317,6.8119,6.726,6.7484,39698996.4895],[1532707200000,6.7483,6.7633,6.741,6.7482,42517818.6817],[1532793600000,6.7485,6.7756,6.7465,6.7522,37468660.1668],[1532880000000,6.7523,6.769,6.742,6.7688,44665888.4426],[1532966400000,6.7688,6.8498,6.7551,6.8377,118413960.3716],[1533052800000,6.8375,6.906,6.8003,6.8379,75744616.7697],[1533139200000,6.8364,6.971,6.835,6.8873,71116976.4629],[1533225600000,6.8873,6.986,6.8725,6.8982,47382848.2414],[1533312000000,6.8982,6.9382,6.8811,6.9298,47572662.7271],[1533398400000,6.9299,6.96,6.9183,6.9346,40552022.0359],[1533484800000,6.9346,6.9388,6.894,6.9098,54882239.2066],[1533571200000,6.9098,6.9549,6.8867,6.8902,63484979.0372],[1533657600000,6.8902,7.2,6.8832,6.9726,145145621.9379],[1533744000000,6.9727,7.0588,6.9558,6.9571,86404893.3441],[1533830400000,6.9571,7.0166,6.9501,6.9881,44701491.4855],[1533916800000,6.9882,7.1699,6.9791,7.0831,87036887.5936],[1534003200000,7.0834,7.0987,7.025,7.0519,50354138.3276],[1534089600000,7.0517,7.0935,7.0258,7.0692,56350519.4606],[1534176000000,7.0655,7.11,7.0401,7.064,93827782.3227],[1534262400000,7.0643,7.0721,7.0013,7.009,96692930.5067],[1534348800000,7.0091,7.057,6.98,6.9879,80060897.0465],[1534435200000,6.9881,7.0189,6.9363,6.9555,62563814.3188],[1534521600000,6.957,7.029,6.905,7.0121,88937555.0727],[1534608000000,7.012,7.0322,6.9711,6.9916,79753750.687],[1534694400000,6.9919,7.008,6.9557,6.9727,46280816.2981],[1534780800000,6.9707,7.018,6.95,6.9506,67170308.0813],[1534867200000,6.9505,6.956,6.86,6.9096,73036975.1444],[1534953600000,6.9095,6.96,6.9072,6.9319,54152229.6446],[1535040000000,6.932,6.9344,6.8801,6.8845,40636062.5395],[1535126400000,6.884,6.8876,6.7999,6.8142,38013809.1569],[1535212800000,6.8143,6.8535,6.8056,6.8325,27044514.8141],[1535299200000,6.831,6.8449,6.77,6.7959,51895830.0432],[1535385600000,6.7967,6.8079,6.7195,6.7521,74467552.7172],[1535472000000,6.7523,6.7889,6.6116,6.7421,126323895.3371],[1535558400000,6.7421,6.8649,6.7358,6.8601,109011939.2799],[1535644800000,6.8601,6.885,6.8201,6.8651,90156962.7799],[1535731200000,6.8655,6.87,6.8131,6.8159,107192781.7139],[1535817600000,6.8154,6.87,6.8109,6.8459,132845982.4455],[1535904000000,6.846,6.8629,6.8164,6.8297,92867749.3829],[1535990400000,6.8307,6.8727,6.821,6.851,81029336.331],[1536076800000,6.8511,6.9848,6.842,6.9687,118315595.6334],[1536163200000,6.9692,7.1205,6.9527,6.9947,194608988.2124],[1536249600000,6.9949,7.0339,6.9701,6.9934,134085028.916],[1536336000000,6.9931,7.018,6.98,7.0008,82513832.4138],[1536422400000,7.0008,7.0598,6.961,6.9744,146984585.8178],[1536508800000,6.9746,7.0132,6.958,6.9777,140791065.7747],[1536595200000,6.9777,7.007,6.961,6.974,148797746.3493],[1536681600000,6.974,7,6.9623,6.9789,143577768.0321],[1536768000000,6.9787,6.9824,6.9032,6.9036,133210365.4811],[1536854400000,6.9035,6.9646,6.8845,6.9264,152887470.9494],[1536940800000,6.9263,6.935,6.9001,6.926,118400250.0674],[1537027200000,6.926,6.9496,6.9035,6.9237,113774998.9167],[1537113600000,6.9237,6.99,6.9022,6.9701,115303229.0018],[1537200000000,6.9701,7.0433,6.9322,6.9407,147141205.9481],[1537286400000,6.9413,6.955,6.9166,6.9221,94692418.3653],[1537372800000,6.9221,6.9746,6.8923,6.9008,108745601.7045],[1537459200000,6.901,6.916,6.821,6.836,196556308.2982],[1537545600000,6.836,6.866,6.7621,6.8524,159090308.4945],[1537632000000,6.8527,6.8586,6.804,6.8348,106652749.8121],[1537718400000,6.8349,6.8585,6.8111,6.854,129471197.7724],[1537804800000,6.8539,6.952,6.8332,6.9435,148688432.4455],[1537891200000,6.9435,6.9628,6.8918,6.899,139342430.5499],[1537977600000,6.8991,6.9288,6.8835,6.8876,129534164.2943],[1538064000000,6.8877,6.8955,6.8144,6.8416,157612868.142],[1538150400000,6.8415,6.9155,6.83,6.864,150240031.9596],[1538236800000,6.864,6.879,6.8307,6.8568,106663168.824],[1538323200000,6.8569,6.9399,6.8516,6.9092,159320644.5588],[1538409600000,6.9088,6.925,6.8759,6.9142,100353328.1611],[1538496000000,6.9142,6.9449,6.89,6.9242,126444838.6474],[1538582400000,6.9241,6.9378,6.89,6.8968,94822235.9249],[1538668800000,6.8968,6.9151,6.8766,6.8934,87743020.4614],[1538755200000,6.8935,6.9066,6.8741,6.9021,83651278.4215],[1538841600000,6.9022,6.924,6.895,6.9094,64155324.3706],[1538928000000,6.9095,6.9149,6.8821,6.885,62023310.0942],[1539014400000,6.885,6.8907,6.8585,6.8749,69103928.5061],[1539100800000,6.8749,6.8966,6.867,6.8911,58188172.0035],[1539187200000,6.8909,6.9835,6.8742,6.9572,149523091.9126],[1539273600000,6.9572,6.9957,6.943,6.9604,64026674.3512]],"moneyType":"cny","USDCNY":"**"}}'''
data = json.loads(data)

data = jsonpath.jsonpath(data, '$..data')
data = data[0]
client = MongoClient('0.0.0.0', 0)
collection = client["BOOMHASH"]["USDT_CNY_OLDS"]
for i in data:
    # print(i)
    times = int(i[0] / 1000)
    value = i[4]
    times = time.strftime("%Y--%m--%d 08:00:00", time.localtime(int(times)))

    timeArray = time.strptime(times, "%Y--%m--%d %H:%M:%S")
    times = int(time.mktime(timeArray))

    SunMongodb.insert_mongo(collection, dict(time=times, value=value))