├── Readme.md ├── jobsubmit.py ├── lambda_func.py ├── sample_data.json └── train_and_deploy.py /Readme.md: -------------------------------------------------------------------------------- 1 | # AWS SageMaker Example 2 | 3 | This is the source code for the Medium article 4 | https://medium.com/weareservian/machine-learning-on-aws-sagemaker-53e1a5e218d9 5 | 6 | The code actually do bitcoin price prediction based on moving average value. 7 | 8 | Before successfully runing this code, you may need to fill in your personal configurations (e.g. S3 bucket name) 9 | 10 | -------------------------------------------------------------------------------- /jobsubmit.py: -------------------------------------------------------------------------------- 1 | from sagemaker.sklearn import SKLearn 2 | # Initialise SDK 3 | sklearn_estimator = SKLearn( 4 | entry_point='train_and_deploy.py', 5 | role = 'arn:aws:iam::', 6 | # train_instance_type='ml.m4.xlarge', 7 | train_instance_type='local', 8 | output_path='s3:///', 9 | hyperparameters = { 10 | 'sagemaker_submit_directory': 's3://' 11 | }, 12 | code_location='s3://', 13 | framework_version='0.20.0' 14 | ) 15 | # Run model training job 16 | sklearn_estimator.fit({'train': 's3://'}) 17 | # Deploy trained model to an endpoint 18 | predictor = sklearn_estimator.deploy( 19 | # instance_type='ml.t2.medium', 20 | instance_type='local', 21 | initial_instance_count=1, 22 | endpoint_name='', 23 | ) -------------------------------------------------------------------------------- /lambda_func.py: -------------------------------------------------------------------------------- 1 | import json 2 | import boto3 3 | import time 4 | from datetime import datetime 5 | from botocore.vendored import requests 6 | 7 | src_path = 's3://.tar.gz' 8 | role_arn = 'arn:aws:iam::' 9 | endpoint_name='' 10 | 11 | 12 | def retrain_the_model(): 13 | now_str = datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S-%f') 14 | training_job_name = f'-{now_str}' 15 | sm = boto3.client('sagemaker') 16 | resp = sm.create_training_job( 17 | TrainingJobName = training_job_name, 18 | AlgorithmSpecification={ 19 | 'TrainingInputMode': 'File', 20 | 'TrainingImage': '783357654285.dkr.ecr..amazonaws.com/sagemaker-scikit-learn:0.20.0-cpu-py3', 21 | }, 22 | RoleArn=role_arn, 23 | InputDataConfig=[ 24 | { 25 | 'ChannelName': 'train', 26 | 'DataSource': { 27 | 'S3DataSource': { 28 | 'S3DataType': 'S3Prefix', 29 | 'S3Uri': 's3:///', 30 | 'S3DataDistributionType': 'FullyReplicated', 31 | } 32 | }, 33 | }, 34 | ], 35 | OutputDataConfig={ 36 | 'S3OutputPath': 's3:///' 37 | }, 38 | ResourceConfig={ 39 | 'InstanceType': 'ml.m4.xlarge', 40 | 'InstanceCount': 1, 41 | 'VolumeSizeInGB': 30, 42 | }, 43 | StoppingCondition={ 44 | 'MaxRuntimeInSeconds': 600 45 | }, 46 | HyperParameters={ 47 | 'sagemaker_submit_directory': 's3:///', 48 | 'sagemaker_program' : "train_and_deploy.py", 49 | 'sagemaker_region': "", 50 | 'sagemaker_job_name': training_job_name, 51 | 'sagemaker_submit_directory': src_path 52 | }, 53 | Tags=[] 54 | ) 55 | 56 | 57 | 58 | def deploy_model(training_job_name): 59 | sm = boto3.client('sagemaker') 60 | model = sm.create_model( 61 | ModelName=training_job_name, 62 | PrimaryContainer={ 63 | 'ContainerHostname': 'model-Container', 64 | 'Image': '783357654285.dkr.ecr..amazonaws.com/sagemaker-scikit-learn:0.20.0-cpu-py3', 65 | 'ModelDataUrl': f's3:///{training_job_name}/output/model.tar.gz', 66 | 'Environment': { 67 | 'SAGEMAKER_PROGRAM': 'train_and_deploy.py', 68 | 'SAGEMAKER_REGION':'', 69 | 'SAGEMAKER_SUBMIT_DIRECTORY': src_path 70 | 71 | }, 72 | }, 73 | ExecutionRoleArn=role_arn, 74 | ) 75 | endpoint_config = sm.create_endpoint_config( 76 | EndpointConfigName=training_job_name, 77 | ProductionVariants=[ 78 | { 79 | 'VariantName': 'AllTraffic', 80 | 'ModelName': training_job_name, 81 | 'InitialInstanceCount': 1, 82 | 'InstanceType': 'ml.t2.medium', 83 | }, 84 | ], 85 | ) 86 | 87 | sm.update_endpoint(EndpointName=endpoint_name, 88 | EndpointConfigName=training_job_name) 89 | 90 | def make_prediction(): 91 | data = download_latest_price() 92 | runtime = boto3.Session().client(service_name='runtime.sagemaker',region_name='') 93 | 94 | response = runtime.invoke_endpoint(EndpointName=endpoint_name, 95 | ContentType='application/json', 96 | Body=json.dumps(data)) 97 | 98 | result = json.loads(response['Body'].read().decode()) 99 | 100 | return result 101 | 102 | def download_latest_price(): 103 | # data for the next 2 days 104 | now = time.time() 105 | r = requests.get(f"https://graphs2.coinmarketcap.com/currencies/bitcoin/{int(1000*(now-172800))}/{int(1000*now)}/") 106 | 107 | data = r.json() 108 | 109 | s3 = boto3.resource('s3') 110 | s3object = s3.Object('aws-ip-sagemaker-project', f'training-data/data-{datetime.utcnow().strftime("%Y-%m-%d")}.json') 111 | 112 | s3object.put( 113 | Body=(bytes(json.dumps(data).encode('UTF-8'))) 114 | ) 115 | return data 116 | 117 | def handle_s3_event(s3): 118 | print("s3=",s3) 119 | bucket = s3['bucket']['name'] 120 | fn = s3['object']['key'] 121 | jobid = fn.split("/")[-3] 122 | print("jobid=",jobid) 123 | return deploy_model(jobid) 124 | 125 | def lambda_handler(event, context): 126 | response = event 127 | 128 | # Lambda event 129 | if 'Records' in event: 130 | for records in event['Records']: 131 | if 's3' in records: 132 | handle_s3_event(records['s3']) 133 | else: 134 | pass 135 | # print(retrain_the_model()) 136 | 137 | if 'task' in event: 138 | if event['task'] == 'retrain': 139 | # start retrain the model 140 | download_latest_price() 141 | retrain_the_model() 142 | response = "OK" 143 | if event['task'] == 'prediction': 144 | response = make_prediction() 145 | 146 | return { 147 | 'statusCode': 200, 148 | 'body': response, 149 | } 150 | -------------------------------------------------------------------------------- /sample_data.json: -------------------------------------------------------------------------------- 1 | {"market_cap_by_available_supply": [[1548640441000, 62501055273], [1548641341000, 62319935120], [1548642241000, 62329672272], [1548643141000, 62362982906], [1548644041000, 62276762588], [1548644941000, 62236815930], [1548645842000, 62022744794], [1548646741000, 62016424880], [1548647641000, 61832084473], [1548648541000, 61646039295], [1548649441000, 61824219783], [1548650341000, 61790350739], [1548651240000, 61725698382], [1548652141000, 61611086094], [1548653040000, 61425382379], [1548653941000, 61252402598], [1548654840000, 61061570692], [1548655741000, 60672466520], [1548656641000, 60828332304], [1548657541000, 60828933030], [1548658440000, 61005142973], [1548659341000, 61033427879], [1548660241000, 61097823499], [1548661140000, 61081591786], [1548662040000, 61080722852], [1548662940000, 61038407721], [1548663841000, 60785733297], [1548664741000, 60808930703], [1548665641000, 60788668304], [1548666540000, 60708915784], [1548667441000, 60871655024], [1548668340000, 60921495814], [1548669241000, 60973079112], [1548670140000, 60957111460], [1548671040000, 60904937749], [1548671940000, 60902354295], [1548672840000, 60844315542], [1548673741000, 60852278436], [1548674641000, 60834046475], [1548675540000, 60793681662], [1548676441000, 60658487941], [1548677341000, 60646911430], [1548678241000, 60644637787], [1548679141000, 60577986166], [1548680040000, 60552323648], [1548680940000, 60601862744], [1548681840000, 60592876402], [1548682740000, 60681551480], [1548683641000, 60665689423], [1548684540000, 60618444198], [1548685441000, 60594473737], [1548686341000, 60604939436], [1548687241000, 60640732669], [1548688140000, 60589711557], [1548689041000, 60500724931], [1548689940000, 60337927566], [1548690840000, 60297459534], [1548691741000, 60584324552], [1548692640000, 60594123440], [1548693540000, 60555981222], [1548694441000, 60479224670], [1548695341000, 60450836098], [1548696241000, 60535152993], [1548697140000, 60481027637], [1548698040000, 60574180148], [1548698940000, 60503744032], [1548699840000, 60647643033], [1548700741000, 60608521740], [1548701640000, 60505519332], [1548702540000, 60460569657], [1548703440000, 60476481896], [1548704341000, 60436491342], [1548705241000, 60502096379], [1548706141000, 60550306108], [1548707041000, 60573422620], [1548707941000, 60620922392], [1548708840000, 60624603194], [1548709741000, 60576259036], [1548710640000, 60553158861], [1548711541000, 60617908618], [1548712441000, 60566264888], [1548713340000, 60575392226], [1548714240000, 60642131428], [1548715141000, 60599863237], [1548716041000, 60719646965], [1548716941000, 60780566571], [1548717840000, 60901287510], [1548718740000, 60872340404], [1548719641000, 60812889743], [1548720541000, 60760241604], [1548721440000, 60822596721], [1548722341000, 60787671922], [1548723241000, 60811589376], [1548724141000, 60796251307], [1548725041000, 60659611501], [1548725940000, 60549460062], [1548726841000, 60621035834], [1548727741000, 60519232349], [1548728641000, 60566491680], [1548729540000, 60572447534], [1548730441000, 60624199995], [1548731340000, 60503518870], [1548732241000, 60502388473], [1548733141000, 60411682447], [1548734041000, 60374393182], [1548734941000, 60350020333], [1548735841000, 60330838815], [1548736741000, 60373086895], [1548737640000, 60356410218], [1548738541000, 60279736923], [1548739440000, 60227028411], [1548740340000, 60145025403], [1548741241000, 60002463727], [1548742140000, 59940492459], [1548743041000, 60168147149], [1548743941000, 60091380467], [1548744840000, 60036105152], [1548745741000, 59973107433], [1548746641000, 59917716631], [1548747540000, 59701500891], [1548748441000, 59647337230], [1548749341000, 59643504967], [1548750241000, 59761722891], [1548751141000, 59887349284], [1548752041000, 59892040624], [1548752940000, 59813094571], [1548753841000, 59975575903], [1548754741000, 59985504108], [1548755641000, 60023101777], [1548756540000, 59974064524], [1548757441000, 60003904645], [1548758341000, 59953839771], [1548759240000, 60001278349], [1548760142000, 60031088346], [1548761040000, 59967947016], [1548761941000, 59934944712], [1548762841000, 59919281465], [1548763741000, 59909926498], [1548764640000, 59912831341], [1548765541000, 59926721682], [1548766441000, 60023589082], [1548767341000, 60118012628], [1548768241000, 60202874663], [1548769140000, 60251363220], [1548770040000, 60238711805], [1548770941000, 60214376856], [1548771841000, 60275367711], [1548772741000, 60355130177], [1548773640000, 60402928231], [1548774541000, 60471821553], [1548775440000, 60403612950], [1548776340000, 60365003466], [1548777240000, 60447074135], [1548778140000, 60620693056], [1548779040000, 60750860335], [1548779940000, 60666397581], [1548780840000, 60553943731], [1548781740000, 60442624094], [1548782640000, 60433269788], [1548783540000, 60397429185], [1548784440000, 60420080470], [1548785340000, 60399085675], [1548786240000, 60366274349], [1548787140000, 60389626030], [1548788040000, 60335242712], [1548788940000, 60448945244], [1548789840000, 60434701325], [1548790740000, 60556263182], [1548791640000, 60504395532], [1548792540000, 60533017108], [1548793440000, 60667260956], [1548794340000, 60600562020], [1548795240000, 60532016155], [1548796140000, 60394124910], [1548797040000, 60530469060], [1548797940000, 60429685584], [1548798840000, 60460448788], [1548799740000, 60395449775], [1548800640000, 60456329405], [1548801540000, 60505480860], [1548802440000, 60474390707], [1548803340000, 60352943921], [1548804240000, 60353150713], [1548805140000, 60364167935], [1548806040000, 60353616844], [1548806940000, 60301973898], [1548807840000, 60140394690], [1548808740000, 60094084565], [1548809640000, 60061511611], [1548810540000, 60129158065], [1548811440000, 60198541718], [1548812340000, 60171446394], [1548813240000, 60120771780], [1548814140000, 60162301937], [1548815040000, 60270001849], [1548815940000, 60258745956], [1548816840000, 60236314600], [1548817741000, 60355980207], [1548818640000, 60454076178], [1548819540000, 60388307058], [1548820440000, 60461069894], [1548821340000, 60524818263], [1548822240000, 60768121448], [1548823140000, 60700026597], [1548824040000, 60616519719], [1548824940000, 60660998779], [1548825840000, 60650519358], [1548826740000, 60677058342], [1548827640000, 60747299123], [1548828540000, 60732400148], [1548829440000, 60634297030], [1548830341000, 60556592476], [1548831240000, 60576920925], [1548832140000, 60460423802], [1548833040000, 60512270626], [1548833940000, 60499556608], [1548834841000, 60545310152], [1548835740000, 60514756610], [1548836640000, 60600219785], [1548837541000, 60587189667], [1548838440000, 60663931226], [1548839340000, 60652586493], [1548840240000, 60586308631], [1548841140000, 60572103021], [1548842040000, 60582426672], [1548842940000, 60583549639], [1548843840000, 60551898769], [1548844741000, 60695451847], [1548845640000, 60665273488], [1548846540000, 60736048186], [1548847440000, 60782694357], [1548848340000, 60582352402], [1548849240000, 60650027399], [1548850140000, 60596515747], [1548851040000, 60657831907], [1548851940000, 60807002650], [1548852840000, 60902736423], [1548853740000, 61020494032], [1548854640000, 60955608719], [1548855540000, 61087802343], [1548856440000, 61164545301], [1548857340000, 60973878986], [1548858240000, 61004819235], [1548859140000, 60933766461], [1548860040000, 60889503272], [1548860940000, 60918425602], [1548861840000, 60962157990], [1548862740000, 61047736875], [1548863640000, 61058077555], [1548864540000, 61137983935], [1548865440000, 61007968242], [1548866340000, 60982854140], [1548867240000, 61028330692], [1548868140000, 61031104907], [1548869040000, 61077988576], [1548869940000, 60989298186], [1548870840000, 61075077091], [1548871741000, 61094963258], [1548872641000, 61157657206], [1548873540000, 61096276717], [1548874441000, 61095431940], [1548875340000, 61097550149], [1548876240000, 61171647083], [1548877140000, 61126884486], [1548878040000, 61056819537], [1548878941000, 61078052221], [1548879841000, 60900734012], [1548880740000, 61027798220], [1548881640000, 60974008008], [1548882544000, 60934010814], [1548883440000, 60947099920], [1548884340000, 60909953653], [1548885240000, 60967951662], [1548886141000, 61004372846], [1548887041000, 61001874731], [1548887941000, 61039685138], [1548888840000, 61012066822], [1548889740000, 61076274235], [1548890640000, 61067128076], [1548891541000, 61020160821], [1548892440000, 61036993256], [1548893341000, 60992442405], [1548894240000, 61068436442], [1548895141000, 61138986418], [1548896040000, 61221751787], [1548896940000, 61350749993], [1548897841000, 61243864160], [1548898740000, 61321350439], [1548899640000, 61341886357], [1548900540000, 61222991345], [1548901441000, 61238594912], [1548902340000, 61174945457], [1548903240000, 61104990365], [1548904140000, 61161123193], [1548905041000, 61213229295], [1548905940000, 61114275889], [1548906841000, 61162906922], [1548907740000, 61189357762], [1548908641000, 61080409434], [1548909540000, 61061091194], [1548910440000, 61123249047], [1548911341000, 61119380378], [1548912240000, 61240079680], [1548913140000, 61113548639], [1548914040000, 61144772494], [1548914940000, 61105216727], [1548915840000, 61112607754], [1548916740000, 61134246819], [1548917640000, 61225835162], [1548918541000, 61221597397], [1548919441000, 61199318430], [1548920340000, 61290646950], [1548921241000, 61265882797], [1548922141000, 61276695976], [1548923040000, 60874228015], [1548923940000, 60733395588], [1548924841000, 60762052618], [1548925740000, 60790845165], [1548926641000, 60664883333], [1548927541000, 60603191717], [1548928440000, 60721161691], [1548929341000, 60733917087], [1548930240000, 60741286053], [1548931141000, 60597174812], [1548932041000, 60588779138], [1548932940000, 60534975169], [1548933840000, 60514337636], [1548934740000, 60584639637], [1548935640000, 60596125402], [1548936540000, 60466872492], [1548937440000, 60531736753], [1548938341000, 60600276666], [1548939240000, 60630138507], [1548940140000, 60663080135], [1548941041000, 60597389972], [1548941941000, 60691385583], [1548942840000, 60715941941], [1548943741000, 60672667172], [1548944641000, 60632160400], [1548945541000, 60638678230], [1548946440000, 60532987808], [1548947340000, 60558717363], [1548948240000, 60581073855], [1548949141000, 60591624379], [1548950040000, 60676628667], [1548950940000, 60669702889], [1548951841000, 60584287641], [1548952740000, 60579377407], [1548953640000, 60527956148], [1548954541000, 60434392323], [1548955441000, 60529098957], [1548956340000, 60580478880], [1548957241000, 60583697543], [1548958140000, 60527324143], [1548959043000, 60450424976], [1548959941000, 60473843972], [1548960840000, 60397214482], [1548961741000, 60404143944], [1548962640000, 60431220024], [1548963541000, 60699635786], [1548964440000, 60665028178], [1548965340000, 60628000280], [1548966241000, 60719797300], [1548967141000, 60725634274], [1548968040000, 60754651379], [1548968941000, 60802965711], [1548969841000, 60716817591], [1548970740000, 60659179575], [1548971640000, 60652217277], [1548972540000, 60690046159], [1548973440000, 60755352009], [1548974341000, 60701065671], [1548975240000, 60746398329], [1548976140000, 60863806831], [1548977040000, 60670152361], [1548977940000, 60668202987], [1548978840000, 60573352948], [1548979741000, 60721323008], [1548980640000, 60680793087], [1548981541000, 60605059463], [1548982440000, 60629480852], [1548983340000, 60570791555], [1548984240000, 60518066068], [1548985140000, 60506559123], [1548986040000, 60247000198], [1548986941000, 60170187694], [1548987841000, 60135273048], [1548988741000, 60156891749], [1548989640000, 60232646843], [1548990541000, 60318001446], [1548991440000, 60223867326], [1548992341000, 60278944724], [1548993240000, 60335226861], [1548994140000, 60316096965], [1548995040000, 60247633728], [1548995941000, 60275857384], [1548996841000, 60232621860], [1548997741000, 60244527028], [1548998641000, 60251951949], [1548999541000, 60239781967], [1549000441000, 60242525663], [1549001341000, 60206391261], [1549002241000, 60173113691], [1549003141000, 60209629064], [1549004041000, 60249673334], [1549004941000, 60241577643], [1549005840000, 60225056088], [1549006740000, 60156365104], [1549007641000, 60250963495], [1549008541000, 60200597586], [1549009440000, 60374068597], [1549010341000, 60258866226], [1549011241000, 60249819060], [1549012141000, 60358918086], [1549013040000, 60403623444], [1549013940000, 60491134892], [1549014841000, 60481704156], [1549015741000, 60464052898], [1549016641000, 60397052759], [1549017541000, 60430920669], [1549018440000, 60486070219], [1549019341000, 60624726543], [1549020240000, 60834560715], [1549021141000, 60922111848], [1549022040000, 60907268149], [1549022940000, 60869408403], [1549023841000, 61033341828], [1549024741000, 61133697657], [1549025641000, 60934527882], [1549026541000, 61016039855], [1549027441000, 61017634817], [1549028341000, 61014352943], [1549029240000, 61011624504], [1549030141000, 61152522849], [1549031040000, 61055847589], [1549031941000, 61082699447], [1549032840000, 61088694344], [1549033740000, 61017523501], [1549034641000, 60918418938], [1549035541000, 60952893291], [1549036440000, 61034035660], [1549037340000, 61032946647], [1549038240000, 60949158389], [1549039140000, 60895148941], [1549040040000, 60854132971], [1549040940000, 60866981269], [1549041840000, 60988470152], [1549042740000, 60950306740], [1549043640000, 60997581320], [1549044540000, 61007792347], [1549045440000, 60987703321], [1549046340000, 60889071110], [1549047240000, 60931836155], [1549048140000, 61125875038], [1549049040000, 61230698068], [1549049940000, 61247324995], [1549050840000, 61230923865], [1549051740000, 61258973097], [1549052640000, 61278228382], [1549053540000, 61244305644], [1549054440000, 61244992266], [1549055340000, 61162001168], [1549056240000, 61134623671], [1549057140000, 61159980486], [1549058040000, 61239848669], [1549058940000, 61275392330], [1549059840000, 61120374937], [1549060740000, 61193560250], [1549061640000, 61193442715], [1549062540000, 61269305502], [1549063440000, 61290378966], [1549064340000, 61203971492], [1549065240000, 61129123034], [1549066140000, 60993247765], [1549067040000, 61137221221], [1549067940000, 61102271432], [1549068841000, 61010605383], [1549069740000, 61012732783], [1549070640000, 61014003933], [1549071540000, 61015896134], [1549072440000, 60950483902], [1549073340000, 60989984309], [1549074240000, 61024211613], [1549075140000, 61012393679], [1549076041000, 61044489114], [1549076940000, 61076819221], [1549077840000, 61072563979], [1549078740000, 61110061186], [1549079640000, 61081505690], [1549080540000, 61119842094], [1549081440000, 61000868521], [1549082340000, 60931466059], [1549083240000, 60923356454], [1549084140000, 61000575266], [1549085040000, 60924640564], [1549085940000, 60861924436], [1549086840000, 60906757950], [1549087740000, 60929864400], [1549088640000, 60906047557], [1549089540000, 60843001129], [1549090441000, 60733790361], [1549091340000, 60797370652], [1549092240000, 60891382979], [1549093140000, 60814732492], [1549094040000, 60866091115], [1549094940000, 60865401483], [1549095840000, 60806891280], [1549096740000, 60828604853], [1549097640000, 60798052612], [1549098541000, 60858923174], [1549099440000, 60936800371], [1549100340000, 60909751943], [1549101240000, 60863197786], [1549102140000, 60926296129], [1549103040000, 61048237217], [1549103940000, 61008185601], [1549104840000, 61093706080], [1549105741000, 61052765373], [1549106640000, 61060615218], [1549107540000, 61119171045], [1549108440000, 61093355286], [1549109340000, 61260712160], [1549110240000, 61196771429], [1549111140000, 61142587102], [1549112040000, 61076884881], [1549112940000, 61124640632], [1549113840000, 61162540865], [1549114740000, 61200884331], [1549115640000, 61167009629], [1549116540000, 61076716674], [1549117440000, 61015668334], [1549118340000, 61054836809], [1549119240000, 61074135403], [1549120140000, 61122757355], [1549121040000, 61117280535], [1549121940000, 61071543832], [1549122840000, 60960406750], [1549123740000, 60933405810], [1549124640000, 60834431516], [1549125540000, 60860386478], [1549126440000, 60890242863], [1549127340000, 60953483557], [1549128240000, 60941278233], [1549129140000, 60947852971], [1549130040000, 60924358864], [1549130940000, 60977479592], [1549131840000, 60897653229], [1549132741000, 60998396775], [1549133640000, 61033324953], [1549134540000, 60991536600], [1549135440000, 60983106320], [1549136340000, 61007040765], [1549137240000, 61090781860], [1549138140000, 61100252091], [1549139040000, 61090990804], [1549139941000, 61148559698], [1549140840000, 61052470345], [1549141740000, 61107339103], [1549142640000, 61026210768], [1549143540000, 61153967383], [1549144440000, 61081857612], [1549145340000, 61032233265], [1549146240000, 61068063501], [1549147140000, 61018952342], [1549148040000, 61093059015], [1549148940000, 61097728624], [1549149840000, 61253093824], [1549150740000, 61452436218], [1549151641000, 61714119346], [1549152540000, 61661884204], [1549153440000, 61589318281], [1549154340000, 61532817797], [1549155240000, 61581420727], [1549156140000, 61372598473], [1549157040000, 61370688157], [1549157941000, 61391256486], [1549158840000, 61292027400], [1549159740000, 61336607774], [1549160640000, 61441916763], [1549161540000, 61432865316], [1549162440000, 61357137810], [1549163340000, 61239278364], [1549164240000, 61290501326], [1549165140000, 61038256041], [1549166040000, 61099179972], [1549166940000, 61350665277], [1549167840000, 61374628026], [1549168740000, 61285348735], [1549169640000, 61238029858], [1549170541000, 61239621180], [1549171440000, 61295982795], [1549172340000, 61223001245], [1549173240000, 61309760741], [1549174140000, 61326635805], [1549175040000, 61310619429], [1549175940000, 61197560213], [1549176840000, 61215338442], [1549177740000, 61070166553], [1549178640000, 61020436250], [1549179540000, 60976658834], [1549180440000, 61032050662], [1549181340000, 60969942808], [1549182240000, 60979787165], [1549183140000, 60846812671], [1549184040000, 60889016835], [1549184940000, 60867046394], [1549185840000, 60933510709], [1549186740000, 60901151675], [1549187640000, 60886580153], [1549188540000, 60773125575], [1549189440000, 60945182701], [1549190340000, 60967543724], [1549191240000, 60920729509], [1549192140000, 61005142980], [1549193040000, 60939546999], [1549193940000, 60948627464], [1549194840000, 60863801288], [1549195740000, 60892157081], [1549196640000, 60857602817], [1549197540000, 60882658233], [1549198441000, 60890582820], [1549199340000, 60940641299], [1549200240000, 60955670551], [1549201140000, 60979460104], [1549202040000, 60992917325], [1549202940000, 60963838936], [1549203840000, 60944271448], [1549204740000, 60922517896], [1549205641000, 60874403992], [1549206540000, 60900783843], [1549207440000, 60855421009], [1549208340000, 60873770884], [1549209240000, 60843824299], [1549210140000, 60822112360], [1549211040000, 60936057164], [1549211940000, 60912759354], [1549212840000, 60929493495], [1549213740000, 60852962457], [1549214640000, 60904444038], [1549215540000, 60854379750], [1549216440000, 60893263646], [1549217340000, 60861225185], [1549218240000, 60960965268], [1549219140000, 60920022038], [1549220040000, 60945226600], [1549220940000, 60919451529], [1549221840000, 60855474618], [1549222740000, 60756856321], [1549223640000, 60788272197], [1549224540000, 60496250691], [1549225440000, 60545866951], [1549226340000, 60497107353], [1549227240000, 60558446639], [1549228140000, 60556655402], [1549229040000, 60495413215], [1549229941000, 60404994997], [1549230840000, 60452978059], [1549231740000, 60446168370], [1549232641000, 60447326858], [1549233540000, 60528271209], [1549234440000, 60608133552], [1549235340000, 60585934367], [1549236240000, 60639804518], [1549237140000, 60682319150], [1549238040000, 60603596099], [1549238940000, 60751057407], [1549239840000, 60786642599], [1549240740000, 60879032977], [1549241641000, 60796574317], [1549242540000, 60792516130], [1549243440000, 60774196587], [1549244341000, 60723701187], [1549245241000, 60890722360]], "price_btc": [[1548640441000, 1.0], [1548641341000, 1.0], [1548642241000, 1.0], [1548643141000, 1.0], [1548644041000, 1.0], [1548644941000, 1.0], [1548645842000, 1.0], [1548646741000, 1.0], [1548647641000, 1.0], [1548648541000, 1.0], [1548649441000, 1.0], [1548650341000, 1.0], [1548651240000, 1.0], [1548652141000, 1.0], [1548653040000, 1.0], [1548653941000, 1.0], [1548654840000, 1.0], [1548655741000, 1.0], [1548656641000, 1.0], [1548657541000, 1.0], [1548658440000, 1.0], [1548659341000, 1.0], [1548660241000, 1.0], [1548661140000, 1.0], [1548662040000, 1.0], [1548662940000, 1.0], [1548663841000, 1.0], [1548664741000, 1.0], [1548665641000, 1.0], [1548666540000, 1.0], [1548667441000, 1.0], [1548668340000, 1.0], [1548669241000, 1.0], [1548670140000, 1.0], [1548671040000, 1.0], [1548671940000, 1.0], [1548672840000, 1.0], [1548673741000, 1.0], [1548674641000, 1.0], [1548675540000, 1.0], [1548676441000, 1.0], [1548677341000, 1.0], [1548678241000, 1.0], [1548679141000, 1.0], [1548680040000, 1.0], [1548680940000, 1.0], [1548681840000, 1.0], [1548682740000, 1.0], [1548683641000, 1.0], [1548684540000, 1.0], [1548685441000, 1.0], [1548686341000, 1.0], [1548687241000, 1.0], [1548688140000, 1.0], [1548689041000, 1.0], [1548689940000, 1.0], [1548690840000, 1.0], [1548691741000, 1.0], [1548692640000, 1.0], [1548693540000, 1.0], [1548694441000, 1.0], [1548695341000, 1.0], [1548696241000, 1.0], [1548697140000, 1.0], [1548698040000, 1.0], [1548698940000, 1.0], [1548699840000, 1.0], [1548700741000, 1.0], [1548701640000, 1.0], [1548702540000, 1.0], [1548703440000, 1.0], [1548704341000, 1.0], [1548705241000, 1.0], [1548706141000, 1.0], [1548707041000, 1.0], [1548707941000, 1.0], [1548708840000, 1.0], [1548709741000, 1.0], [1548710640000, 1.0], [1548711541000, 1.0], [1548712441000, 1.0], [1548713340000, 1.0], [1548714240000, 1.0], [1548715141000, 1.0], [1548716041000, 1.0], [1548716941000, 1.0], [1548717840000, 1.0], [1548718740000, 1.0], [1548719641000, 1.0], [1548720541000, 1.0], [1548721440000, 1.0], [1548722341000, 1.0], [1548723241000, 1.0], [1548724141000, 1.0], [1548725041000, 1.0], [1548725940000, 1.0], [1548726841000, 1.0], [1548727741000, 1.0], [1548728641000, 1.0], [1548729540000, 1.0], [1548730441000, 1.0], [1548731340000, 1.0], [1548732241000, 1.0], [1548733141000, 1.0], [1548734041000, 1.0], [1548734941000, 1.0], [1548735841000, 1.0], [1548736741000, 1.0], [1548737640000, 1.0], [1548738541000, 1.0], [1548739440000, 1.0], [1548740340000, 1.0], [1548741241000, 1.0], [1548742140000, 1.0], [1548743041000, 1.0], [1548743941000, 1.0], [1548744840000, 1.0], [1548745741000, 1.0], [1548746641000, 1.0], [1548747540000, 1.0], [1548748441000, 1.0], [1548749341000, 1.0], [1548750241000, 1.0], [1548751141000, 1.0], [1548752041000, 1.0], [1548752940000, 1.0], [1548753841000, 1.0], [1548754741000, 1.0], [1548755641000, 1.0], [1548756540000, 1.0], [1548757441000, 1.0], [1548758341000, 1.0], [1548759240000, 1.0], [1548760142000, 1.0], [1548761040000, 1.0], [1548761941000, 1.0], [1548762841000, 1.0], [1548763741000, 1.0], [1548764640000, 1.0], [1548765541000, 1.0], [1548766441000, 1.0], [1548767341000, 1.0], [1548768241000, 1.0], [1548769140000, 1.0], [1548770040000, 1.0], [1548770941000, 1.0], [1548771841000, 1.0], [1548772741000, 1.0], [1548773640000, 1.0], [1548774541000, 1.0], [1548775440000, 1.0], [1548776340000, 1.0], [1548777240000, 1.0], [1548778140000, 1.0], [1548779040000, 1.0], [1548779940000, 1.0], [1548780840000, 1.0], [1548781740000, 1.0], [1548782640000, 1.0], [1548783540000, 1.0], [1548784440000, 1.0], [1548785340000, 1.0], [1548786240000, 1.0], [1548787140000, 1.0], [1548788040000, 1.0], [1548788940000, 1.0], [1548789840000, 1.0], [1548790740000, 1.0], [1548791640000, 1.0], [1548792540000, 1.0], [1548793440000, 1.0], [1548794340000, 1.0], [1548795240000, 1.0], [1548796140000, 1.0], [1548797040000, 1.0], [1548797940000, 1.0], [1548798840000, 1.0], [1548799740000, 1.0], [1548800640000, 1.0], [1548801540000, 1.0], [1548802440000, 1.0], [1548803340000, 1.0], [1548804240000, 1.0], [1548805140000, 1.0], [1548806040000, 1.0], [1548806940000, 1.0], [1548807840000, 1.0], [1548808740000, 1.0], [1548809640000, 1.0], [1548810540000, 1.0], [1548811440000, 1.0], [1548812340000, 1.0], [1548813240000, 1.0], [1548814140000, 1.0], [1548815040000, 1.0], [1548815940000, 1.0], [1548816840000, 1.0], [1548817741000, 1.0], [1548818640000, 1.0], [1548819540000, 1.0], [1548820440000, 1.0], [1548821340000, 1.0], [1548822240000, 1.0], [1548823140000, 1.0], [1548824040000, 1.0], [1548824940000, 1.0], [1548825840000, 1.0], [1548826740000, 1.0], [1548827640000, 1.0], [1548828540000, 1.0], [1548829440000, 1.0], [1548830341000, 1.0], [1548831240000, 1.0], [1548832140000, 1.0], [1548833040000, 1.0], [1548833940000, 1.0], [1548834841000, 1.0], [1548835740000, 1.0], [1548836640000, 1.0], [1548837541000, 1.0], [1548838440000, 1.0], [1548839340000, 1.0], [1548840240000, 1.0], [1548841140000, 1.0], [1548842040000, 1.0], [1548842940000, 1.0], [1548843840000, 1.0], [1548844741000, 1.0], [1548845640000, 1.0], [1548846540000, 1.0], [1548847440000, 1.0], [1548848340000, 1.0], [1548849240000, 1.0], [1548850140000, 1.0], [1548851040000, 1.0], [1548851940000, 1.0], [1548852840000, 1.0], [1548853740000, 1.0], [1548854640000, 1.0], [1548855540000, 1.0], [1548856440000, 1.0], [1548857340000, 1.0], [1548858240000, 1.0], [1548859140000, 1.0], [1548860040000, 1.0], [1548860940000, 1.0], [1548861840000, 1.0], [1548862740000, 1.0], [1548863640000, 1.0], [1548864540000, 1.0], [1548865440000, 1.0], [1548866340000, 1.0], [1548867240000, 1.0], [1548868140000, 1.0], [1548869040000, 1.0], [1548869940000, 1.0], [1548870840000, 1.0], [1548871741000, 1.0], [1548872641000, 1.0], [1548873540000, 1.0], [1548874441000, 1.0], [1548875340000, 1.0], [1548876240000, 1.0], [1548877140000, 1.0], [1548878040000, 1.0], [1548878941000, 1.0], [1548879841000, 1.0], [1548880740000, 1.0], [1548881640000, 1.0], [1548882544000, 1.0], [1548883440000, 1.0], [1548884340000, 1.0], [1548885240000, 1.0], [1548886141000, 1.0], [1548887041000, 1.0], [1548887941000, 1.0], [1548888840000, 1.0], [1548889740000, 1.0], [1548890640000, 1.0], [1548891541000, 1.0], [1548892440000, 1.0], [1548893341000, 1.0], [1548894240000, 1.0], [1548895141000, 1.0], [1548896040000, 1.0], [1548896940000, 1.0], [1548897841000, 1.0], [1548898740000, 1.0], [1548899640000, 1.0], [1548900540000, 1.0], [1548901441000, 1.0], [1548902340000, 1.0], [1548903240000, 1.0], [1548904140000, 1.0], [1548905041000, 1.0], [1548905940000, 1.0], [1548906841000, 1.0], [1548907740000, 1.0], [1548908641000, 1.0], [1548909540000, 1.0], [1548910440000, 1.0], [1548911341000, 1.0], [1548912240000, 1.0], [1548913140000, 1.0], [1548914040000, 1.0], [1548914940000, 1.0], [1548915840000, 1.0], [1548916740000, 1.0], [1548917640000, 1.0], [1548918541000, 1.0], [1548919441000, 1.0], [1548920340000, 1.0], [1548921241000, 1.0], [1548922141000, 1.0], [1548923040000, 1.0], [1548923940000, 1.0], [1548924841000, 1.0], [1548925740000, 1.0], [1548926641000, 1.0], [1548927541000, 1.0], [1548928440000, 1.0], [1548929341000, 1.0], [1548930240000, 1.0], [1548931141000, 1.0], [1548932041000, 1.0], [1548932940000, 1.0], [1548933840000, 1.0], [1548934740000, 1.0], [1548935640000, 1.0], [1548936540000, 1.0], [1548937440000, 1.0], [1548938341000, 1.0], [1548939240000, 1.0], [1548940140000, 1.0], [1548941041000, 1.0], [1548941941000, 1.0], [1548942840000, 1.0], [1548943741000, 1.0], [1548944641000, 1.0], [1548945541000, 1.0], [1548946440000, 1.0], [1548947340000, 1.0], [1548948240000, 1.0], [1548949141000, 1.0], [1548950040000, 1.0], [1548950940000, 1.0], [1548951841000, 1.0], [1548952740000, 1.0], [1548953640000, 1.0], [1548954541000, 1.0], [1548955441000, 1.0], [1548956340000, 1.0], [1548957241000, 1.0], [1548958140000, 1.0], [1548959043000, 1.0], [1548959941000, 1.0], [1548960840000, 1.0], [1548961741000, 1.0], [1548962640000, 1.0], [1548963541000, 1.0], [1548964440000, 1.0], [1548965340000, 1.0], [1548966241000, 1.0], [1548967141000, 1.0], [1548968040000, 1.0], [1548968941000, 1.0], [1548969841000, 1.0], [1548970740000, 1.0], [1548971640000, 1.0], [1548972540000, 1.0], [1548973440000, 1.0], [1548974341000, 1.0], [1548975240000, 1.0], [1548976140000, 1.0], [1548977040000, 1.0], [1548977940000, 1.0], [1548978840000, 1.0], [1548979741000, 1.0], [1548980640000, 1.0], [1548981541000, 1.0], [1548982440000, 1.0], [1548983340000, 1.0], [1548984240000, 1.0], [1548985140000, 1.0], [1548986040000, 1.0], [1548986941000, 1.0], [1548987841000, 1.0], [1548988741000, 1.0], [1548989640000, 1.0], [1548990541000, 1.0], [1548991440000, 1.0], [1548992341000, 1.0], [1548993240000, 1.0], [1548994140000, 1.0], [1548995040000, 1.0], [1548995941000, 1.0], [1548996841000, 1.0], [1548997741000, 1.0], [1548998641000, 1.0], [1548999541000, 1.0], [1549000441000, 1.0], [1549001341000, 1.0], [1549002241000, 1.0], [1549003141000, 1.0], [1549004041000, 1.0], [1549004941000, 1.0], [1549005840000, 1.0], [1549006740000, 1.0], [1549007641000, 1.0], [1549008541000, 1.0], [1549009440000, 1.0], [1549010341000, 1.0], [1549011241000, 1.0], [1549012141000, 1.0], [1549013040000, 1.0], [1549013940000, 1.0], [1549014841000, 1.0], [1549015741000, 1.0], [1549016641000, 1.0], [1549017541000, 1.0], [1549018440000, 1.0], [1549019341000, 1.0], [1549020240000, 1.0], [1549021141000, 1.0], [1549022040000, 1.0], [1549022940000, 1.0], [1549023841000, 1.0], [1549024741000, 1.0], [1549025641000, 1.0], [1549026541000, 1.0], [1549027441000, 1.0], [1549028341000, 1.0], [1549029240000, 1.0], [1549030141000, 1.0], [1549031040000, 1.0], [1549031941000, 1.0], [1549032840000, 1.0], [1549033740000, 1.0], [1549034641000, 1.0], [1549035541000, 1.0], [1549036440000, 1.0], [1549037340000, 1.0], [1549038240000, 1.0], [1549039140000, 1.0], [1549040040000, 1.0], [1549040940000, 1.0], [1549041840000, 1.0], [1549042740000, 1.0], [1549043640000, 1.0], [1549044540000, 1.0], [1549045440000, 1.0], [1549046340000, 1.0], [1549047240000, 1.0], [1549048140000, 1.0], [1549049040000, 1.0], [1549049940000, 1.0], [1549050840000, 1.0], [1549051740000, 1.0], [1549052640000, 1.0], [1549053540000, 1.0], [1549054440000, 1.0], [1549055340000, 1.0], [1549056240000, 1.0], [1549057140000, 1.0], [1549058040000, 1.0], [1549058940000, 1.0], [1549059840000, 1.0], [1549060740000, 1.0], [1549061640000, 1.0], [1549062540000, 1.0], [1549063440000, 1.0], [1549064340000, 1.0], [1549065240000, 1.0], [1549066140000, 1.0], [1549067040000, 1.0], [1549067940000, 1.0], [1549068841000, 1.0], [1549069740000, 1.0], [1549070640000, 1.0], [1549071540000, 1.0], [1549072440000, 1.0], [1549073340000, 1.0], [1549074240000, 1.0], [1549075140000, 1.0], [1549076041000, 1.0], [1549076940000, 1.0], [1549077840000, 1.0], [1549078740000, 1.0], [1549079640000, 1.0], [1549080540000, 1.0], [1549081440000, 1.0], [1549082340000, 1.0], [1549083240000, 1.0], [1549084140000, 1.0], [1549085040000, 1.0], [1549085940000, 1.0], [1549086840000, 1.0], [1549087740000, 1.0], [1549088640000, 1.0], [1549089540000, 1.0], [1549090441000, 1.0], [1549091340000, 1.0], [1549092240000, 1.0], [1549093140000, 1.0], [1549094040000, 1.0], [1549094940000, 1.0], [1549095840000, 1.0], [1549096740000, 1.0], [1549097640000, 1.0], [1549098541000, 1.0], [1549099440000, 1.0], [1549100340000, 1.0], [1549101240000, 1.0], [1549102140000, 1.0], [1549103040000, 1.0], [1549103940000, 1.0], [1549104840000, 1.0], [1549105741000, 1.0], [1549106640000, 1.0], [1549107540000, 1.0], [1549108440000, 1.0], [1549109340000, 1.0], [1549110240000, 1.0], [1549111140000, 1.0], [1549112040000, 1.0], [1549112940000, 1.0], [1549113840000, 1.0], [1549114740000, 1.0], [1549115640000, 1.0], [1549116540000, 1.0], [1549117440000, 1.0], [1549118340000, 1.0], [1549119240000, 1.0], [1549120140000, 1.0], [1549121040000, 1.0], [1549121940000, 1.0], [1549122840000, 1.0], [1549123740000, 1.0], [1549124640000, 1.0], [1549125540000, 1.0], [1549126440000, 1.0], [1549127340000, 1.0], [1549128240000, 1.0], [1549129140000, 1.0], [1549130040000, 1.0], [1549130940000, 1.0], [1549131840000, 1.0], [1549132741000, 1.0], [1549133640000, 1.0], [1549134540000, 1.0], [1549135440000, 1.0], [1549136340000, 1.0], [1549137240000, 1.0], [1549138140000, 1.0], [1549139040000, 1.0], [1549139941000, 1.0], [1549140840000, 1.0], [1549141740000, 1.0], [1549142640000, 1.0], [1549143540000, 1.0], [1549144440000, 1.0], [1549145340000, 1.0], [1549146240000, 1.0], [1549147140000, 1.0], [1549148040000, 1.0], [1549148940000, 1.0], [1549149840000, 1.0], [1549150740000, 1.0], [1549151641000, 1.0], [1549152540000, 1.0], [1549153440000, 1.0], [1549154340000, 1.0], [1549155240000, 1.0], [1549156140000, 1.0], [1549157040000, 1.0], [1549157941000, 1.0], [1549158840000, 1.0], [1549159740000, 1.0], [1549160640000, 1.0], [1549161540000, 1.0], [1549162440000, 1.0], [1549163340000, 1.0], [1549164240000, 1.0], [1549165140000, 1.0], [1549166040000, 1.0], [1549166940000, 1.0], [1549167840000, 1.0], [1549168740000, 1.0], [1549169640000, 1.0], [1549170541000, 1.0], [1549171440000, 1.0], [1549172340000, 1.0], [1549173240000, 1.0], [1549174140000, 1.0], [1549175040000, 1.0], [1549175940000, 1.0], [1549176840000, 1.0], [1549177740000, 1.0], [1549178640000, 1.0], [1549179540000, 1.0], [1549180440000, 1.0], [1549181340000, 1.0], [1549182240000, 1.0], [1549183140000, 1.0], [1549184040000, 1.0], [1549184940000, 1.0], [1549185840000, 1.0], [1549186740000, 1.0], [1549187640000, 1.0], [1549188540000, 1.0], [1549189440000, 1.0], [1549190340000, 1.0], [1549191240000, 1.0], [1549192140000, 1.0], [1549193040000, 1.0], [1549193940000, 1.0], [1549194840000, 1.0], [1549195740000, 1.0], [1549196640000, 1.0], [1549197540000, 1.0], [1549198441000, 1.0], [1549199340000, 1.0], [1549200240000, 1.0], [1549201140000, 1.0], [1549202040000, 1.0], [1549202940000, 1.0], [1549203840000, 1.0], [1549204740000, 1.0], [1549205641000, 1.0], [1549206540000, 1.0], [1549207440000, 1.0], [1549208340000, 1.0], [1549209240000, 1.0], [1549210140000, 1.0], [1549211040000, 1.0], [1549211940000, 1.0], [1549212840000, 1.0], [1549213740000, 1.0], [1549214640000, 1.0], [1549215540000, 1.0], [1549216440000, 1.0], [1549217340000, 1.0], [1549218240000, 1.0], [1549219140000, 1.0], [1549220040000, 1.0], [1549220940000, 1.0], [1549221840000, 1.0], [1549222740000, 1.0], [1549223640000, 1.0], [1549224540000, 1.0], [1549225440000, 1.0], [1549226340000, 1.0], [1549227240000, 1.0], [1549228140000, 1.0], [1549229040000, 1.0], [1549229941000, 1.0], [1549230840000, 1.0], [1549231740000, 1.0], [1549232641000, 1.0], [1549233540000, 1.0], [1549234440000, 1.0], [1549235340000, 1.0], [1549236240000, 1.0], [1549237140000, 1.0], [1549238040000, 1.0], [1549238940000, 1.0], [1549239840000, 1.0], [1549240740000, 1.0], [1549241641000, 1.0], [1549242540000, 1.0], [1549243440000, 1.0], [1549244341000, 1.0], [1549245241000, 1.0]], "price_usd": [[1548640441000, 3570.43059715], [1548641341000, 3560.081297], [1548642241000, 3560.63509955], [1548643141000, 3562.53290983], [1548644041000, 3557.60750846], [1548644941000, 3555.32288488], [1548645842000, 3543.08885717], [1548646741000, 3542.72276857], [1548647641000, 3532.19222029], [1548648541000, 3521.55925669], [1548649441000, 3531.72781406], [1548650341000, 3529.79303442], [1548651240000, 3526.09974835], [1548652141000, 3519.54745933], [1548653040000, 3508.93167532], [1548653941000, 3499.04758797], [1548654840000, 3488.14630257], [1548655741000, 3465.90385155], [1548656641000, 3474.80269426], [1548657541000, 3474.82708563], [1548658440000, 3484.89300416], [1548659341000, 3486.50378832], [1548660241000, 3490.17497876], [1548661140000, 3489.24017813], [1548662040000, 3489.19054094], [1548662940000, 3486.7733208], [1548663841000, 3472.33948354], [1548664741000, 3473.65965726], [1548665641000, 3472.50218453], [1548666540000, 3467.93905828], [1548667441000, 3477.22783444], [1548668340000, 3480.07255047], [1548669241000, 3483.01918883], [1548670140000, 3482.10705452], [1548671040000, 3479.11416877], [1548671940000, 3478.96659237], [1548672840000, 3475.65120525], [1548673741000, 3476.10111086], [1548674641000, 3475.05725354], [1548675540000, 3472.75147175], [1548676441000, 3465.02872525], [1548677341000, 3464.36743375], [1548678241000, 3464.23498261], [1548679141000, 3460.42523553], [1548680040000, 3458.95930329], [1548680940000, 3461.78420497], [1548681840000, 3461.26593162], [1548682740000, 3466.331346], [1548683641000, 3465.42525273], [1548684540000, 3462.72150384], [1548685441000, 3461.33977706], [1548686341000, 3461.93266558], [1548687241000, 3463.97728046], [1548688140000, 3461.05786158], [1548689041000, 3455.9723217], [1548689940000, 3446.67031682], [1548690840000, 3444.35867019], [1548691741000, 3460.73788385], [1548692640000, 3461.29267945], [1548693540000, 3459.10144918], [1548694441000, 3454.71693268], [1548695341000, 3453.09531005], [1548696241000, 3457.90932103], [1548697140000, 3454.81755425], [1548698040000, 3460.13864327], [1548698940000, 3456.11516782], [1548699840000, 3464.33501479], [1548700741000, 3462.09042708], [1548701640000, 3456.20670573], [1548702540000, 3453.6341507], [1548703440000, 3454.53815777], [1548704341000, 3452.24139344], [1548705241000, 3455.98887153], [1548706141000, 3458.73775894], [1548707041000, 3460.05584219], [1548707941000, 3462.75921919], [1548708840000, 3462.9694722], [1548709741000, 3460.20046961], [1548710640000, 3458.87858448], [1548711541000, 3462.57460719], [1548712441000, 3459.62464945], [1548713340000, 3460.13870204], [1548714240000, 3463.9410317], [1548715141000, 3461.5141724], [1548716041000, 3468.35631774], [1548716941000, 3471.83113803], [1548717840000, 3478.7268078], [1548718740000, 3477.06836224], [1548719641000, 3473.67250119], [1548720541000, 3470.66024847], [1548721440000, 3474.21962754], [1548722341000, 3472.21716739], [1548723241000, 3473.58334236], [1548724141000, 3472.70484511], [1548725041000, 3464.89992776], [1548725940000, 3458.59815812], [1548726841000, 3462.68658161], [1548727741000, 3456.86660825], [1548728641000, 3459.56606752], [1548729540000, 3459.90626671], [1548730441000, 3462.86237413], [1548731340000, 3455.95424686], [1548732241000, 3455.88474372], [1548733141000, 3450.70107073], [1548734041000, 3448.57111666], [1548734941000, 3447.17658246], [1548735841000, 3446.08093941], [1548736741000, 3448.49157744], [1548737640000, 3447.53901092], [1548738541000, 3443.15217981], [1548739440000, 3440.14149269], [1548740340000, 3435.45261094], [1548741241000, 3427.30956206], [1548742140000, 3423.7672531], [1548743041000, 3436.76840542], [1548743941000, 3432.3786373], [1548744840000, 3429.22134905], [1548745741000, 3425.61552689], [1548746641000, 3422.44930314], [1548747540000, 3410.09437335], [1548748441000, 3407.00059527], [1548749341000, 3406.77683517], [1548750241000, 3413.51957488], [1548751141000, 3420.69520723], [1548752041000, 3420.96317109], [1548752940000, 3416.44898643], [1548753841000, 3425.7271727], [1548754741000, 3426.29191044], [1548755641000, 3428.43943911], [1548756540000, 3425.63360499], [1548757441000, 3427.33059138], [1548758341000, 3424.4686157], [1548759240000, 3427.17823233], [1548760142000, 3428.876036], [1548761040000, 3425.26461695], [1548761941000, 3423.37704089], [1548762841000, 3422.4823842], [1548763741000, 3421.93827246], [1548764640000, 3422.09695927], [1548765541000, 3422.88057142], [1548766441000, 3428.41342106], [1548767341000, 3433.80177997], [1548768241000, 3438.64399288], [1548769140000, 3441.40862898], [1548770040000, 3440.68601149], [1548770941000, 3439.28368352], [1548771841000, 3442.75748553], [1548772741000, 3447.30836808], [1548773640000, 3450.03845304], [1548774541000, 3453.97343792], [1548775440000, 3450.07027101], [1548776340000, 3447.86009166], [1548777240000, 3452.54771149], [1548778140000, 3462.45182176], [1548779040000, 3469.88654265], [1548779940000, 3465.05498903], [1548780840000, 3458.6320137], [1548781740000, 3452.26889118], [1548782640000, 3451.7346063], [1548783540000, 3449.67510477], [1548784440000, 3450.96886139], [1548785340000, 3449.76479136], [1548786240000, 3447.88344745], [1548787140000, 3449.21227821], [1548788040000, 3446.10612206], [1548788940000, 3452.59778932], [1548789840000, 3451.77694002], [1548790740000, 3458.71747587], [1548791640000, 3455.75501518], [1548792540000, 3457.3897585], [1548793440000, 3465.05482403], [1548794340000, 3461.24032345], [1548795240000, 3457.32528196], [1548796140000, 3449.44953429], [1548797040000, 3457.22447857], [1548797940000, 3451.45832921], [1548798840000, 3453.21537819], [1548799740000, 3449.4907263], [1548800640000, 3452.96037684], [1548801540000, 3455.76765983], [1548802440000, 3453.99194724], [1548803340000, 3447.05551981], [1548804240000, 3447.05748682], [1548805140000, 3447.68181027], [1548806040000, 3447.07918781], [1548806940000, 3444.12469827], [1548807840000, 3434.89125762], [1548808740000, 3432.23902282], [1548809640000, 3430.37863733], [1548810540000, 3434.23967565], [1548811440000, 3438.19266162], [1548812340000, 3436.64022634], [1548813240000, 3433.74598948], [1548814140000, 3436.11559352], [1548815040000, 3442.26422099], [1548815940000, 3441.62135129], [1548816840000, 3440.3402056], [1548817741000, 3447.16258707], [1548818640000, 3452.76029594], [1548819540000, 3449.00141262], [1548820440000, 3453.15716951], [1548821340000, 3456.79570744], [1548822240000, 3470.68669451], [1548823140000, 3466.79260184], [1548824040000, 3462.02322953], [1548824940000, 3464.55606633], [1548825840000, 3463.94528499], [1548826740000, 3465.45606326], [1548827640000, 3469.46773337], [1548828540000, 3468.60927849], [1548829440000, 3463.00394221], [1548830341000, 3458.5660054], [1548831240000, 3459.72702325], [1548832140000, 3453.07096436], [1548833040000, 3456.02478435], [1548833940000, 3455.29371774], [1548834841000, 3457.90682669], [1548835740000, 3456.16183107], [1548836640000, 3461.03041157], [1548837541000, 3460.28128824], [1548838440000, 3464.66418475], [1548839340000, 3464.01388548], [1548840240000, 3460.22108908], [1548841140000, 3459.40977456], [1548842040000, 3459.99938163], [1548842940000, 3460.05126488], [1548843840000, 3458.24105094], [1548844741000, 3466.43728105], [1548845640000, 3464.71373529], [1548846540000, 3468.75086554], [1548847440000, 3471.40242655], [1548848340000, 3459.96055881], [1548849240000, 3463.82559229], [1548850140000, 3460.76707958], [1548851040000, 3464.26637468], [1548851940000, 3472.77841737], [1548852840000, 3478.24591563], [1548853740000, 3484.96625215], [1548854640000, 3481.25559018], [1548855540000, 3488.80036198], [1548856440000, 3493.18324776], [1548857340000, 3482.29405736], [1548858240000, 3484.056119], [1548859140000, 3479.99562879], [1548860040000, 3477.46770854], [1548860940000, 3479.11452777], [1548861840000, 3481.60974379], [1548862740000, 3486.49465087], [1548863640000, 3487.08521699], [1548864540000, 3491.64635385], [1548865440000, 3484.21347688], [1548866340000, 3482.77919058], [1548867240000, 3485.37639254], [1548868140000, 3485.52746487], [1548869040000, 3488.19247233], [1548869940000, 3483.11996259], [1548870840000, 3488.01882559], [1548871741000, 3489.14954982], [1548872641000, 3492.72742468], [1548873540000, 3489.21200783], [1548874441000, 3489.16376257], [1548875340000, 3489.28234234], [1548876240000, 3493.5090319], [1548877140000, 3490.94765853], [1548878040000, 3486.94625925], [1548878941000, 3488.15885481], [1548879841000, 3478.02727141], [1548880740000, 3485.28129229], [1548881640000, 3482.20934763], [1548882544000, 3479.92273368], [1548883440000, 3480.66030954], [1548884340000, 3478.53393726], [1548885240000, 3481.84617161], [1548886141000, 3483.92119125], [1548887041000, 3483.77355162], [1548887941000, 3485.93287697], [1548888840000, 3484.35561464], [1548889740000, 3488.02245422], [1548890640000, 3487.49016519], [1548891541000, 3484.80790639], [1548892440000, 3485.769192], [1548893341000, 3483.22234598], [1548894240000, 3487.55990553], [1548895141000, 3491.58635484], [1548896040000, 3496.31300228], [1548896940000, 3503.67495853], [1548897841000, 3497.56583065], [1548898740000, 3501.98358215], [1548899640000, 3503.15636203], [1548900540000, 3496.36382483], [1548901441000, 3497.25252714], [1548902340000, 3493.61260579], [1548903240000, 3489.61757173], [1548904140000, 3492.81565647], [1548905041000, 3495.78396744], [1548905940000, 3490.13031473], [1548906841000, 3492.90754872], [1548907740000, 3494.41072663], [1548908641000, 3488.18390956], [1548909540000, 3487.0780935], [1548910440000, 3490.62780546], [1548911341000, 3490.40448148], [1548912240000, 3497.28738888], [1548913140000, 3490.05649439], [1548914040000, 3491.8396181], [1548914940000, 3489.57569571], [1548915840000, 3489.99518894], [1548916740000, 3491.22595989], [1548917640000, 3496.45634417], [1548918541000, 3496.20694846], [1548919441000, 3494.92966465], [1548920340000, 3500.14259408], [1548921241000, 3498.72838047], [1548922141000, 3499.3458918], [1548923040000, 3476.35469283], [1548923940000, 3468.30224865], [1548924841000, 3469.93876578], [1548925740000, 3471.57806559], [1548926641000, 3464.38220113], [1548927541000, 3460.85681376], [1548928440000, 3467.59370626], [1548929341000, 3468.31460018], [1548930240000, 3468.72808839], [1548931141000, 3460.48593611], [1548932041000, 3460.00648951], [1548932940000, 3456.93393903], [1548933840000, 3455.75540399], [1548934740000, 3459.76021881], [1548935640000, 3460.41612749], [1548936540000, 3453.03261513], [1548937440000, 3456.72926462], [1548938341000, 3460.63599729], [1548939240000, 3462.34128587], [1548940140000, 3464.21493122], [1548941041000, 3460.46364058], [1548941941000, 3465.82638905], [1548942840000, 3467.22869798], [1548943741000, 3464.75746035], [1548944641000, 3462.43203231], [1548945541000, 3462.79434922], [1548946440000, 3456.75885825], [1548947340000, 3458.22558682], [1548948240000, 3459.49495212], [1548949141000, 3460.09487337], [1548950040000, 3464.94905746], [1548950940000, 3464.54861367], [1548951841000, 3459.6636587], [1548952740000, 3459.38069182], [1548953640000, 3456.44428481], [1548954541000, 3451.09896483], [1548955441000, 3456.50717619], [1548956340000, 3459.44122072], [1548957241000, 3459.62502211], [1548958140000, 3456.38115361], [1548959043000, 3451.98986697], [1548959941000, 3453.32719647], [1548960840000, 3448.95130953], [1548961741000, 3449.34208852], [1548962640000, 3450.87583688], [1548963541000, 3466.19122954], [1548964440000, 3464.21499711], [1548965340000, 3462.08810146], [1548966241000, 3467.32015861], [1548967141000, 3467.65109475], [1548968040000, 3469.3080753], [1548968941000, 3472.05708331], [1548969841000, 3467.13515748], [1548970740000, 3463.84145871], [1548971640000, 3463.44388828], [1548972540000, 3465.59909617], [1548973440000, 3469.32331996], [1548974341000, 3466.21844953], [1548975240000, 3468.80708443], [1548976140000, 3475.50393117], [1548977040000, 3464.44331251], [1548977940000, 3464.32448028], [1548978840000, 3458.90827708], [1548979741000, 3467.35283251], [1548980640000, 3465.0384637], [1548981541000, 3460.70655582], [1548982440000, 3462.10108065], [1548983340000, 3458.74976914], [1548984240000, 3455.73900663], [1548985140000, 3455.07699782], [1548986040000, 3440.25552911], [1548986941000, 3435.86934159], [1548987841000, 3433.87307826], [1548988741000, 3435.09284821], [1548989640000, 3439.41863325], [1548990541000, 3444.29021151], [1548991440000, 3438.91239395], [1548992341000, 3442.05743188], [1548993240000, 3445.27126302], [1548994140000, 3444.17654472], [1548995040000, 3440.25732699], [1548995941000, 3441.8663978], [1548996841000, 3439.39756689], [1548997741000, 3440.07010664], [1548998641000, 3440.48425999], [1548999541000, 3439.78678084], [1549000441000, 3439.94345023], [1549001341000, 3437.87776307], [1549002241000, 3435.9726575], [1549003141000, 3438.0577386], [1549004041000, 3440.34432493], [1549004941000, 3439.87949568], [1549005840000, 3438.93609145], [1549006740000, 3435.00393166], [1549007641000, 3440.40561852], [1549008541000, 3437.52475472], [1549009440000, 3447.42779075], [1549010341000, 3440.83486903], [1549011241000, 3440.3182678], [1549012141000, 3446.54044084], [1549013040000, 3449.0882274], [1549013940000, 3454.07789342], [1549014841000, 3453.53939307], [1549015741000, 3452.52400495], [1549016641000, 3448.69334451], [1549017541000, 3450.61992409], [1549018440000, 3453.76897651], [1549019341000, 3461.68371593], [1549020240000, 3473.64803203], [1549021141000, 3478.64222821], [1549022040000, 3477.79465551], [1549022940000, 3475.62036766], [1549023841000, 3484.97354198], [1549024741000, 3490.69882715], [1549025641000, 3479.32634802], [1549026541000, 3483.97566125], [1549027441000, 3484.06175909], [1549028341000, 3483.87436654], [1549029240000, 3483.71857467], [1549030141000, 3491.75379699], [1549031040000, 3486.22875049], [1549031941000, 3487.76196512], [1549032840000, 3488.10426787], [1549033740000, 3484.03789666], [1549034641000, 3478.36919737], [1549035541000, 3480.33267383], [1549036440000, 3484.96579987], [1549037340000, 3484.89864404], [1549038240000, 3480.1120634], [1549039140000, 3477.02323582], [1549040040000, 3474.68128441], [1549040940000, 3475.40736253], [1549041840000, 3482.34179759], [1549042740000, 3480.160146], [1549043640000, 3482.85944508], [1549044540000, 3483.43750514], [1549045440000, 3482.28807113], [1549046340000, 3476.65376882], [1549047240000, 3479.09557404], [1549048140000, 3490.1624813], [1549049040000, 3496.14766197], [1549049940000, 3497.08943779], [1549050840000, 3496.15296885], [1549051740000, 3497.74952633], [1549052640000, 3498.84396533], [1549053540000, 3496.89208127], [1549054440000, 3496.9312856], [1549055340000, 3492.18034528], [1549056240000, 3490.61218366], [1549057140000, 3492.05998527], [1549058040000, 3496.62023009], [1549058940000, 3498.6470746], [1549059840000, 3489.79104988], [1549060740000, 3493.95734426], [1549061640000, 3493.95063336], [1549062540000, 3498.27456669], [1549063440000, 3499.46540367], [1549064340000, 3494.53184032], [1549065240000, 3490.25825625], [1549066140000, 3482.49269968], [1549067040000, 3490.70568625], [1549067940000, 3488.70261531], [1549068841000, 3483.46883954], [1549069740000, 3483.58791906], [1549070640000, 3483.66049673], [1549071540000, 3483.75858858], [1549072440000, 3480.02381711], [1549073340000, 3482.26918794], [1549074240000, 3484.21586223], [1549075140000, 3483.53613744], [1549076041000, 3485.36864394], [1549076940000, 3487.2071823], [1549077840000, 3486.95925022], [1549078740000, 3489.09757655], [1549079640000, 3487.4671918], [1549080540000, 3489.65362954], [1549081440000, 3482.8532453], [1549082340000, 3478.88573617], [1549083240000, 3478.4227178], [1549084140000, 3482.82655924], [1549085040000, 3478.49106904], [1549085940000, 3474.91029305], [1549086840000, 3477.47006159], [1549087740000, 3478.78197488], [1549088640000, 3477.41461095], [1549089540000, 3473.81003349], [1549090441000, 3467.57468262], [1549091340000, 3471.20239902], [1549092240000, 3476.56245375], [1549093140000, 3472.18613333], [1549094040000, 3475.11842773], [1549094940000, 3475.0766726], [1549095840000, 3471.72853247], [1549096740000, 3472.96329719], [1549097640000, 3471.21894], [1549098541000, 3474.6919182], [1549099440000, 3479.13567269], [1549100340000, 3477.58401895], [1549101240000, 3474.92605389], [1549102140000, 3478.52362833], [1549103040000, 3485.48314115], [1549103940000, 3483.18907928], [1549104840000, 3488.07176832], [1549105741000, 3485.7343078], [1549106640000, 3486.17253334], [1549107540000, 3489.50314703], [1549108440000, 3488.0292368], [1549109340000, 3497.57922262], [1549110240000, 3493.92863214], [1549111140000, 3490.82769323], [1549112040000, 3487.07654134], [1549112940000, 3489.79809025], [1549113840000, 3491.95934202], [1549114740000, 3494.14609567], [1549115640000, 3492.21208508], [1549116540000, 3487.05698345], [1549117440000, 3483.56896104], [1549118340000, 3485.79784414], [1549119240000, 3486.89965693], [1549120140000, 3489.6756253], [1549121040000, 3489.36034792], [1549121940000, 3486.73676648], [1549122840000, 3480.39165509], [1549123740000, 3478.84016885], [1549124640000, 3473.18690165], [1549125540000, 3474.66377469], [1549126440000, 3476.36834649], [1549127340000, 3479.97155648], [1549128240000, 3479.2671788], [1549129140000, 3479.63757808], [1549130040000, 3478.29625146], [1549130940000, 3481.32902243], [1549131840000, 3476.76422777], [1549132741000, 3482.50831544], [1549133640000, 3484.50242804], [1549134540000, 3482.11168568], [1549135440000, 3481.62541725], [1549136340000, 3482.97696022], [1549137240000, 3487.75785604], [1549138140000, 3488.29852468], [1549139040000, 3487.75982885], [1549139941000, 3491.04411617], [1549140840000, 3485.55826052], [1549141740000, 3488.68082465], [1549142640000, 3484.0465388], [1549143540000, 3491.33530678], [1549144440000, 3487.21849475], [1549145340000, 3484.38300879], [1549146240000, 3486.42102431], [1549147140000, 3483.60987324], [1549148040000, 3487.84066919], [1549148940000, 3488.10467128], [1549149840000, 3496.97456041], [1549150740000, 3508.34772212], [1549151641000, 3523.28733174], [1549152540000, 3520.30520358], [1549153440000, 3516.1597722], [1549154340000, 3512.9291222], [1549155240000, 3515.7038797], [1549156140000, 3503.77974707], [1549157040000, 3503.67068658], [1549157941000, 3504.83993628], [1549158840000, 3499.17492656], [1549159740000, 3501.71503179], [1549160640000, 3507.71211667], [1549161540000, 3507.19537056], [1549162440000, 3502.8720958], [1549163340000, 3496.14091855], [1549164240000, 3499.06522951], [1549165140000, 3484.66219797], [1549166040000, 3488.14033338], [1549166940000, 3502.49498125], [1549167840000, 3503.86060849], [1549168740000, 3498.75608814], [1549169640000, 3496.05467236], [1549170541000, 3496.14312518], [1549171440000, 3499.34819916], [1549172340000, 3495.16935813], [1549173240000, 3500.12238441], [1549174140000, 3501.08576754], [1549175040000, 3500.17140617], [1549175940000, 3493.70937194], [1549176840000, 3494.72431378], [1549177740000, 3486.43659144], [1549178640000, 3483.59256476], [1549179540000, 3481.0883898], [1549180440000, 3484.25064655], [1549181340000, 3480.69007634], [1549182240000, 3481.24969224], [1549183140000, 3473.64845143], [1549184040000, 3476.05782048], [1549184940000, 3474.8009839], [1549185840000, 3478.59035919], [1549186740000, 3476.73807499], [1549187640000, 3475.90621283], [1549188540000, 3469.42434183], [1549189440000, 3479.2467621], [1549190340000, 3480.5233112], [1549191240000, 3477.85077503], [1549192140000, 3482.6624263], [1549193040000, 3478.9127169], [1549193940000, 3479.42851968], [1549194840000, 3474.58597228], [1549195740000, 3476.19482222], [1549196640000, 3474.2198178], [1549197540000, 3475.64759417], [1549198441000, 3476.0999902], [1549199340000, 3478.95036249], [1549200240000, 3479.80834527], [1549201140000, 3481.16384847], [1549202040000, 3481.93208735], [1549202940000, 3480.25975722], [1549203840000, 3479.14270254], [1549204740000, 3477.89588782], [1549205641000, 3475.1491998], [1549206540000, 3476.65018981], [1549207440000, 3474.05559832], [1549208340000, 3475.0981787], [1549209240000, 3473.38861937], [1549210140000, 3472.1465741], [1549211040000, 3478.6489481], [1549211940000, 3477.31398621], [1549212840000, 3478.26928466], [1549213740000, 3473.8904576], [1549214640000, 3476.82182521], [1549215540000, 3473.95649231], [1549216440000, 3476.17623337], [1549217340000, 3474.34469508], [1549218240000, 3480.03610757], [1549219140000, 3477.69880997], [1549220040000, 3479.13764518], [1549220940000, 3477.66366084], [1549221840000, 3473.99916255], [1549222740000, 3468.36685881], [1549223640000, 3470.16026599], [1549224540000, 3453.48755594], [1549225440000, 3456.31245092], [1549226340000, 3453.52403899], [1549227240000, 3457.02563945], [1549228140000, 3456.91845179], [1549229040000, 3453.4151051], [1549229941000, 3448.24604957], [1549230840000, 3450.98518399], [1549231740000, 3450.59644988], [1549232641000, 3450.65529434], [1549233540000, 3455.2685336], [1549234440000, 3459.82749152], [1549235340000, 3458.55787739], [1549236240000, 3461.63306368], [1549237140000, 3464.04756037], [1549238040000, 3459.55365841], [1549238940000, 3467.96415597], [1549239840000, 3469.99295571], [1549240740000, 3475.26704138], [1549241641000, 3470.55990578], [1549242540000, 3470.32091524], [1549243440000, 3469.27019906], [1549244341000, 3466.3827428], [1549245241000, 3475.91706468]], "volume_usd": [[1548640441000, 5565731139], [1548641341000, 5571020423], [1548642241000, 5499749311], [1548643141000, 5576756487], [1548644041000, 5529416999], [1548644941000, 5578018930], [1548645842000, 5677733503], [1548646741000, 5617461274], [1548647641000, 5744441936], [1548648541000, 5729966751], [1548649441000, 5762182593], [1548650341000, 5806512948], [1548651240000, 5762658194], [1548652141000, 5784735782], [1548653040000, 5837243288], [1548653941000, 5876112882], [1548654840000, 5825673764], [1548655741000, 5835455988], [1548656641000, 5935692218], [1548657541000, 5972041817], [1548658440000, 6016520049], [1548659341000, 6015062750], [1548660241000, 6058064701], [1548661140000, 6075238391], [1548662040000, 6099747867], [1548662940000, 6086525987], [1548663841000, 6093462973], [1548664741000, 6120778894], [1548665641000, 6153192136], [1548666540000, 6130532836], [1548667441000, 6180715146], [1548668340000, 6211562976], [1548669241000, 6210133029], [1548670140000, 6152673435], [1548671040000, 6151024784], [1548671940000, 6151558629], [1548672840000, 6144839041], [1548673741000, 6075936297], [1548674641000, 6077499028], [1548675540000, 6086821658], [1548676441000, 6091421314], [1548677341000, 6092255209], [1548678241000, 6119194939], [1548679141000, 6130745708], [1548680040000, 6143616033], [1548680940000, 6092508545], [1548681840000, 6114123986], [1548682740000, 6136749163], [1548683641000, 6143112540], [1548684540000, 6087021526], [1548685441000, 6078345616], [1548686341000, 6032583283], [1548687241000, 6001477439], [1548688140000, 5963792237], [1548689041000, 6021329805], [1548689940000, 6089008119], [1548690840000, 6175856226], [1548691741000, 6196376660], [1548692640000, 6220713944], [1548693540000, 6246682258], [1548694441000, 6264790841], [1548695341000, 6249306212], [1548696241000, 6267834136], [1548697140000, 6247441794], [1548698040000, 6288616859], [1548698940000, 6264396318], [1548699840000, 6293516906], [1548700741000, 6307444877], [1548701640000, 6324046019], [1548702540000, 6287298294], [1548703440000, 6300594920], [1548704341000, 6311865640], [1548705241000, 6327680891], [1548706141000, 6311971848], [1548707041000, 6330270896], [1548707941000, 6356951521], [1548708840000, 6376538335], [1548709741000, 6344210520], [1548710640000, 6353280660], [1548711541000, 6367912023], [1548712441000, 6376632047], [1548713340000, 6358813946], [1548714240000, 6374778973], [1548715141000, 6373659595], [1548716041000, 6415776318], [1548716941000, 6829699874], [1548717840000, 6879210494], [1548718740000, 6906782610], [1548719641000, 6910840250], [1548720541000, 6841545654], [1548721440000, 6863246722], [1548722341000, 6869131584], [1548723241000, 6878300753], [1548724141000, 6849312484], [1548725041000, 6848566623], [1548725940000, 6852567406], [1548726841000, 6872136411], [1548727741000, 6802977958], [1548728641000, 6811552405], [1548729540000, 6811764774], [1548730441000, 6820097582], [1548731340000, 6736056210], [1548732241000, 6707388082], [1548733141000, 6687604357], [1548734041000, 6676928996], [1548734941000, 6594544553], [1548735841000, 6583219539], [1548736741000, 6587951774], [1548737640000, 6582180459], [1548738541000, 6522776310], [1548739440000, 6502550318], [1548740340000, 6486534601], [1548741241000, 6500357523], [1548742140000, 6406149976], [1548743041000, 6421522831], [1548743941000, 6423960826], [1548744840000, 6423094053], [1548745741000, 6375266539], [1548746641000, 6360028696], [1548747540000, 6369191397], [1548748441000, 6386212473], [1548749341000, 6391808360], [1548750241000, 6413894787], [1548751141000, 6447853929], [1548752041000, 6089064897], [1548752940000, 6038875061], [1548753841000, 6060203042], [1548754741000, 6079392215], [1548755641000, 6095155922], [1548756540000, 6063313083], [1548757441000, 6074645057], [1548758341000, 6072120373], [1548759240000, 6089177091], [1548760142000, 6063774459], [1548761040000, 6061960639], [1548761941000, 6059294744], [1548762841000, 6061089293], [1548763741000, 6003979697], [1548764640000, 6004053389], [1548765541000, 6025473722], [1548766441000, 6057852902], [1548767341000, 6037121566], [1548768241000, 6076969085], [1548769140000, 6097932800], [1548770040000, 6114637624], [1548770941000, 6073293798], [1548771841000, 6097961479], [1548772741000, 6127418930], [1548773640000, 6150776376], [1548774541000, 6087147416], [1548775440000, 6033713050], [1548776340000, 5970161085], [1548777240000, 5936776168], [1548778140000, 5902533393], [1548779040000, 5930984951], [1548779940000, 5921732149], [1548780840000, 5916384234], [1548781740000, 5869269437], [1548782640000, 5876348300], [1548783540000, 5882062330], [1548784440000, 5916853034], [1548785340000, 5892270113], [1548786240000, 5900731236], [1548787140000, 5912422450], [1548788040000, 5908911097], [1548788940000, 5887594876], [1548789840000, 5900258089], [1548790740000, 5933929561], [1548791640000, 5943195526], [1548792540000, 5912085117], [1548793440000, 5934814143], [1548794340000, 5936678028], [1548795240000, 5940601712], [1548796140000, 5904062754], [1548797040000, 5928855431], [1548797940000, 5931049580], [1548798840000, 5942319647], [1548799740000, 5901085106], [1548800640000, 5932319177], [1548801540000, 5951052361], [1548802440000, 5947065032], [1548803340000, 5894625008], [1548804240000, 5883530334], [1548805140000, 5886091850], [1548806040000, 5892088106], [1548806940000, 5795026373], [1548807840000, 5809312681], [1548808740000, 5826557981], [1548809640000, 5850430641], [1548810540000, 5828604954], [1548811440000, 5836216448], [1548812340000, 5841288256], [1548813240000, 5835043559], [1548814140000, 5807853084], [1548815040000, 5829963077], [1548815940000, 5840279336], [1548816840000, 5820063222], [1548817741000, 5821666612], [1548818640000, 5862829702], [1548819540000, 5869240777], [1548820440000, 5874131095], [1548821340000, 5843921506], [1548822240000, 5892075942], [1548823140000, 5897062346], [1548824040000, 5899207466], [1548824940000, 5854776029], [1548825840000, 5862408236], [1548826740000, 5874688828], [1548827640000, 5888252162], [1548828540000, 5832111054], [1548829440000, 5813962580], [1548830341000, 5814269529], [1548831240000, 5813012079], [1548832140000, 5751574761], [1548833040000, 5759518603], [1548833940000, 5742949550], [1548834841000, 5724680240], [1548835740000, 5642049402], [1548836640000, 5639719931], [1548837541000, 5632139343], [1548838440000, 5636421293], [1548839340000, 5589120426], [1548840240000, 5588743871], [1548841140000, 5579743089], [1548842040000, 5590264895], [1548842940000, 5553516063], [1548843840000, 5561195173], [1548844741000, 5586000750], [1548845640000, 5594076397], [1548846540000, 5564569863], [1548847440000, 5588199431], [1548848340000, 5600962615], [1548849240000, 5612590075], [1548850140000, 5579556450], [1548851040000, 5613747115], [1548851940000, 5690040955], [1548852840000, 5766021684], [1548853740000, 5774713867], [1548854640000, 5779563446], [1548855540000, 5807802977], [1548856440000, 5859495411], [1548857340000, 5816530566], [1548858240000, 5842191648], [1548859140000, 5847245600], [1548860040000, 5860318975], [1548860940000, 5837583305], [1548861840000, 5862936008], [1548862740000, 5881496541], [1548863640000, 5892045070], [1548864540000, 5872129499], [1548865440000, 5853850095], [1548866340000, 5870629437], [1548867240000, 5886331872], [1548868140000, 5855269829], [1548869040000, 5872540090], [1548869940000, 5868624437], [1548870840000, 5869269606], [1548871741000, 5842080204], [1548872641000, 5874357457], [1548873540000, 5892674890], [1548874441000, 5915771412], [1548875340000, 5886187622], [1548876240000, 5909095420], [1548877140000, 5919786520], [1548878040000, 5930098932], [1548878941000, 5900583218], [1548879841000, 5904065029], [1548880740000, 5934971690], [1548881640000, 5938911765], [1548882544000, 5906774086], [1548883440000, 5924376493], [1548884340000, 5936448283], [1548885240000, 5953094036], [1548886141000, 5926549671], [1548887041000, 5937020701], [1548887941000, 5952114070], [1548888840000, 5935556250], [1548889740000, 5904324002], [1548890640000, 5917631787], [1548891541000, 5936204734], [1548892440000, 5948821097], [1548893341000, 5874181510], [1548894240000, 5884065852], [1548895141000, 5909670759], [1548896040000, 5954581814], [1548896940000, 5957898203], [1548897841000, 5967757015], [1548898740000, 5998670357], [1548899640000, 6027338808], [1548900540000, 5991984411], [1548901441000, 6005805682], [1548902340000, 6008316677], [1548903240000, 6013524791], [1548904140000, 5957328396], [1548905041000, 5953140165], [1548905940000, 5949310024], [1548906841000, 5950900363], [1548907740000, 5912342031], [1548908641000, 5896160501], [1548909540000, 5903452814], [1548910440000, 5920151818], [1548911341000, 5887481353], [1548912240000, 5898073429], [1548913140000, 5884810684], [1548914040000, 5874013186], [1548914940000, 5847088456], [1548915840000, 5826068422], [1548916740000, 5828671074], [1548917640000, 5848517495], [1548918541000, 5809919664], [1548919441000, 5815165386], [1548920340000, 5830482663], [1548921241000, 5843937587], [1548922141000, 5840815692], [1548923040000, 5850694060], [1548923940000, 5849547119], [1548924841000, 5894703148], [1548925740000, 5856520290], [1548926641000, 5855806816], [1548927541000, 5884047374], [1548928440000, 5912060003], [1548929341000, 5918054005], [1548930240000, 5936274463], [1548931141000, 5983102680], [1548932041000, 6023561878], [1548932940000, 5992611004], [1548933840000, 6019417039], [1548934740000, 6064766167], [1548935640000, 6041231151], [1548936540000, 5983129890], [1548937440000, 5992086637], [1548938341000, 6021793931], [1548939240000, 5938005081], [1548940140000, 5865872386], [1548941041000, 5846008405], [1548941941000, 5855713483], [1548942840000, 5835478558], [1548943741000, 5766089243], [1548944641000, 5831587262], [1548945541000, 5797929678], [1548946440000, 5771517988], [1548947340000, 5756625023], [1548948240000, 5720086133], [1548949141000, 5806546232], [1548950040000, 5739686385], [1548950940000, 5683914810], [1548951841000, 5767581939], [1548952740000, 5733333833], [1548953640000, 5688560648], [1548954541000, 5641430891], [1548955441000, 5662585279], [1548956340000, 5678915268], [1548957241000, 5683129694], [1548958140000, 5633158160], [1548959043000, 5693529471], [1548959941000, 5703439948], [1548960840000, 5752003654], [1548961741000, 5662279620], [1548962640000, 5787515318], [1548963541000, 5710129476], [1548964440000, 5709012695], [1548965340000, 5725280568], [1548966241000, 5690445164], [1548967141000, 5682976782], [1548968040000, 5799434838], [1548968941000, 5704767897], [1548969841000, 5768721775], [1548970740000, 5657280494], [1548971640000, 5667097199], [1548972540000, 5652882000], [1548973440000, 5675280375], [1548974341000, 5678889236], [1548975240000, 5698717774], [1548976140000, 5676249703], [1548977040000, 5815123855], [1548977940000, 5674957280], [1548978840000, 5697107063], [1548979741000, 5773843767], [1548980640000, 5653004833], [1548981541000, 5795680278], [1548982440000, 5713021435], [1548983340000, 5603754585], [1548984240000, 5760834443], [1548985140000, 5636336131], [1548986040000, 5787847015], [1548986941000, 5609553091], [1548987841000, 5672590900], [1548988741000, 5643434855], [1548989640000, 5661160001], [1548990541000, 5788211237], [1548991440000, 5649709884], [1548992341000, 5667289180], [1548993240000, 5692441529], [1548994140000, 5651478980], [1548995040000, 5806448504], [1548995941000, 5669852094], [1548996841000, 5684868593], [1548997741000, 5660139953], [1548998641000, 5825451991], [1548999541000, 5685246748], [1549000441000, 5692238057], [1549001341000, 5724517364], [1549002241000, 5677972643], [1549003141000, 5695789572], [1549004041000, 5704198038], [1549004941000, 5683629994], [1549005840000, 5867702209], [1549006740000, 5724770675], [1549007641000, 5754037437], [1549008541000, 5719983620], [1549009440000, 5725698832], [1549010341000, 5703682435], [1549011241000, 5720232658], [1549012141000, 5691589769], [1549013040000, 5706778271], [1549013940000, 5704761169], [1549014841000, 5702359663], [1549015741000, 5623559882], [1549016641000, 5605621756], [1549017541000, 5559724410], [1549018440000, 5539356540], [1549019341000, 5519557501], [1549020240000, 5533592838], [1549021141000, 5547813988], [1549022040000, 5553113989], [1549022940000, 5508105121], [1549023841000, 5528849042], [1549024741000, 5551541686], [1549025641000, 5546648187], [1549026541000, 5511545672], [1549027441000, 5519355660], [1549028341000, 5538146826], [1549029240000, 5544846987], [1549030141000, 5504936616], [1549031040000, 5504932380], [1549031941000, 5518957690], [1549032840000, 5526027097], [1549033740000, 5462903249], [1549034641000, 5460738794], [1549035541000, 5474679876], [1549036440000, 5482921251], [1549037340000, 5457097892], [1549038240000, 5447023443], [1549039140000, 5453636053], [1549040040000, 5468947205], [1549040940000, 5432456336], [1549041840000, 5449277878], [1549042740000, 5463278231], [1549043640000, 5478566119], [1549044540000, 5446762976], [1549045440000, 5449476178], [1549046340000, 5448906612], [1549047240000, 5461019652], [1549048140000, 5449237469], [1549049040000, 5494450873], [1549049940000, 5493105345], [1549050840000, 5510766127], [1549051740000, 5481403525], [1549052640000, 5487677381], [1549053540000, 5498536760], [1549054440000, 5503113195], [1549055340000, 5452460712], [1549056240000, 5467883923], [1549057140000, 5480587387], [1549058040000, 5496540090], [1549058940000, 5470143853], [1549059840000, 5453809130], [1549060740000, 5464416288], [1549061640000, 5459804315], [1549062540000, 5424325626], [1549063440000, 5433717178], [1549064340000, 5420141466], [1549065240000, 5418831582], [1549066140000, 5302608637], [1549067040000, 5311715539], [1549067940000, 5277717451], [1549068841000, 5279176085], [1549069740000, 5235084539], [1549070640000, 5225797259], [1549071540000, 5232755366], [1549072440000, 5217579524], [1549073340000, 5168657396], [1549074240000, 5181686249], [1549075140000, 5173018963], [1549076041000, 5190992045], [1549076940000, 5160324659], [1549077840000, 5168391026], [1549078740000, 5176414451], [1549079640000, 5186713162], [1549080540000, 5151601583], [1549081440000, 5150012016], [1549082340000, 5158098206], [1549083240000, 5163241156], [1549084140000, 5099214564], [1549085040000, 5112779661], [1549085940000, 5121786778], [1549086840000, 5142392731], [1549087740000, 5114725136], [1549088640000, 5120034126], [1549089540000, 5126525424], [1549090441000, 5137053314], [1549091340000, 5103366797], [1549092240000, 5109791380], [1549093140000, 5110285934], [1549094040000, 5107327766], [1549094940000, 5061248701], [1549095840000, 5066906829], [1549096740000, 5082375024], [1549097640000, 5078292903], [1549098541000, 5040657787], [1549099440000, 5052901056], [1549100340000, 5063955524], [1549101240000, 5085105953], [1549102140000, 5073372768], [1549103040000, 5090196245], [1549103940000, 5084797894], [1549104840000, 5105144357], [1549105741000, 5060792681], [1549106640000, 5041204089], [1549107540000, 5048147667], [1549108440000, 5056770866], [1549109340000, 5043051700], [1549110240000, 5036800579], [1549111140000, 5032426681], [1549112040000, 5032689358], [1549112940000, 4998873108], [1549113840000, 5015846093], [1549114740000, 5023100049], [1549115640000, 5023745406], [1549116540000, 4989741794], [1549117440000, 5001256462], [1549118340000, 5017864912], [1549119240000, 5024475102], [1549120140000, 5004965996], [1549121040000, 5009980697], [1549121940000, 4983875975], [1549122840000, 4991613249], [1549123740000, 4953455265], [1549124640000, 4964678508], [1549125540000, 4957740818], [1549126440000, 4969064700], [1549127340000, 4944550388], [1549128240000, 4954290590], [1549129140000, 4955941770], [1549130040000, 4961195258], [1549130940000, 4944841509], [1549131840000, 4944929763], [1549132741000, 4961962918], [1549133640000, 4963766307], [1549134540000, 4934828261], [1549135440000, 4911243130], [1549136340000, 4905621887], [1549137240000, 4932235718], [1549138140000, 4907947229], [1549139040000, 4912006283], [1549139941000, 4923573225], [1549140840000, 4915324126], [1549141740000, 4884857683], [1549142640000, 4873360397], [1549143540000, 4886790111], [1549144440000, 4886207910], [1549145340000, 4842383300], [1549146240000, 4861343649], [1549147140000, 4870328904], [1549148040000, 4884613190], [1549148940000, 4858502384], [1549149840000, 4882464646], [1549150740000, 4969778225], [1549151641000, 5070656553], [1549152540000, 4983865044], [1549153440000, 5000582578], [1549154340000, 5018032063], [1549155240000, 5037340398], [1549156140000, 5008216439], [1549157040000, 5022032154], [1549157941000, 5039400737], [1549158840000, 5043332266], [1549159740000, 5028304697], [1549160640000, 5038832047], [1549161540000, 5048912614], [1549162440000, 5048248125], [1549163340000, 4998185941], [1549164240000, 5017588580], [1549165140000, 5011806418], [1549166040000, 5027404317], [1549166940000, 5021396100], [1549167840000, 5029494771], [1549168740000, 5029581893], [1549169640000, 5033437373], [1549170541000, 5000329977], [1549171440000, 5008095902], [1549172340000, 5007609195], [1549173240000, 5025737808], [1549174140000, 4992692101], [1549175040000, 4959937716], [1549175940000, 4966432989], [1549176840000, 4973440536], [1549177740000, 4935832571], [1549178640000, 4934049494], [1549179540000, 4928291263], [1549180440000, 4952683485], [1549181340000, 4936624534], [1549182240000, 4935735739], [1549183140000, 4976118035], [1549184040000, 4995693586], [1549184940000, 4956678861], [1549185840000, 4973085070], [1549186740000, 4972581108], [1549187640000, 4975010829], [1549188540000, 4926952109], [1549189440000, 4949656186], [1549190340000, 4966501111], [1549191240000, 4965991718], [1549192140000, 4909686368], [1549193040000, 4914640613], [1549193940000, 4938421628], [1549194840000, 4895937314], [1549195740000, 4899080835], [1549196640000, 4861208741], [1549197540000, 4881291692], [1549198441000, 4886724005], [1549199340000, 4849054573], [1549200240000, 4890788014], [1549201140000, 4879011334], [1549202040000, 4887528484], [1549202940000, 4868779714], [1549203840000, 4906689531], [1549204740000, 4904868756], [1549205641000, 4875093444], [1549206540000, 4902365258], [1549207440000, 4888761259], [1549208340000, 4897198400], [1549209240000, 4906482089], [1549210140000, 4928374183], [1549211040000, 4943606358], [1549211940000, 4955692770], [1549212840000, 4935004578], [1549213740000, 4904574667], [1549214640000, 4975161369], [1549215540000, 4937099835], [1549216440000, 4981461412], [1549217340000, 4909025770], [1549218240000, 4959882646], [1549219140000, 4990174623], [1549220040000, 5003090581], [1549220940000, 4982056371], [1549221840000, 4993260406], [1549222740000, 5007499005], [1549223640000, 5014142344], [1549224540000, 5005491483], [1549225440000, 5035050933], [1549226340000, 5063405345], [1549227240000, 5096689689], [1549228140000, 5089205786], [1549229040000, 5107870660], [1549229941000, 5222479123], [1549230840000, 5252542752], [1549231740000, 5153237950], [1549232641000, 5076664388], [1549233540000, 5108343595], [1549234440000, 5133965892], [1549235340000, 5092760964], [1549236240000, 5115188632], [1549237140000, 5093475730], [1549238040000, 5049894279], [1549238940000, 4924867229], [1549239840000, 4932889715], [1549240740000, 4926308867], [1549241641000, 4931437742], [1549242540000, 4898688344], [1549243440000, 4903149096], [1549244341000, 4908383263], [1549245241000, 4935150365]]} -------------------------------------------------------------------------------- /train_and_deploy.py: -------------------------------------------------------------------------------- 1 | ''' 2 | DERIVED FROM:https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/sklearn/README.rst 3 | 4 | Preparing the Scikit-learn training script 5 | Your Scikit-learn training script must be a Python 2.7 or 3.5 compatible source file. 6 | 7 | The training script is very similar to a training script you might run outside of SageMaker, 8 | but you can access useful properties about the training environment through various environment variables, 9 | such as 10 | 11 | - SM_MODEL_DIR: 12 | A string representing the path to the directory to write model artifacts to. 13 | These artifacts are uploaded to S3 for model hosting. 14 | - SM_OUTPUT_DATA_DIR: 15 | A string representing the filesystem path to write output artifacts to. 16 | Output artifacts may include checkpoints, graphs, and other files to save, 17 | not including model artifacts. These artifacts are compressed and uploaded 18 | to S3 to the same S3 prefix as the model artifacts. 19 | 20 | Supposing two input channels, 'train' and 'test', 21 | were used in the call to the Scikit-learn estimator's fit() method, 22 | the following will be set, following the format "SM_CHANNEL_[channel_name]": 23 | 24 | - SM_CHANNEL_TRAIN: 25 | A string representing the path to the directory containing data in the 'train' channel 26 | 27 | - SM_CHANNEL_TEST: 28 | Same as above, but for the 'test' channel. 29 | A typical training script loads data from the input channels, 30 | configures training with hyperparameters, trains a model, 31 | and saves a model to model_dir so that it can be hosted later. 32 | Hyperparameters are passed to your script as arguments and can 33 | be retrieved with an argparse.ArgumentParser instance. 34 | For example, a training script might start with the following: 35 | 36 | 37 | Because the SageMaker imports your training script, 38 | you should put your training code in a main guard (if __name__=='__main__':) 39 | if you are using the same script to host your model, 40 | so that SageMaker does not inadvertently run your training code at the wrong point in execution. 41 | 42 | For more on training environment variables, please visit https://github.com/aws/sagemaker-containers. 43 | ''' 44 | 45 | 46 | import argparse 47 | import os 48 | 49 | import pandas as pd 50 | 51 | import sklearn 52 | 53 | from sklearn import linear_model 54 | 55 | import numpy as np 56 | 57 | import six 58 | from six import StringIO, BytesIO 59 | 60 | # from sagemaker.content_types import CONTENT_TYPE_JSON, CONTENT_TYPE_CSV, CONTENT_TYPE_NPY 61 | # Interesting fact: 62 | # on SageMaker model training instance, py-sagemaker is not installed 63 | # import sagemaker 64 | 65 | # matplotlib is not available 66 | # from matplotlib import pyplot as plt 67 | 68 | from sklearn.externals import joblib 69 | import json 70 | 71 | from sagemaker_containers.beta.framework import ( 72 | content_types, encoders, env, modules, transformer, worker) 73 | 74 | 75 | fn = 'sample_data.json' 76 | 77 | MA_list = [50, 100, 200, 300, 400, 800, 1600] 78 | intput_col = ["MA-{}".format(ma_lag) for ma_lag in MA_list[:-1]] 79 | benchmark_col = 'MA-1600' 80 | 81 | 82 | ''' 83 | The RealTimePredictor used by Scikit-learn in the SageMaker 84 | Python SDK serializes NumPy arrays to the NPY format by default, 85 | with Content-Type application/x-npy. The SageMaker Scikit-learn model server 86 | can deserialize NPY-formatted data (along with JSON and CSV data). 87 | ''' 88 | def input_fn(request_body, request_content_type): 89 | """An input_fn that loads a pickled numpy array""" 90 | # print("request_body=",str(request_body)) 91 | # print("np.load(StringIO(request_body))=",np.load(StringIO(request_body))) 92 | 93 | if request_content_type == "application/python-pickle": 94 | array = np.load(BytesIO((request_body))) 95 | # print("array=",array) 96 | return array 97 | elif request_content_type == 'application/json': 98 | jsondata = json.load(StringIO(request_body)) 99 | normalized_data, benchmark_data = process_input_data(jsondata) 100 | # print("normalized_data=",normalized_data) 101 | return normalized_data, benchmark_data 102 | else: 103 | # Handle other content-types here or raise an Exception 104 | # if the content type is not supported. 105 | raise ValueError("{} not supported by script!".format(request_content_type)) 106 | 107 | def output_fn(prediction, accept): 108 | """Format prediction output 109 | 110 | The default accept/content-type between containers for serial inference is JSON. 111 | We also want to set the ContentType or mimetype as the same value as accept so the next 112 | container can read the response payload correctly. 113 | """ 114 | if accept == "application/json": 115 | return worker.Response(json.dumps(prediction), accept, mimetype=accept) 116 | elif accept == 'text/csv': 117 | return worker.Response(encoders.encode(prediction, accept), accept, mimetype=accept) 118 | else: 119 | raise ValueError("{} accept type is not supported by this script.".format(accept)) 120 | 121 | def predict_fn(input_data, model): 122 | """Preprocess input data 123 | 124 | We implement this because the default predict_fn uses .predict(), but our model is a preprocessor 125 | so we want to use .transform(). 126 | 127 | The output is returned in the following order: 128 | 129 | rest of features either one hot encoded or standardized 130 | """ 131 | normalized_data, benchmark_data = input_data 132 | 133 | prediction = model.predict(normalized_data) 134 | 135 | output = np.array(prediction) * np.array(benchmark_data) 136 | 137 | return {'prediction-base-time': str(normalized_data.index[-1]), 138 | 'predicted-value': output[-1]} 139 | 140 | def model_fn(model_dir): 141 | clf = joblib.load(os.path.join(model_dir, "model.joblib")) 142 | return clf 143 | 144 | def process_input_data(cmcjsondata, for_training = False): 145 | raw_data = pd.DataFrame(cmcjsondata) 146 | dat = pd.DataFrame(list(raw_data['price_usd']), columns=['timestamp', 'usd']) 147 | dat['dt_utc'] = pd.to_datetime(dat['timestamp']*1e6) 148 | dat = dat.set_index('dt_utc') 149 | resampled_data = dat['usd'].resample('30S').mean().interpolate('linear') 150 | 151 | feature = {} 152 | 153 | if for_training: 154 | Y = resampled_data.rolling(2880).median().shift(-2879) # next 24 hour 155 | feature['Y'] = Y 156 | 157 | for ma_lag in MA_list: 158 | feature["MA-{}".format(ma_lag)] = resampled_data.rolling(ma_lag).mean() 159 | 160 | data = pd.DataFrame(feature).dropna() 161 | benchmark_data = data[benchmark_col].copy() 162 | normalized_data = data.div(data[benchmark_col], axis=0) 163 | 164 | _col = intput_col + (['Y'] if for_training else []) 165 | 166 | return normalized_data[_col], benchmark_data 167 | 168 | def run_training(args): 169 | 170 | with open(os.path.join(args.train, fn)) as fp: 171 | jsondata = json.load(fp) 172 | normalized_data, _ = process_input_data(jsondata, for_training = True) 173 | 174 | model = linear_model.Ridge() 175 | model.fit(normalized_data[intput_col], normalized_data['Y']) 176 | 177 | joblib.dump(model, os.path.join(args.model_dir, "model.joblib")) 178 | 179 | 180 | if __name__ =='__main__': 181 | 182 | parser = argparse.ArgumentParser() 183 | 184 | # hyperparameters sent by the client are passed as command-line arguments to the script. 185 | parser.add_argument('--epochs', type=int, default=50) 186 | parser.add_argument('--batch-size', type=int, default=64) 187 | parser.add_argument('--learning-rate', type=float, default=0.05) 188 | 189 | # Data, model, and output directories 190 | parser.add_argument('--output-data-dir', type=str, default=os.environ.get('SM_OUTPUT_DATA_DIR')) 191 | parser.add_argument('--model-dir', type=str, default=os.environ.get('SM_MODEL_DIR')) 192 | parser.add_argument('--train', type=str, default=os.environ.get('SM_CHANNEL_TRAIN')) 193 | parser.add_argument('--test', type=str, default=os.environ.get('SM_CHANNEL_TEST')) 194 | 195 | args, _ = parser.parse_known_args() 196 | 197 | run_training(args) 198 | 199 | # ... load from args.train and args.test, train a model, write model to args.model_dir. 200 | 201 | --------------------------------------------------------------------------------