-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdlhistory.jl
38 lines (38 loc) · 967 Bytes
/
dlhistory.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function mc(startTime="2015-01-01",endTime="2015-01-02")
rd="""{
"base": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"counter": {
"currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"endTime": "$(endTime)T00:00:00.000Z",
"startTime": "$(startTime)T00:00:00.000Z",
"timeIncrement": "minute",
"timeMultiple": 15,
"format": "json"
}"""
f=open("rd.txt","w");write(f,rd);close(f)
`curl -X POST -d @rd.txt https://api.ripplecharts.com/api/offers_exercised --header "Content-Type:application/json"`
end
r=readall(mc("2015-01-01","2015-01-02"))
#uncomment the following line to download full history
#r=readall(mc("2012-01-01","2017-01-01"))
function parseprice(r)
l=search(r,"open\":")
if l==0:-1
return Void
end
l=l[end]
le=search(r[l:end],',')
p=r[l+1:l+le-2]
return parse(Float64,p),r[l+le:end]
end
prices=Float64[]
t=parseprice(r)
while t!=Void
push!(prices,t[1])
t=parseprice(t[2])
end