Skip to content

Commit 7980b55

Browse files
authored
Merge branch 'master' into feature/gmePO-extraction-fix
2 parents 29d0f58 + 4e43ac6 commit 7980b55

File tree

9 files changed

+272
-78
lines changed

9 files changed

+272
-78
lines changed

.github/workflows/python-tests.yml

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,89 @@
11
# This workflow will install Python dependencies, run tests and lint with a single version of Python
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Artesian SDK Python
4+
name: Artesian SDK Python
55

66
on:
77
push:
8-
branches: [ master ]
9-
tags:
10-
- 'v[0-9]+\.[0-9]+\.[0-9]+'
8+
branches: [master]
9+
tags:
10+
- 'v[0-9]+\.[0-9]+\.[0-9]+'
1111
pull_request:
12-
branches: [ master ]
12+
branches: [master]
1313

1414
jobs:
1515
build:
16-
1716
runs-on: ${{ matrix.os }}
18-
17+
1918
strategy:
2019
matrix:
21-
python-version: ['3.8', '3.9', '3.10', '3.11']
22-
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
20+
python-version: ["3.8", "3.9", "3.10", "3.11"]
21+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
2322

2423
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v2
28-
with:
29-
python-version: ${{ matrix.python-version }}
30-
- name: Install dependencies
31-
run: |
32-
python -m pip install --upgrade pip
33-
pip install -e ".[dev]"
24+
- uses: actions/checkout@v3
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -e ".[dev]"
3433
35-
- name: Run flake8
36-
run: |
37-
flake8 .
34+
- name: Run flake8
35+
run: |
36+
flake8 .
3837
39-
- uses: jordemort/action-pyright@v1
40-
with:
41-
github_token: ${{ secrets.GITHUB_TOKEN }}
42-
reporter: github-check
43-
lib:
44-
level: warning
45-
filter_mode: file
38+
# Execute jordemort/action-pyright only into Ubuntu and macOS.
39+
# windows started to fail for reviewdog not found. issue opened
40+
# https://github.com/jordemort/action-pyright/issues/51
41+
- name: Run Pyright
42+
if: matrix.os != 'windows-latest'
43+
uses: jordemort/action-pyright@v1
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
reporter: github-check
47+
lib:
48+
level: warning
49+
filter_mode: file
4650

47-
- name: Test Pytest
48-
run: |
49-
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
51+
- name: Test Pytest
52+
run: |
53+
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
5054
51-
- name: Upload pytest test results
52-
uses: actions/upload-artifact@v3
53-
with:
54-
name: pytest-results-${{ matrix.python-version }}
55-
path: junit/test-results-${{ matrix.python-version }}.xml
56-
# Use always() to always run this step to publish test results when there are test failures
57-
if: ${{ always() }}
55+
- name: Upload pytest test results
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: pytest-results-${{ matrix.python-version }}
59+
path: junit/test-results-${{ matrix.python-version }}.xml
60+
# Use always() to always run this step to publish test results when there are test failures
61+
if: ${{ always() }}
5862

5963
publish:
6064
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
6165
runs-on: ubuntu-latest
6266
needs: build
6367
env:
64-
python-version: '3.11'
68+
python-version: "3.11"
6569

6670
steps:
67-
- uses: actions/checkout@v3
68-
with:
69-
fetch-depth: 0
70-
- name: Set up Python ${{ env.python-version }}
71-
uses: actions/setup-python@v2
72-
with:
73-
python-version: ${{ env.python-version }}
74-
- name: Install dependencies
75-
run: |
76-
python -m pip install --upgrade pip
77-
python -m pip install build
78-
- name: Build package
79-
run: |
80-
python -m build
81-
- name: Publish package
82-
uses: pypa/gh-action-pypi-publish@release/v1
83-
with:
84-
user: __token__
85-
password: ${{ secrets.PYPI_API_TOKEN }}
86-
87-
71+
- uses: actions/checkout@v3
72+
with:
73+
fetch-depth: 0
74+
- name: Set up Python ${{ env.python-version }}
75+
uses: actions/setup-python@v2
76+
with:
77+
python-version: ${{ env.python-version }}
78+
- name: Install dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
python -m pip install build
82+
- name: Build package
83+
run: |
84+
python -m build
85+
- name: Publish package
86+
uses: pypa/gh-action-pypi-publish@release/v1
87+
with:
88+
user: __token__
89+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,6 @@ auctionRows = MarketData.UpsertData(MarketData.MarketDataIdentifier('PROVIDER',
787787

788788
```
789789

790-
791790
## Delete Data in Artesian
792791

793792
Using the MarketDataService is possible to delete MarketData and its curves.
@@ -808,7 +807,7 @@ mkservice.deleteMarketData(100042422)
808807

809808
```
810809

811-
Depending on the Type of the MarketData, the DeletData should be composed as per example below.
810+
Depending on the Type of the MarketData, the DeletData should be composed as per example below. The timezone is optional: for DateSeries if provided must be equal to MarketData OriginalTimezone Default:MarketData OriginalTimezone. For TimeSeries Default:CET
812811

813812
### Delete Data in an Actual Time Series
814813

samples/TestWriteDataAndDeleteActual.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
print(res)
4747

48-
#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
48+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
4949
deleteData = Artesian.MarketData.DeleteData(
5050
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
5151
timezone="CET",
@@ -66,5 +66,26 @@
6666

6767
print(res)
6868

69-
#Delete the curve completely
69+
70+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
71+
deleteData = Artesian.MarketData.DeleteData(
72+
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
73+
rangeStart=datetime(2020, 1, 1, 6),
74+
rangeEnd=datetime(2020, 1, 1, 18),
75+
)
76+
77+
mkdservice.deleteData(deleteData)
78+
79+
res = (
80+
query.createActual()
81+
.forMarketData([registered.marketDataId])
82+
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
83+
.inTimeZone("CET")
84+
.inGranularity(Granularity.Hour)
85+
.execute()
86+
)
87+
88+
print(res)
89+
90+
# Delete the curve completely
7091
mkdservice.deleteMarketData(registered.marketDataId)

samples/TestWriteDataAndDeleteAuction.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
print(res)
6060

61-
#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
61+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
6262
deleteData = Artesian.MarketData.DeleteData(
6363
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
6464
timezone="CET",
@@ -78,5 +78,24 @@
7878

7979
print(res)
8080

81-
#Delete the curve completely
81+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
82+
deleteData = Artesian.MarketData.DeleteData(
83+
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
84+
rangeStart=datetime(2020, 1, 1, 6),
85+
rangeEnd=datetime(2020, 1, 1, 18),
86+
)
87+
88+
mkdservice.deleteData(deleteData)
89+
90+
res = (
91+
query.createAuction()
92+
.forMarketData([registered.marketDataId])
93+
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
94+
.inTimeZone("CET")
95+
.execute()
96+
)
97+
98+
print(res)
99+
100+
# Delete the curve completely
82101
mkdservice.deleteMarketData(registered.marketDataId)

samples/TestWriteDataAndDeleteBidAsk.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
print(res)
5858

59-
#Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18
59+
# Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18
6060
deleteData = Artesian.MarketData.DeleteData(
6161
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
6262
timezone="CET",
@@ -78,5 +78,26 @@
7878

7979
print(res)
8080

81-
#Delete the curve completely
81+
# Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18 without Timezone
82+
deleteData = Artesian.MarketData.DeleteData(
83+
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
84+
rangeStart=datetime(2020, 1, 1, 6),
85+
rangeEnd=datetime(2020, 1, 1, 18),
86+
product=["Feb-20"]
87+
)
88+
89+
mkdservice.deleteData(deleteData)
90+
91+
res = (
92+
query.createBidAsk()
93+
.forMarketData([registered.marketDataId])
94+
.inAbsoluteDateRange("2020-01-01", "2020-01-31")
95+
.forProducts(["Feb-20", "Mar-20"])
96+
.inTimeZone("CET")
97+
.execute()
98+
)
99+
100+
print(res)
101+
102+
# Delete the curve completely
82103
mkdservice.deleteMarketData(registered.marketDataId)

samples/TestWriteDataAndDeleteMas.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
print(res)
5858

59-
#Delete data with product Feb-20 between 2020-01-01 and 2020-01-03
59+
# Delete data with product Feb-20 between 2020-01-01 and 2020-01-03
6060
deleteData = Artesian.MarketData.DeleteData(
6161
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
6262
timezone="CET",
@@ -78,5 +78,26 @@
7878

7979
print(res)
8080

81-
#Delete the curve completely
81+
# Delete data with product Feb-20 between 2020-01-01 and 2020-01-03 without Timezone
82+
deleteData = Artesian.MarketData.DeleteData(
83+
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
84+
rangeStart=datetime(2020, 1, 1, 0),
85+
rangeEnd=datetime(2020, 1, 3, 0),
86+
product=["Feb-20"]
87+
)
88+
89+
mkdservice.deleteData(deleteData)
90+
91+
res = (
92+
query.createMarketAssessment()
93+
.forMarketData([registered.marketDataId])
94+
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
95+
.forProducts(["Feb-20", "Mar-20"])
96+
.inTimeZone("CET")
97+
.execute()
98+
)
99+
100+
print(res)
101+
102+
# Delete the curve completely
82103
mkdservice.deleteMarketData(registered.marketDataId)

samples/TestWriteDataAndDeleteVersioned.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
print(res)
5252

53-
#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
53+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
5454
deleteData = Artesian.MarketData.DeleteData(
5555
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
5656
timezone="CET",
@@ -73,5 +73,27 @@
7373

7474
print(res)
7575

76-
#Delete the curve completely
76+
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
77+
deleteData = Artesian.MarketData.DeleteData(
78+
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
79+
rangeStart=datetime(2020, 1, 1, 6),
80+
rangeEnd=datetime(2020, 1, 1, 18),
81+
version=testVersion
82+
)
83+
84+
mkdservice.deleteData(deleteData)
85+
86+
res = (
87+
query.createVersioned()
88+
.forMarketData([registered.marketDataId])
89+
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
90+
.inTimeZone("CET")
91+
.inGranularity(Granularity.Hour)
92+
.forVersion("2020-01-01T12:00:00")
93+
.execute()
94+
)
95+
96+
print(res)
97+
98+
# Delete the curve completely
7799
mkdservice.deleteMarketData(registered.marketDataId)

src/Artesian/MarketData/_Dto/DeleteData.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ class DeleteData:
1111
1212
Attributes:
1313
ID: the MarketDataIdentifier
14-
timezone: the Timezone of the rows. Must be the OriginalTimezone
15-
when writing Dates or must be ""UTC"" when writing Times
1614
rangeStart: LocalDateTime start of the range to be deleted
1715
rangeEnd: LocalDateTime end of the range to be deleted
16+
timezone: For DateSeries if provided must be equal to MarketData
17+
OriginalTimezone Default:MarketData OriginalTimezone.
18+
For TimeSeries Default:CET
1819
product: The list of Product. Only *,
1920
is special character for 'delete all products in the range'
2021
version: the Version to operate on
@@ -25,9 +26,9 @@ class DeleteData:
2526
"""
2627

2728
ID: MarketDataIdentifier
28-
timezone: str
2929
rangeStart: datetime
3030
rangeEnd: datetime
31+
timezone: Optional[str] = None
3132
product: Optional[List[str]] = None
3233
version: Optional[datetime] = None
3334
deferCommandExecution: bool = False

0 commit comments

Comments
 (0)