From 7ca655e9e56ec050bb4801bf1361473fd44954d4 Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Sat, 6 Aug 2022 18:25:52 +0200 Subject: [PATCH 1/4] my very own first additions for ubuntu jammy compatibility --- .gitignore | 5 +++++ Makefile | 4 ++++ src/account/summary.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1d46a0d..dc7aa09 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,8 @@ env-python2/ build/ *.sw* *.egg-info + + +# PB + +.idea/ diff --git a/Makefile b/Makefile index 9ecc6be..5b66e44 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,12 @@ bootstrap: bootstrap-python3 bootstrap-python3: virtualenv -p python3 env env/bin/pip install -r requirements/base.txt + echo "python version on ubuntu 22 will be 3.10. We need to upgrade something..." + sed -i 's/if\ python_version_tuple/if True or python_version_tuple/g' env/lib/python3.10/site-packages/tabulate.py bootstrap-python2: virtualenv env-python2 + echo "we don't do that here" + exit 1 env-python2/bin/pip install -r requirements/base.txt diff --git a/src/account/summary.py b/src/account/summary.py index f180998..1a01eaa 100755 --- a/src/account/summary.py +++ b/src/account/summary.py @@ -2,7 +2,7 @@ import argparse import common.config -from .account import Account +from account import Account def main(): From 4df178a3f50748b073ffb0fb717c067ebfd9ed54 Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Sat, 6 Aug 2022 19:50:55 +0200 Subject: [PATCH 2/4] we found a more correct way to solve our issue --- Makefile | 5 ----- requirements/base.txt | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5b66e44..cce361a 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,7 @@ bootstrap: bootstrap-python3 bootstrap-python3: virtualenv -p python3 env env/bin/pip install -r requirements/base.txt - echo "python version on ubuntu 22 will be 3.10. We need to upgrade something..." - sed -i 's/if\ python_version_tuple/if True or python_version_tuple/g' env/lib/python3.10/site-packages/tabulate.py bootstrap-python2: virtualenv env-python2 - echo "we don't do that here" - exit 1 env-python2/bin/pip install -r requirements/base.txt - diff --git a/requirements/base.txt b/requirements/base.txt index 06c7777..c162866 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ pyyaml==5.3.1 -tabulate==0.8.7 +tabulate==0.8.10 requests==2.25.0 ujson==4.0.1 v20==3.0.25.0 From f2015dc6b1d183eb757c506b5e23fa65af9f209f Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Sat, 6 Aug 2022 19:53:19 +0200 Subject: [PATCH 3/4] updated tabulate requirement because of issues with python_version_tuple, solved by newer version_info. Environment: python 3.10, ubuntu jammy --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index 06c7777..c162866 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ pyyaml==5.3.1 -tabulate==0.8.7 +tabulate==0.8.10 requests==2.25.0 ujson==4.0.1 v20==3.0.25.0 From 2e3f97a6cb1067a036be81c386257314b83bff8a Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Tue, 16 Aug 2022 21:38:20 +0200 Subject: [PATCH 4/4] minor edits on non-typed checks --- .gitignore | 1 + src/account/instruments.py | 3 ++- src/pricing/stream.py | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dc7aa09..da767e2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ build/ # PB .idea/ +cmake*/ diff --git a/src/account/instruments.py b/src/account/instruments.py index 2a8f82f..f9cf5f8 100755 --- a/src/account/instruments.py +++ b/src/account/instruments.py @@ -3,6 +3,7 @@ import argparse import common.config import common.view +import v20 def main(): @@ -35,7 +36,7 @@ def main(): # # Fetch the tradeable instruments for the Account found in the config file # - response = api.account.instruments(account_id) + response: v20.response.Response = api.account.instruments(account_id) # # Extract the list of Instruments from the response. diff --git a/src/pricing/stream.py b/src/pricing/stream.py index e1170f9..b7a2f8f 100755 --- a/src/pricing/stream.py +++ b/src/pricing/stream.py @@ -67,10 +67,12 @@ def main(): # Print out each price as it is received # for msg_type, msg in response.parts(): - if msg_type == "pricing.Heartbeat" and args.show_heartbeats: + if msg_type == "pricing.PricingHeartbeat" and args.show_heartbeats: print(heartbeat_to_string(msg)) - elif msg_type == "pricing.Price": + elif msg_type == "pricing.ClientPrice": print(price_to_string(msg)) + else: + print(f'type {msg_type}, msg {msg}') if __name__ == "__main__":