Skip to content

Commit 3346d13

Browse files
committed
Merge remote-tracking branch 'origin/master' into prod
# Conflicts: # src/systemathics/apis/services/corporate_actions/v1/changes.proto # src/systemathics/apis/services/corporate_actions/v1/dividends.proto # src/systemathics/apis/services/corporate_actions/v1/splits.proto # src/systemathics/apis/services/daily/v1/daily_bars.proto # src/systemathics/apis/services/daily/v1/daily_prices.proto # src/systemathics/apis/services/daily/v1/daily_vwap.proto # src/systemathics/apis/services/daily_analytics/v1/daily_bollinger.proto # src/systemathics/apis/services/daily_analytics/v1/daily_cma.proto # src/systemathics/apis/services/daily_analytics/v1/daily_ema.proto # src/systemathics/apis/services/daily_analytics/v1/daily_macd.proto # src/systemathics/apis/services/daily_analytics/v1/daily_rsi.proto # src/systemathics/apis/services/daily_analytics/v1/daily_sma.proto # src/systemathics/apis/services/daily_analytics/v1/daily_volatility.proto # src/systemathics/apis/services/intraday/v1/intraday_bars.proto # src/systemathics/apis/services/intraday/v1/intraday_prices.proto # src/systemathics/apis/services/intraday/v1/intraday_vwap.proto # src/systemathics/apis/services/static_data/v1/static_data.proto # src/systemathics/apis/services/tick/v1/tick_book.proto # src/systemathics/apis/services/tick/v1/tick_quotes.proto # src/systemathics/apis/services/tick/v1/tick_raw.proto # src/systemathics/apis/services/tick/v1/tick_trades.proto # src/systemathics/apis/services/tick/v1/tick_trades_and_book.proto # src/systemathics/apis/services/tick/v1/tick_updates.proto # src/systemathics/apis/services/tick_analytics/v1/tick_trade_condition_statistics.proto # src/systemathics/apis/services/tick_conditions/v1/tick_conditions.proto # src/systemathics/apis/type/shared/v1/book.proto # src/systemathics/apis/type/shared/v1/book_data.proto # src/systemathics/apis/type/shared/v1/book_updates.proto # src/systemathics/apis/type/shared/v1/condition.proto # src/systemathics/apis/type/shared/v1/field.proto # src/systemathics/apis/type/shared/v1/identifier_and_level.proto # src/systemathics/apis/type/shared/v1/keys.proto # src/systemathics/apis/type/shared/v1/limit.proto # src/systemathics/apis/type/shared/v1/market_fields_updates.proto # src/systemathics/apis/type/shared/v1/mbl_market_book_updates.proto # src/systemathics/apis/type/shared/v1/mbo_market_book_updates.proto # src/systemathics/apis/type/shared/v1/quote.proto # src/systemathics/apis/type/shared/v1/quotes_data.proto # src/systemathics/apis/type/shared/v1/raw.proto # src/systemathics/apis/type/shared/v1/trade.proto # src/systemathics/apis/type/shared/v1/trade_and_book_data.proto # src/systemathics/apis/type/shared/v1/trade_data.proto
2 parents c35b352 + 909166f commit 3346d13

86 files changed

Lines changed: 176 additions & 5691 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
name: Upload Python Package
2-
3-
on:
4-
push:
5-
tags: v*
6-
7-
jobs:
8-
deploy:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v2
12-
- name: Set up Python
13-
uses: actions/setup-python@v2
14-
with:
15-
python-version: '3.x'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine grpcio grpcio-tools protobuf
20-
- name: Set VERSION environment variable
21-
run: |
22-
echo GitHub_ref: $GITHUB_REF
23-
arrTag=(${GITHUB_REF//\// })
24-
VERSION="${arrTag[2]}"
25-
echo Version: $VERSION
26-
VERSION="${VERSION//v}"
27-
echo Clean Version: $VERSION
28-
echo "VERSION=${VERSION}" >> $GITHUB_ENV
29-
- name: Build and publish
30-
env:
31-
TWINE_USERNAME: "__token__"
32-
TWINE_PASSWORD: ${{ secrets.PYPI_ORG_TOKEN }}
33-
run: |
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
tags: v*
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade build
19+
python -m pip install --upgrade twine
20+
- name: Set VERSION environment variable
21+
run: |
22+
echo GitHub_ref: $GITHUB_REF
23+
arrTag=(${GITHUB_REF//\// })
24+
VERSION="${arrTag[2]}"
25+
echo Version: $VERSION
26+
VERSION="${VERSION//v}"
27+
echo Clean Version: $VERSION
28+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
29+
- name: Build and publish
30+
env:
31+
TWINE_USERNAME: "__token__"
32+
TWINE_PASSWORD: ${{ secrets.PYPI_ORG_TOKEN }}
33+
run: |
3434
python ./build.py

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/bin
2-
/lib
3-
/pyvenv.cfg
4-
/python/dist
5-
/python/systemathics.apis.egg-info
1+
/bin
2+
/lib
3+
/pyvenv.cfg
4+
/python/dist
5+
/python/systemathics.apis.egg-info

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# About Ganymede
2+
3+
Built as cloud native, Ganymede is a fully managed platform, continuously updated with high-quality, curated,
4+
and cross validated data. Ganymede is purpose built for the financial data markets ever increasing data volumes,
5+
allowing clients to query against large data sets, including tick-by-tick, sampled, daily, corporate actions,
6+
ESG and reference data. Packed with a broad range of analytics, the solution is optimized for fast response times,
7+
supports full order book natively and allows fine grained/customizable trade and quote conditions mapping and filtering.
8+
9+
For further information, please visit [Ganymede home page](https://ganymede.cloud)
10+
11+
# About this project
12+
13+
This project provides up-to-date gRPC clients to access [Ganymede API](https://ganymede.cloud/api-documentation.html)
14+
15+
Latest Python package
16+
17+
[![PyPI version](https://badge.fury.io/py/systemathics.apis.svg)](https://badge.fury.io/py/systemathics.apis)
18+
19+
# About us
20+
21+
[Systemathics](https://systemathics.com) is a French fintech founded in 2008 developing its innovative products with the highest quality standards 100% in France.
22+
Our main mission is to provide global investors with a complete end-to-end solution to systematize alpha generation in a robust way.
23+
From data pre and post trade analysis, back-testing, risk assessment and signal generation to day-to-day execution in production and everything in between.

buf.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

build.py

Lines changed: 11 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#!/usr/bin/python
22

33
import os
4-
from pickle import FALSE
54
import subprocess
6-
import shutil
7-
8-
def create_dir_if_needed(dir):
9-
if(not(os.path.isdir(dir))):
10-
os.makedirs(dir)
115

126
def delete_dir_if_needed(top_dir):
137
if(os.path.isdir(top_dir)):
@@ -18,112 +12,20 @@ def delete_dir_if_needed(top_dir):
1812
os.rmdir(os.path.join(root, dir))
1913
os.rmdir(top_dir)
2014

21-
def is_grpc_file (path):
22-
"""Test if a *.proto file describe a grpc service"""
23-
for line in open(path, 'r').readlines() :
24-
if line.startswith('service ') :
25-
return True
26-
return False
27-
28-
def create_files_tuples(dir):
29-
"""Create the lists of files from `dir` and ventilate them in 3 categories :
30-
- grpc files (containing a grpc service)
31-
- proto files (without a grpc service)
32-
- python files
33-
34-
Returns a tuple with 3 lists.
35-
First list contains grpc files.
36-
Second list contains regular proto files
37-
Third list contains python files
38-
"""
39-
grpc_files = []
40-
proto_files = []
41-
python_files = []
42-
print(f"create_files_tuples(dir={dir})")
43-
for root, dirs, files in os.walk(dir, topdown=True):
44-
# skip google folder
45-
if 'google' in dirs:
46-
dirs.remove('google')
47-
for file in files:
48-
path = os.path.join(root, file)
49-
if (file.endswith('.proto')) :
50-
if(is_grpc_file(path)) :
51-
print(f"grpc: {path}")
52-
grpc_files.append(path)
53-
else:
54-
proto_files.append(path)
55-
print(f"proto: {path}")
56-
if (file.endswith('.py')) :
57-
print(f"python: {path}")
58-
python_files.append(path)
59-
60-
return (grpc_files,proto_files,python_files)
61-
62-
def generate_grpc_file(files, scr_dir, target_dir):
63-
create_dir_if_needed(target_dir)
64-
all_files= " ".join(files)
65-
cmd = f"python3 -m grpc_tools.protoc --proto_path={scr_dir} --python_out={target_dir} --grpc_python_out={target_dir} {all_files}"
66-
print(cmd)
67-
subprocess.call(cmd, cwd=scr_dir, shell=True)
68-
69-
def generate_proto_file(files, scr_dir, target_dir):
70-
all_files= " ".join(files)
71-
create_dir_if_needed(target_dir)
72-
cmd = f"python3 -m grpc_tools.protoc --proto_path={scr_dir} --python_out={target_dir} {all_files}"
73-
print(cmd)
74-
subprocess.call(cmd, cwd=scr_dir, shell=True)
75-
76-
def copy_python_sources(files, src_dir, target_dir):
77-
create_dir_if_needed(target_dir)
78-
for file in files:
79-
file2 = file.replace(src_dir, target_dir)
80-
folder2=os.path.dirname(file2)
81-
create_dir_if_needed(folder2)
82-
print(f"Copying \n {file} to \n {file2}")
83-
shutil.copy(file, file2)
84-
85-
def generate(tuple_of_list, src_dir, target_dir):
86-
grpc_files = tuple_of_list[0]
87-
proto_files = tuple_of_list[1]
88-
python_files = tuple_of_list[2]
89-
90-
copy_python_sources(python_files, src_dir, target_dir)
91-
generate_grpc_file(grpc_files, src_dir, target_dir)
92-
generate_proto_file(proto_files, src_dir, target_dir)
93-
94-
def add_namespace_import_to_init_py(dir):
95-
for root, _, _ in os.walk(dir, topdown=True):
96-
path = os.path.join(root,'__init__.py')
97-
with open(path, 'w') as f:
98-
f.write("__import__('pkg_resources').declare_namespace(__name__)")
99-
100-
def extract_version(data):
101-
version_pattern ='version="'
102-
l = len(version_pattern)
103-
start = data.find('version="')
104-
end = data.find('"', start + l + 1)
105-
return data[start + l : end]
106-
107-
def replace_version_in_setup(dir):
15+
def update_version(dir):
10816
# Read in the file
109-
path = os.path.join(dir,'setup.py')
110-
with open(path, 'r') as file :
111-
filedata = file.read()
112-
113-
old_version = extract_version(filedata)
17+
path = os.path.join(dir,'__init__.py')
11418

115-
# Check is done before taht this env variable exists
19+
# Check is done before that this env variable exists
11620
new_version = os.getenv('VERSION', "")
117-
118-
# Replace the target string
119-
filedata = filedata.replace(old_version, new_version)
21+
print(f"__version__ = \"{new_version}\"")
12022

12123
# Write the file out again
12224
with open(path, 'w') as file:
123-
file.write(filedata)
25+
file.write(f"__version__ = \"{new_version}\"")
12426

12527
def generate_package(root_dir):
126-
cmd = "python3 setup.py sdist"
28+
cmd = "python3 -m build"
12729
subprocess.call(cmd, cwd=root_dir, shell=True)
12830

12931
def check_environement():
@@ -145,55 +47,6 @@ def check_environement():
14547
raise Exception("missing env var TWINE_PASSWORD")
14648
password = ''
14749

148-
# # used by publish_package function
149-
# key = os.getenv('PYPI_PUBLISH_INDIRECT_KEY','')
150-
# if(key == ''):
151-
# raise Exception("missing env var PYPI_PUBLISH_INDIRECT_KEY")
152-
153-
# # used by publish_package function
154-
# user = os.getenv('PYPI_USERNAME','')
155-
# if(user == ''):
156-
# raise Exception("missing env var PYPI_USERNAME")
157-
158-
# # used by publish_package function
159-
# repository = os.getenv('PYPI_REPOSITORY','')
160-
# if(repository == ''):
161-
# raise Exception("missing env var PYPI_REPOSITORY")
162-
163-
def publish_test_package(root_dir):
164-
# pass_out generated with
165-
# > echo -n ${{PASSWORD}} > ./pass
166-
# > openssl aes-256-cbc -pbkdf2 -e -k "${{PYPI_PUBLISH_INDIRECT_KEY}}" < ./pass > ./pass_out
167-
168-
# used by publish_package function
169-
key = os.getenv('PYPI_PUBLISH_INDIRECT_KEY','')
170-
if(key == ''):
171-
raise Exception("missing env var PYPI_PUBLISH_INDIRECT_KEY")
172-
173-
# used by publish_package function
174-
user = os.getenv('PYPI_USERNAME','')
175-
if(user == ''):
176-
raise Exception("missing env var PYPI_USERNAME")
177-
178-
# used by publish_package function
179-
repository = os.getenv('PYPI_REPOSITORY','')
180-
if(repository == ''):
181-
raise Exception("missing env var PYPI_REPOSITORY")
182-
183-
# convert password, as strange chars are not always accepted in env var...
184-
path = os.path.join(root_dir, "pass")
185-
path_out = os.path.join(root_dir, "..", "pass_out")
186-
openssl_cmd = f'openssl aes-256-cbc -pbkdf2 -d -k "{key}" < {path_out} > {path}'
187-
subprocess.call(openssl_cmd, cwd=root_dir, shell=True)
188-
189-
with open(path, 'r') as f:
190-
password = f.read()
191-
192-
cmd = f"python3 -m twine upload --repository {repository} dist/* -u {user} -p '{password}'"
193-
194-
os.remove(path)
195-
subprocess.call(cmd, cwd=root_dir, shell=True)
196-
19750
def publish_package(root_dir):
19851
# used by publish_package function
19952
cmd = f"python3 -m twine upload dist/*"
@@ -208,36 +61,21 @@ def main():
20861
# define vars
20962
root = os.path.dirname(os.path.realpath(__file__))
21063
src_dir = os.path.join(root, "src")
211-
out_dir = os.path.join(root, "python")
212-
stx_dir = os.path.join(out_dir, "systemathics")
213-
dist_dir = os.path.join(out_dir, "dist")
64+
stx_dir = os.path.join(src_dir, "systemathics","apis")
65+
dist_dir = os.path.join(src_dir, "dist")
21466

21567
print("Clean old generated code")
216-
create_dir_if_needed(out_dir)
217-
delete_dir_if_needed(stx_dir)
21868
delete_dir_if_needed(dist_dir)
21969

220-
# get proto files (grpc and regular)
221-
print("Get files")
222-
result = create_files_tuples(src_dir)
223-
224-
# generate new python file from proto
225-
print("Generate")
226-
generate(result, src_dir, out_dir)
227-
228-
# add proto import to __init__.py files
229-
print("Add namespace import to __init__.py files")
230-
add_namespace_import_to_init_py(stx_dir)
231-
23270
# generate package
23371
print("Setting version in setup.py")
234-
replace_version_in_setup(out_dir)
72+
update_version(stx_dir)
23573
print("Generate package")
236-
generate_package(out_dir)
74+
generate_package(src_dir)
23775

23876
# publish package
23977
print("Publish package")
240-
publish_package(out_dir)
78+
publish_package(src_dir)
24179

24280
if __name__ == "__main__":
24381
# execute only if run as a script

pass_out

Lines changed: 0 additions & 1 deletion
This file was deleted.

python/setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

python/setup.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)