jgtfx2console 0.4.4__py3-none-any.whl → 0.4.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jgtfx2console/__init__.py +2 -2
- jgtfx2console/fxcli2console.py +30 -10
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.dist-info}/METADATA +2 -2
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.dist-info}/RECORD +8 -8
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.dist-info}/LICENSE +0 -0
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.dist-info}/WHEEL +0 -0
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.dist-info}/entry_points.txt +0 -0
- {jgtfx2console-0.4.4.dist-info → jgtfx2console-0.4.11.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.11"
|
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,15 @@ 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
|
+
# Do we have keep_bid_ask set to true?
|
80
|
+
config = jgtcomm.readconfig()
|
81
|
+
#env variable bypass if env exist JGT_KEEP_BID_ASK=1, keep_bid_ask = True
|
82
|
+
if os.getenv("JGT_KEEP_BID_ASK","0") == "1":
|
83
|
+
keep_bid_ask = True
|
84
|
+
|
75
85
|
using_tlid = False
|
76
86
|
if args.tlidrange is not None:
|
77
87
|
using_tlid= True
|
@@ -120,10 +130,15 @@ def main():
|
|
120
130
|
print("{0:s}, {1:,.5f}, {2:,.5f}".format(
|
121
131
|
pd.to_datetime(str(row['Date'])).strftime(date_format), row['Bid'], row['Ask']))
|
122
132
|
else:
|
123
|
-
|
133
|
+
csv_header_OHLC = "Date,Open,High,Low,Close,Median,Volume"
|
134
|
+
csv_header_OHLCBIDASK="Date,BidOpen,BidHigh,BidLow,BidClose,AskOpen,AskHigh,AskLow,AskClose,Volume,Open,High,Low,Close,Median"
|
135
|
+
csv_header=csv_header_OHLC
|
136
|
+
if keep_bid_ask:
|
137
|
+
csv_header=csv_header_OHLCBIDASK
|
138
|
+
print(csv_header)
|
124
139
|
rounder = lpip+1
|
125
140
|
for row in history:
|
126
|
-
print(format_output(rounder,row,rounder,date_format))
|
141
|
+
print(format_output(rounder,row,rounder,date_format,keep_bid_ask=keep_bid_ask))
|
127
142
|
|
128
143
|
# print("{0:s},{1:.5f},{2:.5f},{3:.5f},{4:.5f},{5:.5f},{6:d}".format(
|
129
144
|
# pd.to_datetime(str(row['Date'])).strftime(date_format), open_price, high_price,
|
@@ -135,15 +150,20 @@ def main():
|
|
135
150
|
except Exception as e:
|
136
151
|
jgtcomm.print_exception(e)
|
137
152
|
|
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[
|
153
|
+
def format_output(nb_decimal, row, rounder, date_format = '%Y-%m-%d %H:%M:%S',keep_bid_ask=False):
|
154
|
+
open_price = round(((row[c.BIDOPEN] + row[c.ASKOPEN]) / 2), rounder)
|
155
|
+
high_price = round(((row[c.BIDHIGH] + row[c.ASKHIGH]) / 2), rounder)
|
156
|
+
low_price = round(((row[c.BIDLOW] + row[c.ASKLOW]) / 2), rounder)
|
157
|
+
close_price = round(((row[c.BIDCLOSE] + row[c.ASKCLOSE]) / 2), rounder)
|
143
158
|
median = round(((high_price + low_price) / 2), rounder)
|
144
|
-
dt_formatted=pd.to_datetime(str(row[
|
159
|
+
dt_formatted=pd.to_datetime(str(row[c.DATE])).strftime(date_format)
|
145
160
|
#print("dt formatted: " + dt_formatted)
|
146
|
-
|
161
|
+
#if keep_bid_ask:Date,BidOpen,BidHigh,BidLow,BidClose,AskOpen,AskHigh,AskLow,AskClose,Volume,Open,High,Low,Close,Median
|
162
|
+
if keep_bid_ask:
|
163
|
+
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}"
|
164
|
+
else:
|
165
|
+
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}"
|
166
|
+
|
147
167
|
return formatted_string
|
148
168
|
|
149
169
|
def format_output1(nb_decimal, row, rounder,date_format = '%Y-%m-%d %H:%M:%S'):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jgtfx2console
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.11
|
4
4
|
Summary: PDS Services
|
5
5
|
Home-page: https://github.com/jgwill/jgtfx2console
|
6
6
|
Author: GUillaume Isabelle
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
18
18
|
Requires-Dist: pandas >=0.25.1
|
19
19
|
Requires-Dist: python-dotenv >=0.19.2
|
20
|
-
Requires-Dist: jgtutils >=0.1.
|
20
|
+
Requires-Dist: jgtutils >=0.1.58
|
21
21
|
Requires-Dist: tlid
|
22
22
|
Requires-Dist: flask
|
23
23
|
Provides-Extra: dev
|
@@ -1,5 +1,5 @@
|
|
1
|
-
jgtfx2console/__init__.py,sha256=
|
2
|
-
jgtfx2console/fxcli2console.py,sha256=
|
1
|
+
jgtfx2console/__init__.py,sha256=wFmXCnNb_4KRs5g1bdCrmtW53wI7baYO7OU-WLm2CFY,1611
|
2
|
+
jgtfx2console/fxcli2console.py,sha256=FoSSrfNoU9trLgg-sFFqob7uaQdGhEeReqi5lXHscqk,7503
|
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.11.dist-info/LICENSE,sha256=uCA_HysYVK9qIMbDEFjcDYhCoKTg19AJhKhM71EKSGA,1086
|
33
|
+
jgtfx2console-0.4.11.dist-info/METADATA,sha256=2K5VpMahi7QteEVR35BOBUeSegi63iUsZtNd7IM23J8,2250
|
34
|
+
jgtfx2console-0.4.11.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
35
|
+
jgtfx2console-0.4.11.dist-info/entry_points.txt,sha256=Jm1hD4oYLEKFNd6w7Ky7saQnSZGgbh6IEI7rpqCuMVs,67
|
36
|
+
jgtfx2console-0.4.11.dist-info/top_level.txt,sha256=PBNCBgqX42I7ctUTX9FcTnIX0utvgRqzuflefzZ30D8,14
|
37
|
+
jgtfx2console-0.4.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|