jgtfx2console 0.4.4__py3-none-any.whl → 0.4.18__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- jgtfx2console/__init__.py +2 -2
- jgtfx2console/fxcli2console.py +28 -10
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.18.dist-info}/METADATA +2 -5
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.18.dist-info}/RECORD +8 -8
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.18.dist-info}/WHEEL +1 -1
- jgtfx2console-0.4.18.dist-info/entry_points.txt +4 -0
- jgtfx2console-0.4.4.dist-info/entry_points.txt +0 -2
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.18.dist-info}/LICENSE +0 -0
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.18.dist-info}/top_level.txt +0 -0
jgtfx2console/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2024 Jean Guillaume Isabelle
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -42,6 +42,6 @@ with warnings.catch_warnings():
|
|
42
42
|
# your code here
|
43
43
|
|
44
44
|
|
45
|
-
__version__ = "0.4.
|
45
|
+
__version__ = "0.4.18"
|
46
46
|
|
47
47
|
|
jgtfx2console/fxcli2console.py
CHANGED
@@ -43,7 +43,7 @@ connection = os.getenv('connection')
|
|
43
43
|
quotes_count = os.getenv('quotes_count')
|
44
44
|
|
45
45
|
#from jgtpy import jgtcommon as jgtcomm,iprops
|
46
|
-
from jgtutils import jgtcommon as jgtcomm,iprops
|
46
|
+
from jgtutils import jgtcommon as jgtcomm,iprops,jgtconstants as c
|
47
47
|
|
48
48
|
##import jgtcommon as jgtcomm,iprops
|
49
49
|
|
@@ -63,6 +63,7 @@ def parse_args():
|
|
63
63
|
jgtcomm.add_tlid_range_argument(parser)
|
64
64
|
#jgtcomm.add_date_arguments(parser)
|
65
65
|
jgtcomm.add_max_bars_arguments(parser)
|
66
|
+
jgtcomm.add_keepbidask_argument(parser)
|
66
67
|
args = parser.parse_args()
|
67
68
|
return args
|
68
69
|
|
@@ -72,6 +73,13 @@ def main():
|
|
72
73
|
str_user_id = user_id#args.l
|
73
74
|
str_password = password#args.p
|
74
75
|
str_url = url#args.u
|
76
|
+
|
77
|
+
keep_bid_ask = args.keepbidask
|
78
|
+
|
79
|
+
#env variable bypass if env exist JGT_KEEP_BID_ASK=1, keep_bid_ask = True
|
80
|
+
if os.getenv("JGT_KEEP_BID_ASK","0") == "1":
|
81
|
+
keep_bid_ask = True
|
82
|
+
|
75
83
|
using_tlid = False
|
76
84
|
if args.tlidrange is not None:
|
77
85
|
using_tlid= True
|
@@ -120,10 +128,15 @@ def main():
|
|
120
128
|
print("{0:s}, {1:,.5f}, {2:,.5f}".format(
|
121
129
|
pd.to_datetime(str(row['Date'])).strftime(date_format), row['Bid'], row['Ask']))
|
122
130
|
else:
|
123
|
-
|
131
|
+
csv_header_OHLC = "Date,Open,High,Low,Close,Median,Volume"
|
132
|
+
csv_header_OHLCBIDASK="Date,BidOpen,BidHigh,BidLow,BidClose,AskOpen,AskHigh,AskLow,AskClose,Volume,Open,High,Low,Close,Median"
|
133
|
+
csv_header=csv_header_OHLC
|
134
|
+
if keep_bid_ask:
|
135
|
+
csv_header=csv_header_OHLCBIDASK
|
136
|
+
print(csv_header)
|
124
137
|
rounder = lpip+1
|
125
138
|
for row in history:
|
126
|
-
print(format_output(rounder,row,rounder,date_format))
|
139
|
+
print(format_output(rounder,row,rounder,date_format,keep_bid_ask=keep_bid_ask))
|
127
140
|
|
128
141
|
# print("{0:s},{1:.5f},{2:.5f},{3:.5f},{4:.5f},{5:.5f},{6:d}".format(
|
129
142
|
# pd.to_datetime(str(row['Date'])).strftime(date_format), open_price, high_price,
|
@@ -135,15 +148,20 @@ def main():
|
|
135
148
|
except Exception as e:
|
136
149
|
jgtcomm.print_exception(e)
|
137
150
|
|
138
|
-
def format_output(nb_decimal, row, rounder, date_format = '%Y-%m-%d %H:%M:%S'):
|
139
|
-
open_price = round(((row[
|
140
|
-
high_price = round(((row[
|
141
|
-
low_price = round(((row[
|
142
|
-
close_price = round(((row[
|
151
|
+
def format_output(nb_decimal, row, rounder, date_format = '%Y-%m-%d %H:%M:%S',keep_bid_ask=False):
|
152
|
+
open_price = round(((row[c.BIDOPEN] + row[c.ASKOPEN]) / 2), rounder)
|
153
|
+
high_price = round(((row[c.BIDHIGH] + row[c.ASKHIGH]) / 2), rounder)
|
154
|
+
low_price = round(((row[c.BIDLOW] + row[c.ASKLOW]) / 2), rounder)
|
155
|
+
close_price = round(((row[c.BIDCLOSE] + row[c.ASKCLOSE]) / 2), rounder)
|
143
156
|
median = round(((high_price + low_price) / 2), rounder)
|
144
|
-
dt_formatted=pd.to_datetime(str(row[
|
157
|
+
dt_formatted=pd.to_datetime(str(row[c.DATE])).strftime(date_format)
|
145
158
|
#print("dt formatted: " + dt_formatted)
|
146
|
-
|
159
|
+
#if keep_bid_ask:Date,BidOpen,BidHigh,BidLow,BidClose,AskOpen,AskHigh,AskLow,AskClose,Volume,Open,High,Low,Close,Median
|
160
|
+
if keep_bid_ask:
|
161
|
+
formatted_string = f"{dt_formatted},{row[c.BIDOPEN]:.{nb_decimal}f},{row[c.BIDHIGH]:.{nb_decimal}f},{row[c.BIDLOW]:.{nb_decimal}f},{row[c.BIDCLOSE]:.{nb_decimal}f},{row[c.ASKOPEN]:.{nb_decimal}f},{row[c.ASKHIGH]:.{nb_decimal}f},{row[c.ASKLOW]:.{nb_decimal}f},{row[c.ASKCLOSE]:.{nb_decimal}f},{row[c.VOLUME]:d},{open_price:.{nb_decimal}f},{high_price:.{nb_decimal}f},{low_price:.{nb_decimal}f},{close_price:.{nb_decimal}f},{median:.{nb_decimal}f}"
|
162
|
+
else:
|
163
|
+
formatted_string = f"{dt_formatted},{open_price:.{nb_decimal}f},{high_price:.{nb_decimal}f},{low_price:.{nb_decimal}f},{close_price:.{nb_decimal}f},{median:.{nb_decimal}f},{row['Volume']:d}"
|
164
|
+
|
147
165
|
return formatted_string
|
148
166
|
|
149
167
|
def format_output1(nb_decimal, row, rounder,date_format = '%Y-%m-%d %H:%M:%S'):
|
@@ -1,14 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jgtfx2console
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.18
|
4
4
|
Summary: PDS Services
|
5
5
|
Home-page: https://github.com/jgwill/jgtfx2console
|
6
6
|
Author: GUillaume Isabelle
|
7
7
|
Author-email: Guillaume Isabelle <jgi@jgwill.com>
|
8
|
-
License: MIT
|
9
8
|
Project-URL: Homepage, https://github.com/jgwill/jgtfx2console
|
10
9
|
Project-URL: Bug Tracker, https://github.com/jgwill/jgtfx2console/issues
|
11
|
-
Keywords: data
|
12
10
|
Classifier: Programming Language :: Python :: 3
|
13
11
|
Classifier: License :: OSI Approved :: MIT License
|
14
12
|
Classifier: Operating System :: OS Independent
|
@@ -17,9 +15,8 @@ Description-Content-Type: text/markdown
|
|
17
15
|
License-File: LICENSE
|
18
16
|
Requires-Dist: pandas >=0.25.1
|
19
17
|
Requires-Dist: python-dotenv >=0.19.2
|
20
|
-
Requires-Dist: jgtutils >=0.1.
|
18
|
+
Requires-Dist: jgtutils >=0.1.67
|
21
19
|
Requires-Dist: tlid
|
22
|
-
Requires-Dist: flask
|
23
20
|
Provides-Extra: dev
|
24
21
|
Requires-Dist: flake8 <3.7.0,>=3.6.0 ; extra == 'dev'
|
25
22
|
Requires-Dist: isort <4.4.0,>=4.3.4 ; extra == 'dev'
|
@@ -1,5 +1,5 @@
|
|
1
|
-
jgtfx2console/__init__.py,sha256=
|
2
|
-
jgtfx2console/fxcli2console.py,sha256=
|
1
|
+
jgtfx2console/__init__.py,sha256=gLRIp4eun6sv2jZAb1GdWFEcjyskG_Vj8kEKT1j05LE,1611
|
2
|
+
jgtfx2console/fxcli2console.py,sha256=oI4d01jkXNriP2tF8aHcdep_r2YORWMfSnysrIHEAqQ,7426
|
3
3
|
jgtfx2console/forexconnect/EachRowListener.py,sha256=jbRaSqhHtoaRnEnLGoUmVLvE6VPt-WXYtglRPzK440k,1649
|
4
4
|
jgtfx2console/forexconnect/ForexConnect.py,sha256=Yf6AcLdgMSD8rd1s2DTIJPfzJ7BljIaZy_8vTfPfSOI,25755
|
5
5
|
jgtfx2console/forexconnect/LiveHistory.py,sha256=saGkZ8ZUWRclcusG1vg12H4flpQWXKIMXCdQ5qM5cOo,9925
|
@@ -29,9 +29,9 @@ jgtfx2console/forexconnect/lib/linux/libpython3.7m.so,sha256=UQzwU5QcaVnwQdt2yXi
|
|
29
29
|
jgtfx2console/forexconnect/lib/linux/libquotesmgr2.so.2.8,sha256=QIUMvjI-4m3YX3N23Pad9TIhYbmk17raTTW0gyrElkM,1245248
|
30
30
|
jgtfx2console/forexconnect/lib/linux/libsqlite3.8.so,sha256=aqjV6ZcluDkzyr_bbWQCOHt9uitLvp7uPS-53Z3toQk,641120
|
31
31
|
jgtfx2console/forexconnect/lib/linux/requirements.txt,sha256=62zntle4oq_jlsvrAK1bbfgYvAcRPtVHkGYu_eWiRZs,77
|
32
|
-
jgtfx2console-0.4.
|
33
|
-
jgtfx2console-0.4.
|
34
|
-
jgtfx2console-0.4.
|
35
|
-
jgtfx2console-0.4.
|
36
|
-
jgtfx2console-0.4.
|
37
|
-
jgtfx2console-0.4.
|
32
|
+
jgtfx2console-0.4.18.dist-info/LICENSE,sha256=uCA_HysYVK9qIMbDEFjcDYhCoKTg19AJhKhM71EKSGA,1086
|
33
|
+
jgtfx2console-0.4.18.dist-info/METADATA,sha256=wSNoTiw96DKeJ5jGenY3YYdLAXsYUHAtNMWiyOh8Z-M,2201
|
34
|
+
jgtfx2console-0.4.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
35
|
+
jgtfx2console-0.4.18.dist-info/entry_points.txt,sha256=106nHc20KZoWp66igjWdPN6Z9iGv3hBzSGNTbLVSn6Y,187
|
36
|
+
jgtfx2console-0.4.18.dist-info/top_level.txt,sha256=PBNCBgqX42I7ctUTX9FcTnIX0utvgRqzuflefzZ30D8,14
|
37
|
+
jgtfx2console-0.4.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|