-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdsserver-client-test.py
75 lines (51 loc) · 2.45 KB
/
pdsserver-client-test.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import requests
import json
import warnings
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=RuntimeWarning, module="importlib._bootstrap")
# your code here
response = requests.post('http://localhost:5000/getPH', json={'instrument': 'EUR/USD', 'timeframe': 'H4'})
#print(response.json())
print(response.text)
print("mk_fn")
response = requests.get('http://localhost:5000/mk_fn', params={'instrument': 'EUR/USD', 'timeframe': 'm1', 'ext': 'csv'})
print(response.json())
print("------------------")
print("---- from file store route ---")
import pandas as pd
#response = requests.post('http://localhost:5000/getPH_from_filestore', json={'instrument': 'EUR/USD', 'timeframe': 'H4', 'quiet': True, 'compressed': False, 'with_index': True}) df = pd.read_json(response.text, orient='split')
from io import StringIO
print("-----------------------from market data ---------------")
response = requests.post('http://localhost:5000/getPH',
json={'instrument': 'EUR/USD',
'timeframe': 'H4'})
df = pd.read_json(StringIO(response.text), orient='split')
print(df)
print("-----------------------from filestore ---------------")
response = requests.post('http://localhost:5000/getPH_from_filestore',
json={'instrument': 'EUR/USD',
'timeframe': 'H4',
'quiet': True,
'compressed': False,
'with_index': True})
df = pd.read_json(StringIO(response.text), orient='split')
print(df)
print("-----------Run CLI---------")
import requests
response = requests.post('http://localhost:5000/run_jgtcli',
json={'instrument': 'EUR/USD',
'timeframe': 'H4',
'output': True,
'cds': True,
'verbose': 1,
'datefrom': '01.01.2022 00:00:00',
'dateto': '01.01.2023 00:00:00'})
print(response.json())
import requests
response = requests.post('http://localhost:5000/run_jgtcli',
json={'instrument': 'EUR/USD',
'timeframe': 'H4',
'output': True,
'cds': True})
print(response.json())