-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetData.py
37 lines (29 loc) · 1.15 KB
/
getData.py
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
import requests
#returns instruments JSON
def getInstruments():
request = requests.get("http://egchallenge.tech/instruments").json()
return request
#returns number of different instruments
def getNumberOfInstruments():
instruments = getInstruments()
return len(instruments)
#returns current epoch INT
def getCurrentEpoch():
request = requests.get("http://egchallenge.tech/epoch").json()
return request['current_epoch']
#returns prediction epoch INT
def getPredictionEpoch():
request = requests.get("http://egchallenge.tech/epoch").json()
return request['prediction_epoch']
#returns market data for specific instrument JSON
def getMarketDataIntrument(instrument):
url = "http://egchallenge.tech/marketdata/instrument/" + instrument
return requests.get(url).json()
#returns market data for given epoch JSON
#EPOCH MUST BE STR
def getMarketDataEpoch(epoch):
url = "http://egchallenge.tech/marketdata/epoch/" + epoch
return requests.get(url).json()
#returns latest market data JSON
def getMarketDataLatest():
return requests.get("http://egchallenge.tech/marketdata/latest").json()